added remove_slash and append_slash path utilities
renamed canonize to canonicalize added crude support for ~user -> /home/user added win32 specific stuff in basename added C-/ as an alias for C-_ some cosmetics, moved code create files with mode 0644 in raw_save_buffer untabified, removed redundant spaces modified code generators to the same effect
This commit is contained in:
parent
bef7b245a1
commit
4743fa1308
65 changed files with 4113 additions and 4051 deletions
|
|
@ -11,3 +11,4 @@ cptoqe
|
|||
kmaptoqe
|
||||
ligtoqe
|
||||
jistoqe
|
||||
allmodules.txt
|
||||
|
|
|
|||
12
Makefile
12
Makefile
|
|
@ -91,7 +91,7 @@ OBJS=qe.o charset.o buffer.o \
|
|||
input.o unicode_join.o display.o util.o hex.o list.o cutils.o
|
||||
|
||||
ifndef CONFIG_WIN32
|
||||
OBJS+= unix.o tty.o
|
||||
OBJS+= unix.o tty.o
|
||||
endif
|
||||
|
||||
# more charsets if needed
|
||||
|
|
@ -103,7 +103,7 @@ ifdef CONFIG_ALL_MODES
|
|||
OBJS+= unihex.o clang.o latex-mode.o xml.o bufed.o \
|
||||
makemode.o perl.o htmlsrc.o
|
||||
ifndef CONFIG_WIN32
|
||||
OBJS+= shell.o dired.o
|
||||
OBJS+= shell.o dired.o
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ endif
|
|||
|
||||
ifdef CONFIG_HTML
|
||||
CFLAGS+=-I./libqhtml
|
||||
DEP_LIBS+=libqhtml/libqhtml.a
|
||||
DEP_LIBS+=libqhtml/libqhtml.a
|
||||
LIBS+=-L./libqhtml -lqhtml
|
||||
OBJS+=html.o docbook.o
|
||||
ifndef CONFIG_WIN32
|
||||
|
|
@ -244,7 +244,7 @@ FILES=Changelog COPYING README TODO qe.1 config.eg \
|
|||
FILES+=libqhtml/Makefile libqhtml/css.c libqhtml/cssid.h \
|
||||
libqhtml/cssparse.c libqhtml/xmlparse.c libqhtml/htmlent.h \
|
||||
libqhtml/css.h libqhtml/csstoqe.c \
|
||||
libqhtml/docbook.css libqhtml/html.css
|
||||
libqhtml/docbook.css libqhtml/html.css
|
||||
|
||||
# fonts
|
||||
FILES+=fonts/fixed10.fbf fonts/fixed12.fbf fonts/fixed13.fbf fonts/fixed14.fbf \
|
||||
|
|
@ -293,8 +293,8 @@ KMAPS=Arabic.kmap ArmenianEast.kmap ArmenianWest.kmap Chinese-CJ.kmap \
|
|||
DanishAlternate.kmap GreekBible.kmap Polytonic.kmap Spanish.kmap \
|
||||
Thai.kmap VietnameseTelex.kmap Welsh.kmap \
|
||||
Hebrew.kmap HebrewIsraeli.kmap HebrewP.kmap Israeli.kmap Yiddish.kmap \
|
||||
Kana.kmap
|
||||
# Hangul.kmap Hangul2.kmap Hangul3.kmap Unicode2.kmap
|
||||
Kana.kmap
|
||||
# Hangul.kmap Hangul2.kmap Hangul3.kmap Unicode2.kmap
|
||||
#KMAPS_DIR=$(prefix)/share/yudit/data
|
||||
KMAPS_DIR=kmap
|
||||
KMAPS:=$(addprefix $(KMAPS_DIR)/, $(KMAPS))
|
||||
|
|
|
|||
10
arabic.c
10
arabic.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Arabic algorithms for QEmacs.
|
||||
* Arabic algorithms for QEmacs.
|
||||
*
|
||||
* Copyright (c) 2000 Fabrice Bellard.
|
||||
*
|
||||
|
|
@ -186,10 +186,10 @@ static const ArabicChar arabic_table[] = {
|
|||
};
|
||||
|
||||
static const unsigned short transparent[] = {
|
||||
0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650,
|
||||
0x0670,
|
||||
0x06d7, 0x06d8, 0x06d9, 0x06da, 0x06db, 0x06dc, 0x06df,
|
||||
0x06e0, 0x06e1, 0x06e2, 0x06e3, 0x06e4, 0x06e7, 0x06e8, 0x06ea, 0x06eb, 0x06ec,
|
||||
0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650,
|
||||
0x0670,
|
||||
0x06d7, 0x06d8, 0x06d9, 0x06da, 0x06db, 0x06dc, 0x06df,
|
||||
0x06e0, 0x06e1, 0x06e2, 0x06e3, 0x06e4, 0x06e7, 0x06e8, 0x06ea, 0x06eb, 0x06ec,
|
||||
0x06ed,
|
||||
};
|
||||
|
||||
|
|
|
|||
8
bufed.c
8
bufed.c
|
|
@ -47,7 +47,7 @@ static void build_bufed_list(EditState *s)
|
|||
if (!(b->flags & BF_SYSTEM) || (hs->flags & BUFED_ALL_VISIBLE))
|
||||
add_string(&hs->items, b->name);
|
||||
}
|
||||
|
||||
|
||||
/* build buffer */
|
||||
b = s->b;
|
||||
flags = b->flags;
|
||||
|
|
@ -116,7 +116,7 @@ static void bufed_select(EditState *s, int temp)
|
|||
|
||||
/* iterate 'func_item' to selected items. If no selected items, then
|
||||
use current item */
|
||||
static void string_selection_iterate(StringArray *cs,
|
||||
static void string_selection_iterate(StringArray *cs,
|
||||
int current_index,
|
||||
void (*func_item)(void *, StringItem *),
|
||||
void *opaque)
|
||||
|
|
@ -134,7 +134,7 @@ static void string_selection_iterate(StringArray *cs,
|
|||
}
|
||||
|
||||
/* if no item selected, then act on selected item */
|
||||
if (count == 0 &&
|
||||
if (count == 0 &&
|
||||
current_index >=0 && current_index < cs->nb_items) {
|
||||
item = cs->items[current_index];
|
||||
func_item(opaque, item);
|
||||
|
|
@ -295,7 +295,7 @@ static int bufed_init(void)
|
|||
bufed_mode.mode_init = bufed_mode_init;
|
||||
bufed_mode.mode_close = bufed_mode_close;
|
||||
bufed_mode.display_hook = bufed_display_hook;
|
||||
|
||||
|
||||
/* first register mode */
|
||||
qe_register_mode(&bufed_mode);
|
||||
|
||||
|
|
|
|||
83
buffer.c
83
buffer.c
|
|
@ -23,7 +23,7 @@
|
|||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
static void eb_addlog(EditBuffer *b, enum LogOperation op,
|
||||
static void eb_addlog(EditBuffer *b, enum LogOperation op,
|
||||
int offset, int size);
|
||||
|
||||
static EditBufferDataType *first_buffer_data_type;
|
||||
|
|
@ -38,7 +38,7 @@ static Page *find_page(EditBuffer *b, int *offset_ptr)
|
|||
int offset;
|
||||
|
||||
offset = *offset_ptr;
|
||||
if (b->cur_page && offset >= b->cur_offset &&
|
||||
if (b->cur_page && offset >= b->cur_offset &&
|
||||
offset < b->cur_offset + b->cur_page->size) {
|
||||
/* use the cache */
|
||||
*offset_ptr -= b->cur_offset;
|
||||
|
|
@ -90,8 +90,8 @@ static int eb_rw(EditBuffer *b, int offset, u8 *buf, int size1, int do_write)
|
|||
|
||||
size = size1;
|
||||
if (do_write)
|
||||
eb_addlog(b, LOGOP_WRITE, offset, size);
|
||||
|
||||
eb_addlog(b, LOGOP_WRITE, offset, size);
|
||||
|
||||
p = find_page(b, &offset);
|
||||
while (size > 0) {
|
||||
len = p->size - offset;
|
||||
|
|
@ -161,7 +161,7 @@ static void eb_insert1(EditBuffer *b, int page_index, const u8 *buf, int size)
|
|||
p->size += len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now add new pages if necessary */
|
||||
n = (size + MAX_PAGE_SIZE - 1) / MAX_PAGE_SIZE;
|
||||
if (n > 0) {
|
||||
|
|
@ -207,7 +207,7 @@ static void eb_insert_lowlevel(EditBuffer *b, int offset,
|
|||
len_out = p->size + len - MAX_PAGE_SIZE;
|
||||
page_index = p - b->page_table;
|
||||
if (len_out > 0)
|
||||
eb_insert1(b, page_index + 1,
|
||||
eb_insert1(b, page_index + 1,
|
||||
p->data + p->size - len_out, len_out);
|
||||
else
|
||||
len_out = 0;
|
||||
|
|
@ -217,7 +217,7 @@ static void eb_insert_lowlevel(EditBuffer *b, int offset,
|
|||
update_page(p);
|
||||
p->size += len - len_out;
|
||||
qe_realloc(&p->data, p->size);
|
||||
memmove(p->data + offset + len,
|
||||
memmove(p->data + offset + len,
|
||||
p->data + offset, p->size - (offset + len));
|
||||
memcpy(p->data + offset, buf, len);
|
||||
buf += len;
|
||||
|
|
@ -237,8 +237,8 @@ static void eb_insert_lowlevel(EditBuffer *b, int offset,
|
|||
/* Insert 'size bytes of 'src' buffer from position 'src_offset' into
|
||||
buffer 'dest' at offset 'dest_offset'. 'src' MUST BE DIFFERENT from
|
||||
'dest' */
|
||||
void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
||||
EditBuffer *src, int src_offset,
|
||||
void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
||||
EditBuffer *src, int src_offset,
|
||||
int size)
|
||||
{
|
||||
Page *p, *p_start, *q;
|
||||
|
|
@ -276,7 +276,7 @@ void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
|||
page_index = q - dest->page_table;
|
||||
if (dest_offset > 0) {
|
||||
page_index++;
|
||||
eb_insert1(dest, page_index, q->data + dest_offset,
|
||||
eb_insert1(dest, page_index, q->data + dest_offset,
|
||||
q->size - dest_offset);
|
||||
/* must reload q because page_table may have been
|
||||
realloced */
|
||||
|
|
@ -291,7 +291,7 @@ void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
|||
|
||||
/* update total_size */
|
||||
dest->total_size += size;
|
||||
|
||||
|
||||
/* compute the number of complete pages to insert */
|
||||
p_start = p;
|
||||
size_start = size;
|
||||
|
|
@ -326,7 +326,7 @@ void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
|||
}
|
||||
page_index = q - dest->page_table;
|
||||
}
|
||||
|
||||
|
||||
/* insert the remaning bytes */
|
||||
if (size > 0) {
|
||||
eb_insert1(dest, page_index, p->data, size);
|
||||
|
|
@ -346,7 +346,7 @@ void eb_insert(EditBuffer *b, int offset, const void *buf, int size)
|
|||
/* sanity checks */
|
||||
if (offset > b->total_size)
|
||||
offset = b->total_size;
|
||||
|
||||
|
||||
if (offset < 0 || size <= 0)
|
||||
return;
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ void eb_delete(EditBuffer *b, int offset, int size)
|
|||
n++;
|
||||
} else {
|
||||
update_page(p);
|
||||
memmove(p->data + offset, p->data + offset + len,
|
||||
memmove(p->data + offset, p->data + offset + len,
|
||||
p->size - offset - len);
|
||||
p->size -= len;
|
||||
qe_realloc(&p->data, p->size);
|
||||
|
|
@ -411,7 +411,7 @@ void eb_delete(EditBuffer *b, int offset, int size)
|
|||
/* now delete the requested pages */
|
||||
if (n > 0) {
|
||||
b->nb_pages -= n;
|
||||
memmove(del_start, del_start + n,
|
||||
memmove(del_start, del_start + n,
|
||||
(b->page_table + b->nb_pages - del_start) * sizeof(Page));
|
||||
qe_realloc(&b->page_table, b->nb_pages * sizeof(Page));
|
||||
}
|
||||
|
|
@ -436,16 +436,16 @@ void log_reset(EditBuffer *b)
|
|||
/* rename a buffer and add characters so that the name is unique */
|
||||
void eb_set_buffer_name(EditBuffer *b, const char *name1)
|
||||
{
|
||||
char name[sizeof(b->name)];
|
||||
char name[MAX_BUFFERNAME_SIZE];
|
||||
int n, pos;
|
||||
|
||||
pstrcpy(name, sizeof(b->name) - 10, name1);
|
||||
pstrcpy(name, sizeof(name) - 10, name1);
|
||||
/* set the buffer name to NULL since it will be changed */
|
||||
b->name[0] = '\0';
|
||||
pos = strlen(name);
|
||||
n = 2;
|
||||
while (eb_find(name) != NULL) {
|
||||
snprintf(name + pos, sizeof(b->name) - pos, "<%d>", n);
|
||||
snprintf(name + pos, sizeof(name) - pos, "<%d>", n);
|
||||
n++;
|
||||
}
|
||||
pstrcpy(b->name, sizeof(b->name), name);
|
||||
|
|
@ -482,7 +482,7 @@ EditBuffer *eb_new(const char *name, int flags)
|
|||
|
||||
/* CG: default charset should be selectable */
|
||||
eb_set_charset(b, &charset_8859_1);
|
||||
|
||||
|
||||
/* add mark move callback */
|
||||
eb_add_callback(b, eb_offset_callback, &b->mark);
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ int eb_add_callback(EditBuffer *b, EditBufferCallback cb, void *opaque)
|
|||
void eb_free_callback(EditBuffer *b, EditBufferCallback cb, void *opaque)
|
||||
{
|
||||
EditBufferCallbackList **pl, *l;
|
||||
|
||||
|
||||
for (pl = &b->first_callback; (*pl) != NULL; pl = &(*pl)->next) {
|
||||
l = *pl;
|
||||
if (l->callback == cb && l->opaque == opaque) {
|
||||
|
|
@ -721,7 +721,7 @@ void eb_offset_callback(__unused__ EditBuffer *b, void *opaque,
|
|||
/************************************************************/
|
||||
/* undo buffer */
|
||||
|
||||
static void eb_addlog(EditBuffer *b, enum LogOperation op,
|
||||
static void eb_addlog(EditBuffer *b, enum LogOperation op,
|
||||
int offset, int size)
|
||||
{
|
||||
int was_modified, len, size_trailer;
|
||||
|
|
@ -820,7 +820,7 @@ void do_undo(EditState *s)
|
|||
log_index -= sizeof(int);
|
||||
eb_read(b->log_buffer, log_index, &size_trailer, sizeof(int));
|
||||
log_index -= size_trailer + sizeof(LogBuffer);
|
||||
|
||||
|
||||
/* log_current is 1 + index to have zero as default value */
|
||||
b->log_current = log_index + 1;
|
||||
|
||||
|
|
@ -858,7 +858,7 @@ void do_undo(EditState *s)
|
|||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
b->modified = lb.was_modified;
|
||||
}
|
||||
|
||||
|
|
@ -892,7 +892,7 @@ int eb_nextc(EditBuffer *b, int offset, int *next_ptr)
|
|||
if (ch == ESCAPE_CHAR) {
|
||||
eb_read(b, offset, buf + 1, MAX_CHAR_BYTES - 1);
|
||||
p = buf;
|
||||
ch = b->charset_state.decode_func(&b->charset_state,
|
||||
ch = b->charset_state.decode_func(&b->charset_state,
|
||||
(const u8 **)&p);
|
||||
offset += (p - buf) - 1;
|
||||
}
|
||||
|
|
@ -1027,7 +1027,7 @@ int eb_goto_pos(EditBuffer *b, int line1, int col1)
|
|||
}
|
||||
return b->total_size;
|
||||
}
|
||||
|
||||
|
||||
int eb_get_pos(EditBuffer *b, int *line_ptr, int *col_ptr, int offset)
|
||||
{
|
||||
Page *p, *p_end;
|
||||
|
|
@ -1046,7 +1046,7 @@ int eb_get_pos(EditBuffer *b, int *line_ptr, int *col_ptr, int offset)
|
|||
break;
|
||||
if (!(p->flags & PG_VALID_POS)) {
|
||||
p->flags |= PG_VALID_POS;
|
||||
get_pos(p->data, p->size, &p->nb_lines, &p->col,
|
||||
get_pos(p->data, p->size, &p->nb_lines, &p->col,
|
||||
&b->charset_state);
|
||||
}
|
||||
line += p->nb_lines;
|
||||
|
|
@ -1241,14 +1241,14 @@ static void eb_io_stop(EditBuffer *b, int err);
|
|||
/* load a buffer asynchronously and launch the callback. The buffer
|
||||
stays in 'loading' state while begin loaded. It is also marked
|
||||
readonly. */
|
||||
int load_buffer(EditBuffer *b, const char *filename,
|
||||
int load_buffer(EditBuffer *b, const char *filename,
|
||||
int offset, int nolog,
|
||||
void (*progress_cb)(void *opaque, int size),
|
||||
void (*progress_cb)(void *opaque, int size),
|
||||
void (*completion_cb)(void *opaque, int err), void *opaque)
|
||||
{
|
||||
URLContext *h;
|
||||
BufferIOState *s;
|
||||
|
||||
|
||||
/* cannot load a buffer if already I/Os or readonly */
|
||||
if (b->flags & (BF_LOADING | BF_SAVING | BF_READONLY))
|
||||
return -1;
|
||||
|
|
@ -1331,6 +1331,7 @@ int raw_load_buffer1(EditBuffer *b, FILE *f, int offset)
|
|||
int len;
|
||||
unsigned char buf[IOBUF_SIZE];
|
||||
|
||||
//put_status(NULL, "loading %s", filename);
|
||||
for (;;) {
|
||||
len = fread(buf, 1, IOBUF_SIZE, f);
|
||||
if (len < 0)
|
||||
|
|
@ -1340,6 +1341,7 @@ int raw_load_buffer1(EditBuffer *b, FILE *f, int offset)
|
|||
eb_insert(b, offset, buf, len);
|
||||
offset += len;
|
||||
}
|
||||
//put_status(NULL, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1363,6 +1365,7 @@ int mmap_buffer(EditBuffer *b, const char *filename)
|
|||
if (fd < 0)
|
||||
return -1;
|
||||
file_size = lseek(fd, 0, SEEK_END);
|
||||
//put_status(NULL, "mapping %s", filename);
|
||||
file_ptr = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if ((void*)file_ptr == MAP_FAILED) {
|
||||
close(fd);
|
||||
|
|
@ -1391,6 +1394,7 @@ int mmap_buffer(EditBuffer *b, const char *filename)
|
|||
p++;
|
||||
}
|
||||
b->file_handle = fd;
|
||||
//put_status(NULL, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1401,8 +1405,7 @@ static int raw_load_buffer(EditBuffer *b, FILE *f)
|
|||
int ret;
|
||||
struct stat st;
|
||||
|
||||
if (stat(b->filename, &st) == 0 &&
|
||||
st.st_size >= MIN_MMAP_SIZE) {
|
||||
if (stat(b->filename, &st) == 0 && st.st_size >= MIN_MMAP_SIZE) {
|
||||
ret = mmap_buffer(b, b->filename);
|
||||
} else {
|
||||
ret = raw_load_buffer1(b, f, 0);
|
||||
|
|
@ -1419,10 +1422,11 @@ static int raw_save_buffer(EditBuffer *b, int start, int end,
|
|||
int fd, len, size, written;
|
||||
unsigned char buf[IOBUF_SIZE];
|
||||
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
//put_status(NULL, "writing %s", filename);
|
||||
if (end < start) {
|
||||
int tmp = start;
|
||||
start = end;
|
||||
|
|
@ -1449,6 +1453,7 @@ static int raw_save_buffer(EditBuffer *b, int start, int end,
|
|||
size -= len;
|
||||
}
|
||||
close(fd);
|
||||
//put_status(NULL, "");
|
||||
return written;
|
||||
}
|
||||
|
||||
|
|
@ -1518,7 +1523,7 @@ int eb_get_contents(EditBuffer *b, char *buf, int buf_size)
|
|||
}
|
||||
|
||||
/* get the line starting at offset 'offset' as an array of code points */
|
||||
/* offset is bumped to the beginning of the next line */
|
||||
/* offset is bumped to the beginning of the next line */
|
||||
/* returns the number of code points stored in buf, excluding '\0' */
|
||||
/* buf_size must be > 0 */
|
||||
/* XXX: cannot detect truncation */
|
||||
|
|
@ -1527,7 +1532,7 @@ int eb_get_line(EditBuffer *b, unsigned int *buf, int buf_size,
|
|||
{
|
||||
unsigned int *buf_ptr, *buf_end;
|
||||
int c, offset;
|
||||
|
||||
|
||||
offset = *offset_ptr;
|
||||
|
||||
buf_ptr = buf;
|
||||
|
|
@ -1545,7 +1550,7 @@ int eb_get_line(EditBuffer *b, unsigned int *buf, int buf_size,
|
|||
}
|
||||
|
||||
/* get the line starting at offset 'offset' encoded in utf-8 */
|
||||
/* offset is bumped to the beginning of the next line */
|
||||
/* offset is bumped to the beginning of the next line */
|
||||
/* returns the number of bytes stored in buf, excluding '\0' */
|
||||
/* buf_size must be > 0 */
|
||||
/* XXX: cannot detect truncation */
|
||||
|
|
@ -1555,7 +1560,7 @@ int eb_get_strline(EditBuffer *b, char *buf, int buf_size,
|
|||
char utf8_buf[6];
|
||||
char *buf_ptr, *buf_end;
|
||||
int c, offset, len;
|
||||
|
||||
|
||||
offset = *offset_ptr;
|
||||
|
||||
buf_ptr = buf;
|
||||
|
|
@ -1577,7 +1582,7 @@ int eb_get_strline(EditBuffer *b, char *buf, int buf_size,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
/* overflow: skip past '\n' */
|
||||
/* overflow: skip past '\n' */
|
||||
offset = eb_next_line(b, offset);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1688,7 +1693,7 @@ int eb_write_buffer(EditBuffer *b, int start, int end, const char *filename)
|
|||
{
|
||||
if (!b->data_type->buffer_save)
|
||||
return -1;
|
||||
|
||||
|
||||
return b->data_type->buffer_save(b, start, end, filename);
|
||||
}
|
||||
|
||||
|
|
@ -1704,7 +1709,7 @@ int eb_save_buffer(EditBuffer *b)
|
|||
|
||||
if (!b->data_type->buffer_save)
|
||||
return -1;
|
||||
|
||||
|
||||
filename = b->filename;
|
||||
/* get old file permission */
|
||||
mode = 0644;
|
||||
|
|
|
|||
18
cfb.c
18
cfb.c
|
|
@ -73,13 +73,13 @@ static void cfb16_fill_rectangle(QEditScreen *s,
|
|||
for (y = 0; y < h; y++) {
|
||||
d = dest;
|
||||
n = w;
|
||||
|
||||
|
||||
if (((int)d & 3) != 0) {
|
||||
((short *)d)[0] = col;
|
||||
d += 2;
|
||||
n--;
|
||||
}
|
||||
|
||||
|
||||
while (n >= 8) {
|
||||
((int *)d)[0] = col;
|
||||
((int *)d)[1] = col;
|
||||
|
|
@ -255,11 +255,11 @@ static void cfb_draw_text(QEditScreen *s, QEFont *font,
|
|||
if (x1 >= s->clip_x1 && y1 >= s->clip_y1 &&
|
||||
x2 <= s->clip_x2 && y2 <= s->clip_y2)
|
||||
goto draw;
|
||||
|
||||
|
||||
if (x2 <= s->clip_x1 || y2 <= s->clip_y1 ||
|
||||
x1 >= s->clip_x2 || y1 >= s->clip_y2)
|
||||
goto nodraw;
|
||||
|
||||
|
||||
if (x1 < s->clip_x1) {
|
||||
glyph_ptr += s->clip_x1 - x1;
|
||||
x1 = s->clip_x1;
|
||||
|
|
@ -273,8 +273,8 @@ static void cfb_draw_text(QEditScreen *s, QEFont *font,
|
|||
if (y2 > s->clip_y2)
|
||||
y2 = s->clip_y2;
|
||||
draw:
|
||||
cfb->draw_glyph(s, x1, y1,
|
||||
x2 - x1, y2 - y1,
|
||||
cfb->draw_glyph(s, x1, y1,
|
||||
x2 - x1, y2 - y1,
|
||||
color, glyph_ptr, wrap);
|
||||
nodraw:
|
||||
x += g->xincr;
|
||||
|
|
@ -305,7 +305,7 @@ static void cfb_set_clip(__unused__ QEditScreen *s,
|
|||
{
|
||||
}
|
||||
|
||||
int cfb_init(QEditScreen *s,
|
||||
int cfb_init(QEditScreen *s,
|
||||
void *base, int wrap, int depth, const char *font_path)
|
||||
{
|
||||
CFBContext *cfb = s->private;
|
||||
|
|
@ -314,7 +314,7 @@ int cfb_init(QEditScreen *s,
|
|||
cfb->wrap = wrap;
|
||||
cfb->depth = depth;
|
||||
cfb->bpp = (depth + 7) / 8;
|
||||
|
||||
|
||||
switch (depth) {
|
||||
case 15:
|
||||
cfb->get_color = cfb15_get_color;
|
||||
|
|
@ -347,6 +347,6 @@ int cfb_init(QEditScreen *s,
|
|||
s->dpy.dpy_text_metrics = fbf_text_metrics;
|
||||
s->dpy.dpy_open_font = fbf_open_font;
|
||||
s->dpy.dpy_close_font = fbf_close_font;
|
||||
|
||||
|
||||
return fbf_render_init(font_path);
|
||||
}
|
||||
|
|
|
|||
2
cfb.h
2
cfb.h
|
|
@ -29,5 +29,5 @@ typedef struct CFBContext {
|
|||
unsigned char *glyph, int glyph_wrap);
|
||||
} CFBContext;
|
||||
|
||||
int cfb_init(QEditScreen *s,
|
||||
int cfb_init(QEditScreen *s,
|
||||
void *base, int wrap, int depth, const char *font_path);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void decode_8859_1_init(CharsetDecodeState *s)
|
|||
s->table = table_idem;
|
||||
}
|
||||
|
||||
static unsigned char *encode_8859_1(__unused__ QECharset *charset,
|
||||
static unsigned char *encode_8859_1(__unused__ QECharset *charset,
|
||||
unsigned char *p, int c)
|
||||
{
|
||||
if (c <= 0xff) {
|
||||
|
|
@ -72,7 +72,7 @@ static void decode_vt100_init(CharsetDecodeState *s)
|
|||
s->table = table_idem;
|
||||
}
|
||||
|
||||
static unsigned char *encode_vt100(__unused__ QECharset *charset,
|
||||
static unsigned char *encode_vt100(__unused__ QECharset *charset,
|
||||
unsigned char *p, int c)
|
||||
{
|
||||
if (c <= 0xff) {
|
||||
|
|
@ -191,7 +191,7 @@ int utf8_encode(char *q0, int c)
|
|||
return q - q0;
|
||||
}
|
||||
|
||||
int utf8_to_unicode(unsigned int *dest, int dest_length,
|
||||
int utf8_to_unicode(unsigned int *dest, int dest_length,
|
||||
const char *str)
|
||||
{
|
||||
const char *p;
|
||||
|
|
@ -297,7 +297,7 @@ QECharset *find_charset(const char *name)
|
|||
void charset_decode_init(CharsetDecodeState *s, QECharset *charset)
|
||||
{
|
||||
unsigned short *table;
|
||||
|
||||
|
||||
s->table = NULL; /* fail safe */
|
||||
if (charset->table_alloc) {
|
||||
table = qe_malloc_array(unsigned short, 256);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static int decode_euc_jp_func(__unused__ CharsetDecodeState *s,
|
|||
{
|
||||
const unsigned char *p;
|
||||
int c, c2;
|
||||
|
||||
|
||||
p = *pp;
|
||||
c = *p++;
|
||||
if (c == 0x8e) {
|
||||
|
|
@ -182,7 +182,7 @@ static int decode_sjis_func(__unused__ CharsetDecodeState *s,
|
|||
{
|
||||
const unsigned char *p;
|
||||
int c, c1, c2, adjust, row, col;
|
||||
|
||||
|
||||
p = *pp;
|
||||
c = *p++;
|
||||
if (c >= 0xf0) {
|
||||
|
|
|
|||
3408
charsetjis.def
3408
charsetjis.def
File diff suppressed because it is too large
Load diff
1268
charsetmore.c
1268
charsetmore.c
File diff suppressed because it is too large
Load diff
22
clang.c
22
clang.c
|
|
@ -21,7 +21,7 @@
|
|||
#include "qe.h"
|
||||
|
||||
#if 0
|
||||
static const char cc_keywords[] =
|
||||
static const char cc_keywords[] =
|
||||
"asm|catch|class|delete|friend|inline|new|operator|"
|
||||
"private|protected|public|template|try|this|virtual|throw|";
|
||||
|
||||
|
|
@ -33,13 +33,13 @@ static const char java_keywords[] =
|
|||
"true|try|var|with|";
|
||||
#endif
|
||||
|
||||
static const char *c_mode_keywords =
|
||||
static const char *c_mode_keywords =
|
||||
"auto|break|case|const|continue|default|do|else|enum|extern|for|goto|"
|
||||
"if|inline|register|restrict|return|sizeof|static|struct|switch|"
|
||||
"typedef|union|volatile|while|";
|
||||
|
||||
/* NOTE: 'var' is added for javascript */
|
||||
static const char *c_mode_types =
|
||||
static const char *c_mode_types =
|
||||
"char|double|float|int|long|unsigned|short|signed|void|var|"
|
||||
"_Bool|_Complex|_Imaginary|";
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ enum {
|
|||
C_PREPROCESS = 16, /* preprocessor directive with \ at EOL */
|
||||
};
|
||||
|
||||
void c_colorize_line(unsigned int *buf, int len,
|
||||
void c_colorize_line(unsigned int *buf, int len,
|
||||
int *colorize_state_ptr, __unused__ int state_only)
|
||||
{
|
||||
int c, state, style, style1, type_decl, klen, delim;
|
||||
|
|
@ -210,7 +210,7 @@ void c_colorize_line(unsigned int *buf, int len,
|
|||
continue;
|
||||
}
|
||||
if (qe_isalpha_(c)) {
|
||||
|
||||
|
||||
/* XXX: should support :: and $ */
|
||||
klen = 0;
|
||||
p--;
|
||||
|
|
@ -338,7 +338,7 @@ static void insert_spaces(EditState *s, int *offset_ptr, int i)
|
|||
i -= s->tab_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* insert needed spaces */
|
||||
while (i > 0) {
|
||||
size = i;
|
||||
|
|
@ -469,7 +469,7 @@ static void do_c_indent(EditState *s)
|
|||
unsigned int *p1, *p2;
|
||||
/* special case for if/for/while */
|
||||
p1 = p;
|
||||
while (p > buf &&
|
||||
while (p > buf &&
|
||||
(p[-1] >> STYLE_SHIFT) == QE_STYLE_KEYWORD)
|
||||
p--;
|
||||
p2 = p;
|
||||
|
|
@ -479,7 +479,7 @@ static void do_c_indent(EditState *s)
|
|||
}
|
||||
*q = '\0';
|
||||
|
||||
if (!eoi_found &&
|
||||
if (!eoi_found &&
|
||||
(!strcmp(buf1, "if") ||
|
||||
!strcmp(buf1, "for") ||
|
||||
!strcmp(buf1, "while"))) {
|
||||
|
|
@ -509,7 +509,7 @@ static void do_c_indent(EditState *s)
|
|||
}
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
c = buf[i];
|
||||
c = buf[i];
|
||||
style = c >> STYLE_SHIFT;
|
||||
/* if preprocess, no indent */
|
||||
if (style == QE_STYLE_PREPROCESS) {
|
||||
|
|
@ -528,7 +528,7 @@ static void do_c_indent(EditState *s)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the number of needed spaces is in 'pos' */
|
||||
|
||||
/* CG: should not modify buffer if indentation in correct */
|
||||
|
|
@ -755,7 +755,7 @@ static CmdDef c_commands[] = {
|
|||
/* should map to KEY_META + KEY_CTRL_LEFT ? */
|
||||
CMDV( KEY_META('['), KEY_NONE,
|
||||
"c-backward-preprocessor", do_c_forward_preprocessor, ESi, -1, "*v")
|
||||
CMDV( KEY_META(']'), KEY_NONE,
|
||||
CMDV( KEY_META(']'), KEY_NONE,
|
||||
"c-forward-preprocessor", do_c_forward_preprocessor, ESi, 1, "*v")
|
||||
/* CG: should use 'k' intrinsic argument */
|
||||
CMDV( ';', KEY_NONE, "c-electric-semi&comma", do_c_electric, ESi, ';', "*v")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ include 8859-4.TXT
|
|||
|
||||
[8859-5]
|
||||
ISO 8859-5 (Cyrillic)
|
||||
"ISO-8859-5", "8859-5"
|
||||
"ISO-8859-5", "8859-5"
|
||||
include 8859-5.TXT
|
||||
|
||||
[8859-6]
|
||||
|
|
@ -45,7 +45,7 @@ include 8859-8.TXT
|
|||
|
||||
[8859-9]
|
||||
ISO 8859-9 (Turkish)
|
||||
"ISO-8859-9", "8859-9"
|
||||
"ISO-8859-9", "8859-9"
|
||||
include 8859-9.TXT
|
||||
|
||||
[8859-10]
|
||||
|
|
@ -248,14 +248,14 @@ MacRoman 2000
|
|||
"x-mac", "mac", "mac-roman"
|
||||
include MAC-ROMAN.TXT
|
||||
# Some differences in encoding are listed below
|
||||
#0xBD 0x2126 #OHM SIGN
|
||||
0xBD 0x03A9 #GREEK CAPITAL LETTER OMEGA
|
||||
#0xC6 0x2206 #INCREMENT
|
||||
0xC6 0x0394 #GREEK CAPITAL LETTER DELTA
|
||||
#0xDB 0x00A4 #CURRENCY SIGN
|
||||
0xDB 0x20AC #SYMBOLE EURO
|
||||
#0xF0 #UNDEFINED
|
||||
0xF0 0xF8FF #Mac Logo (in Private Use Area)
|
||||
#0xBD 0x2126 #OHM SIGN
|
||||
0xBD 0x03A9 #GREEK CAPITAL LETTER OMEGA
|
||||
#0xC6 0x2206 #INCREMENT
|
||||
0xC6 0x0394 #GREEK CAPITAL LETTER DELTA
|
||||
#0xDB 0x00A4 #CURRENCY SIGN
|
||||
0xDB 0x20AC #SYMBOLE EURO
|
||||
#0xF0 #UNDEFINED
|
||||
0xF0 0xF8FF #Mac Logo (in Private Use Area)
|
||||
|
||||
[mac-latin2]
|
||||
Mac latin 2
|
||||
|
|
|
|||
14
cptoqe.c
14
cptoqe.c
|
|
@ -108,7 +108,7 @@ static void handle_cp(FILE *f0, const char *name, const char *fname)
|
|||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
|
||||
|
||||
strcpy(iso_name, name);
|
||||
strcpy(alias_list, "");
|
||||
has_iso_name = has_alias_list = 0;
|
||||
|
|
@ -181,7 +181,7 @@ static void handle_cp(FILE *f0, const char *name, const char *fname)
|
|||
table[c1] = c2;
|
||||
nb++;
|
||||
}
|
||||
|
||||
|
||||
if (table[10] != 10) {
|
||||
if (table[0x25] == 0x0A) {
|
||||
/* EBCDIC file */
|
||||
|
|
@ -191,7 +191,7 @@ static void handle_cp(FILE *f0, const char *name, const char *fname)
|
|||
filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
min_code = 0x7fffffff;
|
||||
max_code = -1;
|
||||
for (i = 0; i < 256; i++) {
|
||||
|
|
@ -202,7 +202,7 @@ static void handle_cp(FILE *f0, const char *name, const char *fname)
|
|||
max_code = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("\n"
|
||||
"/*----------------------------------------------------------------\n"
|
||||
" * filename: %s\n"
|
||||
|
|
@ -218,8 +218,8 @@ static void handle_cp(FILE *f0, const char *name, const char *fname)
|
|||
j = 0;
|
||||
for (i = min_code; i <= max_code; i++) {
|
||||
if ((j & 7) == 0)
|
||||
printf(" ");
|
||||
printf("0x%04x, ", table[i]);
|
||||
printf(" ");
|
||||
printf(" 0x%04x,", table[i]);
|
||||
if ((j++ & 7) == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ int main(int argc, char **argv)
|
|||
else
|
||||
*p = tolower((unsigned char)*p);
|
||||
}
|
||||
|
||||
|
||||
f = open_index(indexname, name);
|
||||
if (!f) {
|
||||
f = fopen(filename, "r");
|
||||
|
|
|
|||
2
cutils.c
2
cutils.c
|
|
@ -56,7 +56,7 @@ int strstart(const char *str, const char *val, const char **ptr)
|
|||
* 1 then it is clamped to buf_size - 1.
|
||||
* NOTE: this function does what strncpy should have done to be
|
||||
* useful. NEVER use strncpy.
|
||||
*
|
||||
*
|
||||
* @param buf destination buffer
|
||||
* @param buf_size size of destination buffer
|
||||
* @param str source string
|
||||
|
|
|
|||
2
cutils.h
2
cutils.h
|
|
@ -46,7 +46,7 @@ static inline int list_empty(struct list_head *head)
|
|||
return head->next == head;
|
||||
}
|
||||
|
||||
static inline void __list_add(struct list_head *elem,
|
||||
static inline void __list_add(struct list_head *elem,
|
||||
struct list_head *prev, struct list_head *next)
|
||||
{
|
||||
next->prev = elem;
|
||||
|
|
|
|||
38
dired.c
38
dired.c
|
|
@ -60,7 +60,7 @@ static void dired_free(EditState *s)
|
|||
{
|
||||
DiredState *ds = s->mode_data;
|
||||
int i;
|
||||
|
||||
|
||||
/* free opaques */
|
||||
for (i = 0; i < ds->items.nb_items; i++) {
|
||||
qe_free(&ds->items.items[i]->opaque);
|
||||
|
|
@ -128,7 +128,7 @@ static void do_dired_sort(EditState *s)
|
|||
if (index >= 0 && index < hs->items.nb_items)
|
||||
cur_item = hs->items.items[index];
|
||||
|
||||
qsort(hs->items.items, hs->items.nb_items,
|
||||
qsort(hs->items.items, hs->items.nb_items,
|
||||
sizeof(StringItem *), dired_sort_func);
|
||||
|
||||
/* construct list buffer */
|
||||
|
|
@ -175,7 +175,7 @@ static void dired_sort(EditState *s, const char *sort_order)
|
|||
{
|
||||
DiredState *hs = s->mode_data;
|
||||
const char *p;
|
||||
|
||||
|
||||
for (p = sort_order; *p; p++) {
|
||||
switch (qe_tolower((unsigned char)*p)) {
|
||||
case 'n': /* name */
|
||||
|
|
@ -231,7 +231,7 @@ static void build_dired_list(EditState *s, const char *path)
|
|||
dired_free(s);
|
||||
|
||||
/* CG: should make absolute ? */
|
||||
canonize_path(hs->path, sizeof(hs->path), path);
|
||||
canonicalize_path(hs->path, sizeof(hs->path), path);
|
||||
eb_set_filename(s->b, hs->path);
|
||||
s->b->flags |= BF_DIRED;
|
||||
|
||||
|
|
@ -278,8 +278,8 @@ static void build_dired_list(EditState *s, const char *path)
|
|||
int major, minor;
|
||||
major = (st.st_rdev >> 8) & 0xff;
|
||||
minor = st.st_rdev & 0xff;
|
||||
snprintf(buf, sizeof(buf), "%c%4d%4d",
|
||||
S_ISCHR(st.st_mode) ? 'c' : 'b',
|
||||
snprintf(buf, sizeof(buf), "%c%4d%4d",
|
||||
S_ISCHR(st.st_mode) ? 'c' : 'b',
|
||||
major, minor);
|
||||
} else if (S_ISLNK(st.st_mode)) {
|
||||
pstrcat(line, sizeof(line), "-> ");
|
||||
|
|
@ -291,7 +291,7 @@ static void build_dired_list(EditState *s, const char *path)
|
|||
buf[0] = '\0';
|
||||
}
|
||||
pstrcat(line, sizeof(line), buf);
|
||||
|
||||
|
||||
item = add_string(&hs->items, line);
|
||||
if (item) {
|
||||
DiredItem *dip;
|
||||
|
|
@ -310,7 +310,7 @@ static void build_dired_list(EditState *s, const char *path)
|
|||
do_dired_sort(s);
|
||||
}
|
||||
|
||||
static char *get_dired_filename(EditState *s,
|
||||
static char *get_dired_filename(EditState *s,
|
||||
char *buf, int buf_size, int index)
|
||||
{
|
||||
DiredState *hs = s->mode_data;
|
||||
|
|
@ -319,15 +319,15 @@ static char *get_dired_filename(EditState *s,
|
|||
|
||||
/* CG: assuming buf_size > 0 */
|
||||
buf[0] = '\0';
|
||||
|
||||
|
||||
if (index < 0 || index >= hs->items.nb_items)
|
||||
return NULL;
|
||||
|
||||
|
||||
item = hs->items.items[index];
|
||||
dip = item->opaque;
|
||||
|
||||
|
||||
/* build filename */
|
||||
/* CG: Should canonize path */
|
||||
/* CG: Should canonicalize path */
|
||||
return makepath(buf, buf_size, hs->path, dip->name);
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ static void dired_select(EditState *s)
|
|||
char filename[MAX_FILENAME_SIZE];
|
||||
EditState *e;
|
||||
|
||||
if (!get_dired_filename(s, filename, sizeof(filename),
|
||||
if (!get_dired_filename(s, filename, sizeof(filename),
|
||||
dired_get_index(s))) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ static void dired_parent(EditState *s)
|
|||
{
|
||||
DiredState *hs = s->mode_data;
|
||||
char filename[MAX_FILENAME_SIZE];
|
||||
|
||||
|
||||
makepath(filename, sizeof(filename), hs->path, "..");
|
||||
|
||||
/* CG: Should make current directory current item in parent */
|
||||
|
|
@ -419,7 +419,7 @@ static void dired_parent(EditState *s)
|
|||
static void dired_refresh(EditState *s)
|
||||
{
|
||||
DiredState *hs = s->mode_data;
|
||||
|
||||
|
||||
/* CG: Should try and keep current entry */
|
||||
build_dired_list(s, hs->path);
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ static void dired_display_hook(EditState *s)
|
|||
/* Should not rely on last_index! */
|
||||
if (index != ds->last_index) {
|
||||
ds->last_index = index;
|
||||
if (get_dired_filename(s, filename, sizeof(filename),
|
||||
if (get_dired_filename(s, filename, sizeof(filename),
|
||||
dired_get_index(s))) {
|
||||
dired_view_file(s, filename);
|
||||
}
|
||||
|
|
@ -509,9 +509,9 @@ void do_dired(EditState *s)
|
|||
p = strrchr(filename, '/');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
canonize_absolute_path(filename, sizeof(filename), filename);
|
||||
canonicalize_absolute_path(filename, sizeof(filename), filename);
|
||||
eb_set_filename(b, filename);
|
||||
|
||||
|
||||
width = qs->width / 5;
|
||||
e = insert_window_left(b, width, WF_MODELINE);
|
||||
do_set_mode(e, &dired_mode, NULL);
|
||||
|
|
@ -583,7 +583,7 @@ static int dired_init(void)
|
|||
dired_mode.mode_init = dired_mode_init;
|
||||
dired_mode.mode_close = dired_mode_close;
|
||||
dired_mode.display_hook = dired_display_hook;
|
||||
|
||||
|
||||
/* first register mode */
|
||||
qe_register_mode(&dired_mode);
|
||||
|
||||
|
|
|
|||
24
display.c
24
display.c
|
|
@ -28,12 +28,12 @@ void fill_rectangle(QEditScreen *s,
|
|||
int x2, y2;
|
||||
x2 = x1 + w;
|
||||
y2 = y1 + h;
|
||||
|
||||
|
||||
/* quick clip rejection */
|
||||
if (x2 <= s->clip_x1 || y2 <= s->clip_y1 ||
|
||||
x1 >= s->clip_x2 || y1 >= s->clip_y2)
|
||||
return;
|
||||
|
||||
|
||||
/* region update */
|
||||
if (x2 > s->clip_x2)
|
||||
x2 = s->clip_x2;
|
||||
|
|
@ -59,7 +59,7 @@ void set_clip_rectangle(QEditScreen *s, CSSRect *r)
|
|||
y1 = r->y1;
|
||||
x2 = r->x2;
|
||||
y2 = r->y2;
|
||||
|
||||
|
||||
if (x2 > s->width)
|
||||
x2 = s->width;
|
||||
if (y2 > s->height)
|
||||
|
|
@ -68,7 +68,7 @@ void set_clip_rectangle(QEditScreen *s, CSSRect *r)
|
|||
x1 = 0;
|
||||
if (y1 < 0)
|
||||
y1 = 0;
|
||||
|
||||
|
||||
s->clip_x1 = x1;
|
||||
s->clip_y1 = y1;
|
||||
s->clip_x2 = x2;
|
||||
|
|
@ -92,7 +92,7 @@ void push_clip_rectangle(QEditScreen *s, CSSRect *or, CSSRect *r)
|
|||
y1 = r->y1;
|
||||
x2 = r->x2;
|
||||
y2 = r->y2;
|
||||
|
||||
|
||||
if (x2 > s->clip_x2)
|
||||
x2 = s->clip_x2;
|
||||
if (y2 > s->clip_y2)
|
||||
|
|
@ -101,7 +101,7 @@ void push_clip_rectangle(QEditScreen *s, CSSRect *or, CSSRect *r)
|
|||
x1 = s->clip_x1;
|
||||
if (y1 < s->clip_y1)
|
||||
y1 = s->clip_y1;
|
||||
|
||||
|
||||
/* set new rectangle */
|
||||
s->clip_x1 = x1;
|
||||
s->clip_y1 = y1;
|
||||
|
|
@ -244,11 +244,11 @@ void bmp_free(QEditScreen *s, QEBitmap **bp)
|
|||
}
|
||||
}
|
||||
|
||||
void bmp_draw(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
void bmp_draw(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
int offset_x, int offset_y, int flags)
|
||||
{
|
||||
s->dpy.dpy_bmp_draw(s, b, dst_x, dst_y, dst_w, dst_h,
|
||||
s->dpy.dpy_bmp_draw(s, b, dst_x, dst_y, dst_w, dst_h,
|
||||
offset_x, offset_y, flags);
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ typedef struct QECachedBitmap {
|
|||
|
||||
/* dst_w or dst_h can be zero if unspecified */
|
||||
/* XXX: add scaling for printing */
|
||||
QECachedBitmap *cbmp_open(QEditScreen *s,
|
||||
QECachedBitmap *cbmp_open(QEditScreen *s,
|
||||
const char *url,
|
||||
int dst_w, int dst_h)
|
||||
{
|
||||
|
|
@ -288,8 +288,8 @@ int cbmp_get_size(QECachedBitmap *bitmap, int *w_ptr, int *h_ptr)
|
|||
{
|
||||
}
|
||||
|
||||
void cbmp_draw(QEditScreen *s, QECachedBitmap *bitmap,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
void cbmp_draw(QEditScreen *s, QECachedBitmap *bitmap,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
int offset_x, int offset_y, int flags)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
14
display.h
14
display.h
|
|
@ -113,7 +113,7 @@ struct QEDisplay {
|
|||
int x, int y, int w, int h, QEColor color);
|
||||
QEFont *(*dpy_open_font)(QEditScreen *s, int style, int size);
|
||||
void (*dpy_close_font)(QEditScreen *s, QEFont *font);
|
||||
void (*dpy_text_metrics)(QEditScreen *s, QEFont *font,
|
||||
void (*dpy_text_metrics)(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len);
|
||||
void (*dpy_draw_text)(QEditScreen *s, QEFont *font,
|
||||
|
|
@ -127,8 +127,8 @@ struct QEDisplay {
|
|||
/* bitmap support */
|
||||
int (*dpy_bmp_alloc)(QEditScreen *s, QEBitmap *b);
|
||||
void (*dpy_bmp_free)(QEditScreen *s, QEBitmap *b);
|
||||
void (*dpy_bmp_draw)(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
void (*dpy_bmp_draw)(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
int offset_x, int offset_y, int flags);
|
||||
void (*dpy_bmp_lock)(QEditScreen *s, QEBitmap *bitmap, QEPicture *pict,
|
||||
int x1, int y1, int w1, int h1);
|
||||
|
|
@ -160,7 +160,7 @@ static inline void draw_text(QEditScreen *s, QEFont *font,
|
|||
s->dpy.dpy_draw_text(s, font, x, y, str, len, color);
|
||||
}
|
||||
|
||||
static inline QEFont *open_font(QEditScreen *s,
|
||||
static inline QEFont *open_font(QEditScreen *s,
|
||||
int style, int size)
|
||||
{
|
||||
return s->dpy.dpy_open_font(s, style, size);
|
||||
|
|
@ -172,7 +172,7 @@ static inline void close_font(QEditScreen *s, QEFont *font)
|
|||
s->dpy.dpy_close_font(s, font);
|
||||
}
|
||||
|
||||
static inline void text_metrics(QEditScreen *s, QEFont *font,
|
||||
static inline void text_metrics(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len)
|
||||
{
|
||||
|
|
@ -223,8 +223,8 @@ void selection_request(QEditScreen *s);
|
|||
|
||||
QEBitmap *bmp_alloc(QEditScreen *s, int width, int height, int flags);
|
||||
void bmp_free(QEditScreen *s, QEBitmap **bp);
|
||||
void bmp_draw(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
void bmp_draw(QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
int offset_x, int offset_y, int flags);
|
||||
void bmp_lock(QEditScreen *s, QEBitmap *bitmap, QEPicture *pict,
|
||||
int x1, int y1, int w1, int h1);
|
||||
|
|
|
|||
30
fbfrender.c
30
fbfrender.c
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* fbfrender - FBF font cache and renderer
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -134,33 +134,33 @@ static GlyphCache *fbf_decode_glyph1(QEFont *font, int code)
|
|||
return NULL;
|
||||
|
||||
/* decompress a glyph if needed */
|
||||
if (fbf_decode_glyph(uf,
|
||||
if (fbf_decode_glyph(uf,
|
||||
&fbf_glyph_entry,
|
||||
glyph_index) < 0)
|
||||
return NULL;
|
||||
src_width = fbf_glyph_entry->w;
|
||||
src_height = fbf_glyph_entry->h;
|
||||
|
||||
|
||||
size = src_width * src_height;
|
||||
glyph_cache = add_cached_glyph(font, code, size);
|
||||
if (!glyph_cache)
|
||||
if (!glyph_cache)
|
||||
return NULL;
|
||||
/* convert to bitmap */
|
||||
{
|
||||
int x, y, bit, pitch;
|
||||
unsigned char *bitmap;
|
||||
|
||||
|
||||
bitmap = fbf_glyph_entry->bitmap;
|
||||
pitch = (src_width + 7) >> 3;
|
||||
for (y = 0; y < src_height; y++) {
|
||||
for (x = 0; x < src_width; x++) {
|
||||
bit = (bitmap[pitch * y + (x >> 3)] >>
|
||||
bit = (bitmap[pitch * y + (x >> 3)] >>
|
||||
(7 - (x & 7))) & 1;
|
||||
glyph_cache->data[src_width * y + x] = -bit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glyph_cache->w = src_width;
|
||||
glyph_cache->h = src_height;
|
||||
glyph_cache->x = fbf_glyph_entry->x;
|
||||
|
|
@ -170,7 +170,7 @@ static GlyphCache *fbf_decode_glyph1(QEFont *font, int code)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* main function : get one glyph. Return -1 if no glyph found, 0 if OK.
|
||||
*/
|
||||
GlyphCache *decode_cached_glyph(QEditScreen *s, QEFont *font, int code)
|
||||
|
|
@ -187,7 +187,7 @@ GlyphCache *decode_cached_glyph(QEditScreen *s, QEFont *font, int code)
|
|||
font->size);
|
||||
g = fbf_decode_glyph1(font1, code);
|
||||
release_font(s, font1);
|
||||
if (!g)
|
||||
if (!g)
|
||||
return NULL;
|
||||
/* indicates that it is a fallback glyph so that the
|
||||
correct font height can be computed */
|
||||
|
|
@ -199,7 +199,7 @@ GlyphCache *decode_cached_glyph(QEditScreen *s, QEFont *font, int code)
|
|||
return g;
|
||||
}
|
||||
|
||||
void fbf_text_metrics(QEditScreen *s, QEFont *font,
|
||||
void fbf_text_metrics(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len)
|
||||
{
|
||||
|
|
@ -217,9 +217,9 @@ void fbf_text_metrics(QEditScreen *s, QEFont *font,
|
|||
x += g->xincr;
|
||||
if (g->is_fallback) {
|
||||
/* if alternate font used, modify metrics */
|
||||
metrics->font_ascent = max(metrics->font_ascent,
|
||||
metrics->font_ascent = max(metrics->font_ascent,
|
||||
fallback_font->ascent);
|
||||
metrics->font_descent = max(metrics->font_descent,
|
||||
metrics->font_descent = max(metrics->font_descent,
|
||||
fallback_font->descent);
|
||||
}
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ QEFont *fbf_open_font(__unused__ QEditScreen *s, int style, int size)
|
|||
} else {
|
||||
/* convert to unifont family types */
|
||||
style = ((style & QE_FAMILY_MASK) >> QE_FAMILY_SHIFT) - 1;
|
||||
|
||||
|
||||
/* first match style */
|
||||
nb_fonts = 0;
|
||||
for (uf = first_font; uf != NULL; uf = uf->next_font) {
|
||||
|
|
@ -319,7 +319,7 @@ static int fbf_load_font_file(const char *filename)
|
|||
printf("loading %s\n", filename);
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (!f)
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
uf = qe_mallocz(UniFontData);
|
||||
|
|
@ -434,7 +434,7 @@ static int fbf_load_font_memory(const unsigned char *data,
|
|||
return -1;
|
||||
f->base = data;
|
||||
f->size = data_size;
|
||||
|
||||
|
||||
uf = qe_mallocz(UniFontData);
|
||||
if (!uf) {
|
||||
qe_free(&f);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* fbfrender - FBF font cache and renderer
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -38,7 +38,7 @@ typedef struct GlyphCache {
|
|||
unsigned char data[0];
|
||||
} GlyphCache;
|
||||
|
||||
void fbf_text_metrics(QEditScreen *s, QEFont *font,
|
||||
void fbf_text_metrics(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len);
|
||||
GlyphCache *decode_cached_glyph(QEditScreen *s, QEFont *font, int code);
|
||||
|
|
|
|||
|
|
@ -43,13 +43,11 @@ static int dump_font(const char *filename, const char *name)
|
|||
if (c == EOF)
|
||||
break;
|
||||
if ((j & 7) == 0)
|
||||
printf(" ");
|
||||
printf(" ");
|
||||
j++;
|
||||
printf("0x%02x,", c);
|
||||
printf(" 0x%02x,", c);
|
||||
if ((j & 7) == 0)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" ");
|
||||
}
|
||||
if ((j & 7) != 0)
|
||||
printf("\n");
|
||||
|
|
|
|||
26
hex.c
26
hex.c
|
|
@ -150,7 +150,7 @@ static int ascii_mode_init(EditState *s, ModeSavedData *saved_data)
|
|||
/* align on 16 byte boundary */
|
||||
s->disp_width &= ~15;
|
||||
if (s->disp_width < 16)
|
||||
s->disp_width = 16;
|
||||
s->disp_width = 16;
|
||||
//s->insert = 0;
|
||||
s->hex_mode = 0;
|
||||
s->wrap = WRAP_TRUNCATE;
|
||||
|
|
@ -180,7 +180,7 @@ static int detect_binary(const unsigned char *buf, int size)
|
|||
|
||||
for (i = 0; i < size; i++) {
|
||||
c = buf[i];
|
||||
if (c < 32 &&
|
||||
if (c < 32 &&
|
||||
(c != '\r' && c != '\n' && c != '\t' &&
|
||||
c != '\e' && c != '\b' && c != '\f'))
|
||||
return 1;
|
||||
|
|
@ -231,7 +231,7 @@ void hex_write_char(EditState *s, int key)
|
|||
unsigned int cur_ch, ch;
|
||||
int hsize, shift, cur_len, len, h;
|
||||
char buf[10];
|
||||
|
||||
|
||||
if (s->hex_mode) {
|
||||
if (s->unihex_mode)
|
||||
hsize = 4;
|
||||
|
|
@ -269,7 +269,7 @@ void hex_write_char(EditState *s, int key)
|
|||
buf[0] = ch;
|
||||
}
|
||||
#if 1
|
||||
eb_replace(s->b, s->offset, cur_len, buf, len);
|
||||
eb_replace(s->b, s->offset, cur_len, buf, len);
|
||||
#else
|
||||
if (cur_len == len) {
|
||||
eb_write(s->b, s->offset, buf, len);
|
||||
|
|
@ -294,7 +294,7 @@ static int hex_mode_line(EditState *s, char *buf, int buf_size)
|
|||
int percent, pos;
|
||||
|
||||
pos = basic_mode_line(s, buf, buf_size, '-');
|
||||
pos += snprintf(buf + pos, buf_size - pos, "0x%x--0x%x",
|
||||
pos += snprintf(buf + pos, buf_size - pos, "0x%x--0x%x",
|
||||
s->offset, s->b->total_size);
|
||||
percent = 0;
|
||||
if (s->b->total_size > 0)
|
||||
|
|
@ -303,13 +303,13 @@ static int hex_mode_line(EditState *s, char *buf, int buf_size)
|
|||
return pos;
|
||||
}
|
||||
|
||||
static ModeDef ascii_mode = {
|
||||
"ascii",
|
||||
static ModeDef ascii_mode = {
|
||||
"ascii",
|
||||
.instance_size = 0,
|
||||
.mode_probe = NULL,
|
||||
.mode_init = ascii_mode_init,
|
||||
.mode_init = ascii_mode_init,
|
||||
.mode_close = text_mode_close,
|
||||
.text_display = hex_display,
|
||||
.text_display = hex_display,
|
||||
.text_backward_offset = hex_backward_offset,
|
||||
|
||||
.move_up_down = hex_move_up_down,
|
||||
|
|
@ -323,12 +323,12 @@ static ModeDef ascii_mode = {
|
|||
};
|
||||
|
||||
static ModeDef hex_mode = {
|
||||
"hex",
|
||||
"hex",
|
||||
.instance_size = 0,
|
||||
.mode_probe = hex_mode_probe,
|
||||
.mode_init = hex_mode_init,
|
||||
.mode_init = hex_mode_init,
|
||||
.mode_close = text_mode_close,
|
||||
.text_display = hex_display,
|
||||
.text_display = hex_display,
|
||||
.text_backward_offset = hex_backward_offset,
|
||||
|
||||
.move_up_down = hex_move_up_down,
|
||||
|
|
@ -356,7 +356,7 @@ static int hex_init(void)
|
|||
qe_register_binding(KEY_CTRL_RIGHT, "increase-width", "ascii|hex");
|
||||
qe_register_binding(KEY_TAB, "toggle-hex", "hex");
|
||||
qe_register_binding(KEY_SHIFT_TAB, "toggle-hex", "hex");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
66
html.c
66
html.c
|
|
@ -99,7 +99,7 @@ static void recompute_offset(EditState *s)
|
|||
void css_error(const char *filename, int line_num, const char *msg)
|
||||
{
|
||||
EditBuffer *b;
|
||||
|
||||
|
||||
b = eb_find(HTML_ERROR_BUFFER);
|
||||
if (!b)
|
||||
b = eb_new(HTML_ERROR_BUFFER, BF_READONLY);
|
||||
|
|
@ -165,11 +165,11 @@ static void html_display(EditState *s)
|
|||
display_mode_line(s);
|
||||
dpy_flush(s->screen);
|
||||
}
|
||||
|
||||
|
||||
/* delete previous document */
|
||||
css_delete_box(hs->top_box);
|
||||
hs->top_box = NULL;
|
||||
|
||||
|
||||
if (hs->css_ctx) {
|
||||
css_delete_document(hs->css_ctx);
|
||||
hs->css_ctx = NULL;
|
||||
|
|
@ -195,8 +195,8 @@ static void html_display(EditState *s)
|
|||
hs->css_ctx->default_bgcolor = qe_styles[QE_STYLE_CSS_DEFAULT].bg_color;
|
||||
|
||||
timer_start();
|
||||
hs->top_box = xml_parse_buffer(s->b, 0, s->b->total_size,
|
||||
hs->css_ctx->style_sheet,
|
||||
hs->top_box = xml_parse_buffer(s->b, 0, s->b->total_size,
|
||||
hs->css_ctx->style_sheet,
|
||||
hs->parse_flags,
|
||||
html_test_abort, NULL);
|
||||
timer_stop("xml_parse_buffer");
|
||||
|
|
@ -214,11 +214,11 @@ static void html_display(EditState *s)
|
|||
if (ret) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* extract document size */
|
||||
hs->total_width = hs->top_box->bbox.x2;
|
||||
hs->total_height = hs->top_box->bbox.y2;
|
||||
|
||||
|
||||
/* set invalid rectangle to the whole window */
|
||||
css_set_rect(&hs->invalid_rect, s->xleft, s->ytop,
|
||||
s->xleft + s->width, s->ytop + s->height);
|
||||
|
|
@ -231,7 +231,7 @@ static void html_display(EditState *s)
|
|||
n = 0;
|
||||
redo:
|
||||
timer_start();
|
||||
cursor_found = css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
cursor_found = css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
NULL, NULL, NULL,
|
||||
&cursor_pos, &dirc, s->offset);
|
||||
timer_stop("css_get_cursor_pos");
|
||||
|
|
@ -243,7 +243,7 @@ static void html_display(EditState *s)
|
|||
goto redo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cursor_found) {
|
||||
/* if cursor not visible, adjust offsets */
|
||||
d = cursor_pos.y1 + s->y_disp;
|
||||
|
|
@ -261,7 +261,7 @@ static void html_display(EditState *s)
|
|||
s->x_disp[0] -= d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* selection handling */
|
||||
if (s->show_selection) {
|
||||
sel_start = s->b->mark;
|
||||
|
|
@ -311,12 +311,12 @@ static void html_display(EditState *s)
|
|||
|
||||
timer_start();
|
||||
|
||||
css_display(hs->css_ctx, hs->top_box,
|
||||
css_display(hs->css_ctx, hs->top_box,
|
||||
&rect, s->xleft + s->x_disp[0], s->ytop + s->y_disp);
|
||||
timer_stop("css_display");
|
||||
|
||||
set_clip_rectangle(s->screen, &old_clip);
|
||||
|
||||
|
||||
/* no longer invalid, so set invalid_rect to null */
|
||||
css_set_rect(&hs->invalid_rect, 0, 0, 0, 0);
|
||||
}
|
||||
|
|
@ -375,7 +375,7 @@ static int scroll_func(void *opaque, CSSBox *box, __unused__ int x, int y)
|
|||
m->offset_found = box->u.buffer.start;
|
||||
}
|
||||
}
|
||||
if ((unsigned long)m->offsetc >= box->u.buffer.start &&
|
||||
if ((unsigned long)m->offsetc >= box->u.buffer.start &&
|
||||
(unsigned long)m->offsetc <= box->u.buffer.end &&
|
||||
y >= 0 && y1 <= m->height) {
|
||||
m->offset_found = m->offsetc;
|
||||
|
|
@ -410,7 +410,7 @@ static void html_scroll_up_down(EditState *s, int dir)
|
|||
}
|
||||
|
||||
/* XXX: max height ? */
|
||||
|
||||
|
||||
/* now update cursor position so that it is on screen */
|
||||
m->offsetc = s->offset;
|
||||
m->dir = -dir;
|
||||
|
|
@ -458,7 +458,7 @@ static int up_down_func(void *opaque, CSSBox *box, int x, int y)
|
|||
|
||||
if (m->dir < 0) {
|
||||
y1 = y + box->height;
|
||||
if (y1 <= m->yd)
|
||||
if (y1 <= m->yd)
|
||||
goto ytest;
|
||||
} else {
|
||||
y1 = y;
|
||||
|
|
@ -531,9 +531,9 @@ static void html_move_up_down1(EditState *s, int dir, int xtarget)
|
|||
m->ydmin = INT_MAX;
|
||||
m->box = NULL;
|
||||
m->xdbase = 0;
|
||||
|
||||
|
||||
css_box_iterate(hs->css_ctx, hs->top_box, m, up_down_func);
|
||||
|
||||
|
||||
/* if no box found, then compose the next text chunk */
|
||||
if (m->box) {
|
||||
/* the box was found : find exact cursor offset */
|
||||
|
|
@ -577,7 +577,7 @@ static int left_right_func(void *opaque, CSSBox *box, int x, int y)
|
|||
/* only examine boxes which intersect the current one on y axis */
|
||||
if (!(y + box->height <= m->y1 ||
|
||||
y >= m->y2)) {
|
||||
if ((m->dir < 0 && (x1 = x + box->width) <= m->xd) ||
|
||||
if ((m->dir < 0 && (x1 = x + box->width) <= m->xd) ||
|
||||
(m->dir > 0 && (x1 = x) >= m->xd)) {
|
||||
/* find the closest box in the correct direction */
|
||||
d = abs(x1 - m->xd);
|
||||
|
|
@ -604,12 +604,12 @@ static void html_move_left_right_visual(EditState *s, int dir)
|
|||
return;
|
||||
|
||||
/* get the cursor position. If not found, do nothing */
|
||||
if (!css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
&box, &x0, NULL,
|
||||
if (!css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
&box, &x0, NULL,
|
||||
&cursor_pos, &dirc, s->offset))
|
||||
return;
|
||||
|
||||
offset = css_get_offset_pos(hs->css_ctx,
|
||||
offset = css_get_offset_pos(hs->css_ctx,
|
||||
box, cursor_pos.x1 - x0, dir);
|
||||
if (offset >= 0) {
|
||||
/* match found : finished ! */
|
||||
|
|
@ -622,11 +622,11 @@ static void html_move_left_right_visual(EditState *s, int dir)
|
|||
m->xd = cursor_pos.x1;
|
||||
m->y1 = cursor_pos.y1;
|
||||
m->y2 = cursor_pos.y2;
|
||||
|
||||
|
||||
m->dir = dir;
|
||||
m->xdmin = INT_MAX;
|
||||
m->box = NULL;
|
||||
|
||||
|
||||
css_box_iterate(hs->css_ctx, hs->top_box, m, left_right_func);
|
||||
if (!m->box) {
|
||||
/* no box found : go up or down */
|
||||
|
|
@ -653,8 +653,8 @@ static void html_move_bol_eol(EditState *s, int dir)
|
|||
return;
|
||||
|
||||
/* get the cursor position. If not found, do nothing */
|
||||
if (!css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
&box, &x0, NULL,
|
||||
if (!css_get_cursor_pos(hs->css_ctx, hs->top_box,
|
||||
&box, &x0, NULL,
|
||||
&cursor_pos, &dirc, s->offset))
|
||||
return;
|
||||
|
||||
|
|
@ -663,13 +663,13 @@ static void html_move_bol_eol(EditState *s, int dir)
|
|||
m->xd = xtarget;
|
||||
m->y1 = cursor_pos.y1;
|
||||
m->y2 = cursor_pos.y2;
|
||||
|
||||
|
||||
m->dir = dir;
|
||||
m->xdmin = INT_MAX;
|
||||
m->box = NULL;
|
||||
css_box_iterate(hs->css_ctx, hs->top_box, m, left_right_func);
|
||||
if (m->box) {
|
||||
|
||||
|
||||
offset = css_get_offset_pos(hs->css_ctx, m->box, xtarget, dir);
|
||||
if (offset >= 0) {
|
||||
s->offset = offset;
|
||||
|
|
@ -768,8 +768,8 @@ static void html_callback(__unused__ EditBuffer *b,
|
|||
HTMLState *hs = s->mode_data;
|
||||
hs->up_to_date = 0;
|
||||
}
|
||||
|
||||
static void load_default_style_sheet(HTMLState *hs, const char *stylesheet_str,
|
||||
|
||||
static void load_default_style_sheet(HTMLState *hs, const char *stylesheet_str,
|
||||
int flags)
|
||||
{
|
||||
CSSStyleSheet *style_sheet;
|
||||
|
|
@ -783,7 +783,7 @@ static void load_default_style_sheet(HTMLState *hs, const char *stylesheet_str,
|
|||
|
||||
/* graphical XML/CSS mode init. is_html is TRUE to tell that specific HTML
|
||||
quirks are needed in the parser. */
|
||||
int gxml_mode_init(EditState *s,
|
||||
int gxml_mode_init(EditState *s,
|
||||
ModeSavedData *saved_data,
|
||||
int flags, const char *default_stylesheet)
|
||||
{
|
||||
|
|
@ -811,8 +811,8 @@ int gxml_mode_init(EditState *s,
|
|||
|
||||
static int html_mode_init(EditState *s, ModeSavedData *saved_data)
|
||||
{
|
||||
return gxml_mode_init(s, saved_data,
|
||||
XML_HTML | XML_HTML_SYNTAX | XML_IGNORE_CASE,
|
||||
return gxml_mode_init(s, saved_data,
|
||||
XML_HTML | XML_HTML_SYNTAX | XML_IGNORE_CASE,
|
||||
html_style);
|
||||
}
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ static CmdDef html_commands[] = {
|
|||
};
|
||||
|
||||
ModeDef html_mode = {
|
||||
"html",
|
||||
"html",
|
||||
.instance_size = sizeof(HTMLState),
|
||||
.mode_probe = html_mode_probe,
|
||||
.mode_init = html_mode_init,
|
||||
|
|
|
|||
42
html2png.c
42
html2png.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* HTML to PPM converter using the qHTML library
|
||||
/*
|
||||
* HTML to PPM converter using the qHTML library
|
||||
*
|
||||
* Copyright (c) 2002 Fabrice Bellard.
|
||||
*
|
||||
|
|
@ -69,7 +69,7 @@ void css_close(CSSFile *f1)
|
|||
|
||||
/* error display */
|
||||
|
||||
void css_error(const char *filename, int line_num,
|
||||
void css_error(const char *filename, int line_num,
|
||||
const char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: %s\n", filename, line_num, msg);
|
||||
|
|
@ -136,7 +136,7 @@ static QEDisplay ppm_dpy = {
|
|||
static int ppm_resize(QEditScreen *s, int w, int h)
|
||||
{
|
||||
CFBContext *cfb = s->private;
|
||||
|
||||
|
||||
/* alloc bitmap */
|
||||
if (!qe_realloc(&cfb->base, w * h * sizeof(int))) {
|
||||
return -1;
|
||||
|
|
@ -180,7 +180,7 @@ static int ppm_init(QEditScreen *s, int w, int h)
|
|||
static void ppm_close(QEditScreen *s)
|
||||
{
|
||||
CFBContext *cfb = s->private;
|
||||
|
||||
|
||||
qe_free(&cfb->base);
|
||||
qe_free(&s->private);
|
||||
}
|
||||
|
|
@ -310,14 +310,14 @@ void test_display(QEditScreen *screen)
|
|||
QEFont *font;
|
||||
unsigned int buf[256];
|
||||
int len;
|
||||
|
||||
fill_rectangle(screen, 0, 0, screen->width, screen->height,
|
||||
|
||||
fill_rectangle(screen, 0, 0, screen->width, screen->height,
|
||||
QERGB(0xff, 0x00, 0x00));
|
||||
len = utf8_to_unicode(buf, sizeof(buf), "Hello World !");
|
||||
|
||||
|
||||
font = select_font(screen, QE_FAMILY_FIXED | QE_STYLE_NORM, 12);
|
||||
|
||||
draw_text(screen, font, screen->width / 2, screen->height / 2,
|
||||
|
||||
draw_text(screen, font, screen->width / 2, screen->height / 2,
|
||||
buf, len, QERGB(0x00, 0x00, 0x00));
|
||||
|
||||
release_font(screen, font);
|
||||
|
|
@ -331,7 +331,7 @@ static int html_test_abort(__unused__ void *opaque)
|
|||
|
||||
#define IO_BUF_SIZE 4096
|
||||
|
||||
static int draw_html(QEditScreen *scr,
|
||||
static int draw_html(QEditScreen *scr,
|
||||
const char *filename, QECharset *charset, int flags)
|
||||
{
|
||||
CSSContext *s = NULL;
|
||||
|
|
@ -364,27 +364,27 @@ static int draw_html(QEditScreen *scr,
|
|||
goto fail;
|
||||
|
||||
xml = xml_begin(s->style_sheet, flags, html_test_abort, NULL, filename, charset);
|
||||
|
||||
|
||||
for (;;) {
|
||||
len = css_read(f, buf, IO_BUF_SIZE);
|
||||
if (len <= 0)
|
||||
break;
|
||||
xml_parse(xml, buf, len);
|
||||
}
|
||||
|
||||
|
||||
css_close(f);
|
||||
|
||||
top_box = xml_end(xml);
|
||||
|
||||
|
||||
/* CSS computation */
|
||||
css_compute(s, top_box);
|
||||
|
||||
/* CSS layout */
|
||||
css_layout(s, top_box, scr->width, html_test_abort, NULL);
|
||||
|
||||
|
||||
/* now we know the total size, so we allocate the ppm */
|
||||
page_height = top_box->bbox.y2;
|
||||
|
||||
|
||||
if (ppm_resize(scr, scr->width, page_height) < 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ static int draw_html(QEditScreen *scr,
|
|||
rect.y2 = scr->height;
|
||||
|
||||
css_display(s, top_box, &rect, 0, 0);
|
||||
|
||||
|
||||
css_delete_box(top_box);
|
||||
css_delete_document(s);
|
||||
return 0;
|
||||
|
|
@ -422,7 +422,7 @@ static void help(void)
|
|||
"-f charset : set the default charset (default='%s')\n"
|
||||
" use -f ? to list supported charsets\n"
|
||||
"-o outfile : set the output filename (default='%s')\n",
|
||||
QE_VERSION,
|
||||
QE_VERSION,
|
||||
DEFAULT_WIDTH,
|
||||
"8859-1",
|
||||
DEFAULT_OUTFILENAME);
|
||||
|
|
@ -441,11 +441,11 @@ int main(int argc, char **argv)
|
|||
charset_jis_init();
|
||||
css_init();
|
||||
|
||||
page_width = DEFAULT_WIDTH;
|
||||
page_width = DEFAULT_WIDTH;
|
||||
outfilename = DEFAULT_OUTFILENAME;
|
||||
charset = &charset_8859_1;
|
||||
strict_xml = 0;
|
||||
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv, "h?w:o:f:x");
|
||||
if (c == -1)
|
||||
|
|
@ -503,7 +503,7 @@ int main(int argc, char **argv)
|
|||
ppm_save(screen, outfilename);
|
||||
else
|
||||
png_save(screen, outfilename);
|
||||
#else
|
||||
#else
|
||||
ppm_save(screen, outfilename);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ enum {
|
|||
};
|
||||
|
||||
/* CG: Should rely on len instead of '\n' */
|
||||
static void htmlsrc_colorize_line(unsigned int *buf, int len,
|
||||
static void htmlsrc_colorize_line(unsigned int *buf, int len,
|
||||
int *colorize_state_ptr, int state_only)
|
||||
{
|
||||
int c, state, js_state, l;
|
||||
|
|
@ -258,7 +258,7 @@ static int htmlsrc_mode_probe(ModeProbeData *p)
|
|||
/* first check file extension */
|
||||
if (match_extension(p->filename, html_mode_extensions))
|
||||
return 80;
|
||||
|
||||
|
||||
/* then try buffer contents */
|
||||
if (p->buf_size >= 5 &&
|
||||
(!html_tagcmp(buf, "<HTML") ||
|
||||
|
|
@ -274,7 +274,7 @@ static int htmlsrc_mode_probe(ModeProbeData *p)
|
|||
static int htmlsrc_mode_init(EditState *s, ModeSavedData *saved_data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = text_mode_init(s, saved_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
|||
86
image.c
86
image.c
|
|
@ -92,19 +92,19 @@ void fill_border(EditState *s, int x, int y, int w, int h, int color)
|
|||
h2 = s->height - (y + h);
|
||||
if (h2 < 0)
|
||||
h2 = 0;
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop,
|
||||
w1, s->height,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop,
|
||||
w1, s->height,
|
||||
color);
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + s->width - w2, s->ytop,
|
||||
w2, s->height,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + s->width - w2, s->ytop,
|
||||
w2, s->height,
|
||||
color);
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + w1, s->ytop,
|
||||
s->width - w1 - w2, h1,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + w1, s->ytop,
|
||||
s->width - w1 - w2, h1,
|
||||
color);
|
||||
fill_rectangle(s->screen,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + w1, s->ytop + s->height - h2,
|
||||
s->width - w1 - w2, h2,
|
||||
color);
|
||||
|
|
@ -114,7 +114,7 @@ void draw_alpha_grid(EditState *s, int x1, int y1, int w, int h)
|
|||
{
|
||||
int state, x, y;
|
||||
unsigned int color;
|
||||
|
||||
|
||||
for (y = 0; y < h; y += 16) {
|
||||
for (x = 0; x < w; x += 16) {
|
||||
state = (x ^ y) & 16;
|
||||
|
|
@ -122,7 +122,7 @@ void draw_alpha_grid(EditState *s, int x1, int y1, int w, int h)
|
|||
color = QERGB(0x94, 0x94, 0x94);
|
||||
else
|
||||
color = QERGB(0x64, 0x64, 0x64);
|
||||
fill_rectangle(s->screen,
|
||||
fill_rectangle(s->screen,
|
||||
x1 + x, y1 + y, 16, 16, color);
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ static void image_display(EditState *s)
|
|||
{
|
||||
ImageState *is = s->mode_data;
|
||||
int x, y;
|
||||
|
||||
|
||||
if (s->display_invalid) {
|
||||
if (is->disp_bmp) {
|
||||
x = is->x + (s->width - is->w) / 2;
|
||||
|
|
@ -142,7 +142,7 @@ static void image_display(EditState *s)
|
|||
|
||||
fill_border(s, x, y, is->w, is->h, QERGB(0x00, 0x00, 0x00));
|
||||
|
||||
bmp_draw(s->screen, is->disp_bmp,
|
||||
bmp_draw(s->screen, is->disp_bmp,
|
||||
s->xleft + x, s->ytop + y,
|
||||
is->w, is->h, 0, 0, 0);
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ static void image_resize(EditState *s)
|
|||
ImageState *is = s->mode_data;
|
||||
ImageBuffer *ib = s->b->data;
|
||||
int d, w, h;
|
||||
|
||||
|
||||
/* simplify factors */
|
||||
d = gcd(is->xfactor_num, is->xfactor_den);
|
||||
is->xfactor_num /= d;
|
||||
|
|
@ -182,9 +182,9 @@ static void image_resize(EditState *s)
|
|||
is->yfactor_num /= d;
|
||||
is->yfactor_den /= d;
|
||||
|
||||
w = ((long long)ib->width * (long long)is->xfactor_num) /
|
||||
w = ((long long)ib->width * (long long)is->xfactor_num) /
|
||||
is->xfactor_den;
|
||||
h = ((long long)ib->height * (long long)is->yfactor_num) /
|
||||
h = ((long long)ib->height * (long long)is->yfactor_num) /
|
||||
is->yfactor_den;
|
||||
|
||||
if (w < 1)
|
||||
|
|
@ -236,12 +236,12 @@ static void image_set_size(EditState *s, int w, int h)
|
|||
put_status(s, "Invalid image size");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
is->xfactor_num = w;
|
||||
is->xfactor_den = ib->width;
|
||||
is->yfactor_num = h;
|
||||
is->yfactor_den = ib->height;
|
||||
|
||||
|
||||
image_resize(s);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -250,7 +250,7 @@ static int image_mode_probe(ModeProbeData *pd)
|
|||
{
|
||||
AVProbeData avpd;
|
||||
AVImageFormat *fmt;
|
||||
|
||||
|
||||
avpd.filename = pd->filename;
|
||||
avpd.buf = pd->buf;
|
||||
avpd.buf_size = pd->buf_size;
|
||||
|
|
@ -323,14 +323,14 @@ static int image_buffer_load(EditBuffer *b, FILE *f)
|
|||
ret = url_fopen(pb, b->filename, URL_RDONLY);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
ret = av_read_image(pb, b->filename, NULL, read_image_cb, b);
|
||||
url_fclose(pb);
|
||||
if (ret) {
|
||||
return -1;
|
||||
} else {
|
||||
ImageBuffer *ib = b->data;
|
||||
ib->alpha_info = img_get_alpha_info(&ib->pict, ib->pix_fmt,
|
||||
ib->alpha_info = img_get_alpha_info(&ib->pict, ib->pix_fmt,
|
||||
ib->width, ib->height);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -351,14 +351,14 @@ static int image_buffer_save(EditBuffer *b, const char *filename)
|
|||
int ret, dst_pix_fmt, loss;
|
||||
AVImageFormat *fmt;
|
||||
AVImageInfo info;
|
||||
|
||||
|
||||
/* find image format */
|
||||
fmt = guess_image_format(filename);
|
||||
if (!fmt)
|
||||
return -1;
|
||||
|
||||
/* find the best image format */
|
||||
dst_pix_fmt = avcodec_find_best_pix_fmt(fmt->supported_pixel_formats,
|
||||
dst_pix_fmt = avcodec_find_best_pix_fmt(fmt->supported_pixel_formats,
|
||||
ib->pix_fmt, ib->alpha_info, &loss);
|
||||
if (dst_pix_fmt < 0)
|
||||
return -1;
|
||||
|
|
@ -385,10 +385,10 @@ static int image_buffer_save(EditBuffer *b, const char *filename)
|
|||
info.width = ib->width;
|
||||
info.height = ib->height;
|
||||
info.pict = ib->pict;
|
||||
|
||||
|
||||
av_write_image(pb, fmt, &info);
|
||||
url_fclose(pb);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -461,16 +461,16 @@ static void update_bmp(EditState *s)
|
|||
/* create the displayed bitmap and put the image in it */
|
||||
is->disp_bmp = bmp_alloc(s->screen, is->w, is->h, 0);
|
||||
|
||||
bmp_lock(s->screen, is->disp_bmp, &pict,
|
||||
bmp_lock(s->screen, is->disp_bmp, &pict,
|
||||
0, 0, is->w, is->h);
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
avpict.data[i] = pict.data[i];
|
||||
avpict.linesize[i] = pict.linesize[i];
|
||||
}
|
||||
dst_pix_fmt = qe_bitmap_format_to_pix_fmt(is->disp_bmp->format);
|
||||
#if 0
|
||||
printf("dst=%s src=%s\n",
|
||||
printf("dst=%s src=%s\n",
|
||||
avcodec_get_pix_fmt_name(dst_pix_fmt),
|
||||
avcodec_get_pix_fmt_name(ib->pix_fmt));
|
||||
#endif
|
||||
|
|
@ -587,12 +587,12 @@ static void image_callback(EditBuffer *b,
|
|||
int size)
|
||||
{
|
||||
// EditState *s = opaque;
|
||||
|
||||
|
||||
// update_bmp(s);
|
||||
}
|
||||
|
||||
static int img_rotate(AVPicture *dst,
|
||||
AVPicture *src, int pix_fmt,
|
||||
AVPicture *src, int pix_fmt,
|
||||
int w, int h)
|
||||
{
|
||||
int x, y, dlinesize, bpp;
|
||||
|
|
@ -618,11 +618,11 @@ static int img_rotate(AVPicture *dst,
|
|||
s1 = src->data[0];
|
||||
dlinesize = dst->linesize[0];
|
||||
d1 = dst->data[0] + (h - 1) * bpp;
|
||||
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
s = s1;
|
||||
d = d1;
|
||||
|
||||
|
||||
switch (pix_fmt) {
|
||||
case PIX_FMT_PAL8:
|
||||
case PIX_FMT_GRAY8:
|
||||
|
|
@ -684,7 +684,7 @@ static void image_rotate(EditState *e)
|
|||
if (ret < 0) {
|
||||
/* remove temporary image */
|
||||
image_free(ib1);
|
||||
put_status(e, "Format '%s' not supported yet in rotate",
|
||||
put_status(e, "Format '%s' not supported yet in rotate",
|
||||
avcodec_get_pix_fmt_name(pix_fmt));
|
||||
return;
|
||||
}
|
||||
|
|
@ -713,7 +713,7 @@ static void image_convert(EditState *e, const char *pix_fmt_str)
|
|||
int ret, new_pix_fmt, i, loss;
|
||||
ImageBuffer *ib1;
|
||||
const char *name;
|
||||
|
||||
|
||||
for (i = 0; i < PIX_FMT_NB; i++) {
|
||||
name = avcodec_get_pix_fmt_name(i);
|
||||
if (!strcmp(name, pix_fmt_str))
|
||||
|
|
@ -726,12 +726,12 @@ static void image_convert(EditState *e, const char *pix_fmt_str)
|
|||
ib1 = image_allocate(new_pix_fmt, ib->width, ib->height);
|
||||
if (!ib1)
|
||||
return;
|
||||
ret = img_convert(&ib1->pict, ib1->pix_fmt,
|
||||
ret = img_convert(&ib1->pict, ib1->pix_fmt,
|
||||
&ib->pict, ib->pix_fmt, ib->width, ib->height);
|
||||
if (ret < 0) {
|
||||
/* remove temporary image */
|
||||
image_free(ib1);
|
||||
put_status(e, "Convertion from '%s' to '%s' not supported yet",
|
||||
put_status(e, "Convertion from '%s' to '%s' not supported yet",
|
||||
avcodec_get_pix_fmt_name(ib->pix_fmt),
|
||||
avcodec_get_pix_fmt_name(new_pix_fmt));
|
||||
return;
|
||||
|
|
@ -755,7 +755,7 @@ static void image_convert(EditState *e, const char *pix_fmt_str)
|
|||
put_status(e, "Warning: data loss:%s", buf);
|
||||
}
|
||||
}
|
||||
ib1->alpha_info = img_get_alpha_info(&ib1->pict, ib1->pix_fmt,
|
||||
ib1->alpha_info = img_get_alpha_info(&ib1->pict, ib1->pix_fmt,
|
||||
ib1->width, ib1->height);
|
||||
set_new_image(b, ib1);
|
||||
image_free(ib);
|
||||
|
|
@ -769,7 +769,7 @@ int image_mode_line(EditState *s, char *buf, int buf_size)
|
|||
EditBuffer *b = s->b;
|
||||
ImageBuffer *ib = b->data;
|
||||
char alpha_mode;
|
||||
|
||||
|
||||
pos = basic_mode_line(s, buf, buf_size, '-');
|
||||
if (ib->alpha_info & FF_ALPHA_SEMI_TRANSP)
|
||||
alpha_mode = 'A';
|
||||
|
|
@ -778,8 +778,8 @@ int image_mode_line(EditState *s, char *buf, int buf_size)
|
|||
else
|
||||
alpha_mode = ' ';
|
||||
|
||||
pos += snprintf(buf + pos, buf_size - pos, "%dx%d %s %c%c",
|
||||
ib->width, ib->height,
|
||||
pos += snprintf(buf + pos, buf_size - pos, "%dx%d %s %c%c",
|
||||
ib->width, ib->height,
|
||||
avcodec_get_pix_fmt_name(ib->pix_fmt),
|
||||
alpha_mode,
|
||||
ib->interleaved ? 'I' : ' ');
|
||||
|
|
@ -790,7 +790,7 @@ static void pixel_format_completion(StringArray *cs, const char *input)
|
|||
{
|
||||
int i;
|
||||
const char *name;
|
||||
|
||||
|
||||
for (i = 0; i < PIX_FMT_NB; i++) {
|
||||
name = avcodec_get_pix_fmt_name(i);
|
||||
if (strstart(name, input, NULL))
|
||||
|
|
@ -819,7 +819,7 @@ static CmdDef image_commands[] = {
|
|||
};
|
||||
|
||||
ModeDef image_mode = {
|
||||
"image",
|
||||
"image",
|
||||
instance_size: sizeof(ImageState),
|
||||
mode_probe: image_mode_probe,
|
||||
mode_init: image_mode_init,
|
||||
|
|
|
|||
18
indic.c
18
indic.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Indic algorithms for QEmacs.
|
||||
* Indic algorithms for QEmacs.
|
||||
*
|
||||
* Copyright (c) 2000 Fabrice Bellard.
|
||||
*
|
||||
|
|
@ -62,7 +62,7 @@ int devanagari_log2vis(unsigned int *str, unsigned int *ctog, int len)
|
|||
{
|
||||
int i, len1, cc, j, k, c;
|
||||
unsigned int *q, buf[len];
|
||||
|
||||
|
||||
/* Rule 1 : dead consonant rule */
|
||||
q = buf;
|
||||
len1 = len - 1;
|
||||
|
|
@ -80,19 +80,19 @@ int devanagari_log2vis(unsigned int *str, unsigned int *ctog, int len)
|
|||
/* XXX: rule 3, 4, 7 should be handled as ligatures */
|
||||
for (i = 0; i < len1; i++) {
|
||||
/* Rule 2 */
|
||||
if (buf[i] == RA_DEAD &&
|
||||
if (buf[i] == RA_DEAD &&
|
||||
(is_ind_vowel(buf[i+1]) || is_consonant(buf[i+1]))) {
|
||||
buf[i] = buf[i+1];
|
||||
buf[i+1] = RA_SUP;
|
||||
} else
|
||||
} else
|
||||
/* Rule 5 */
|
||||
if (buf[i] == RRA &&
|
||||
if (buf[i] == RRA &&
|
||||
buf[i+1] == VIRAMA) {
|
||||
buf[i] = RRA_HALF;
|
||||
buf[i+1] = 0;
|
||||
} else
|
||||
/* Rule 5a */
|
||||
if (buf[i] == RA_DEAD &&
|
||||
if (buf[i] == RA_DEAD &&
|
||||
buf[i+1] == ZERO_WIDTH_JOINER) {
|
||||
buf[i] = RRA_HALF;
|
||||
buf[i+1] = 0;
|
||||
|
|
@ -103,7 +103,7 @@ int devanagari_log2vis(unsigned int *str, unsigned int *ctog, int len)
|
|||
buf[i+1] = RA_SUB;
|
||||
} else
|
||||
/* Rule 8 */
|
||||
if (is_dead_consonant(buf[i]) &&
|
||||
if (is_dead_consonant(buf[i]) &&
|
||||
buf[i+1] == RA_DEAD) {
|
||||
buf[i] -= DEAD_CONSONANT_OFFSET;
|
||||
buf[i+1] = RA_SUB;
|
||||
|
|
@ -113,9 +113,9 @@ int devanagari_log2vis(unsigned int *str, unsigned int *ctog, int len)
|
|||
|
||||
/* convert dead consonant to half consonants */
|
||||
for (i = 0; i < len1; i++) {
|
||||
if (is_dead_consonant(buf[i]) &&
|
||||
if (is_dead_consonant(buf[i]) &&
|
||||
(i == (len1 - 1) ||
|
||||
buf[i+1] == ZERO_WIDTH_JOINER ||
|
||||
buf[i+1] == ZERO_WIDTH_JOINER ||
|
||||
is_consonant(buf[i+1]) ||
|
||||
is_dead_consonant(buf[i+1]))) {
|
||||
buf[i] -= DEAD_CONSONANT_OFFSET + HALF_OFFSET;
|
||||
|
|
|
|||
18
input.c
18
input.c
|
|
@ -27,7 +27,7 @@ InputMethod *input_methods;
|
|||
|
||||
static int default_input(__unused__ int *match_buf,
|
||||
__unused__ int match_buf_size,
|
||||
__unused__ int *match_len_ptr,
|
||||
__unused__ int *match_len_ptr,
|
||||
__unused__ const u8 *data,
|
||||
__unused__ const unsigned int *buf,
|
||||
__unused__ int len)
|
||||
|
|
@ -37,7 +37,7 @@ static int default_input(__unused__ int *match_buf,
|
|||
|
||||
static int unicode_input(int *match_buf,
|
||||
int match_buf_size,
|
||||
int *match_len_ptr,
|
||||
int *match_len_ptr,
|
||||
__unused__ const u8 *data,
|
||||
const unsigned int *buf, int len)
|
||||
{
|
||||
|
|
@ -63,11 +63,11 @@ static int unicode_input(int *match_buf,
|
|||
}
|
||||
}
|
||||
|
||||
static InputMethod default_input_method = {
|
||||
static InputMethod default_input_method = {
|
||||
"default", default_input, NULL, NULL,
|
||||
};
|
||||
|
||||
static InputMethod unicode_input_method = {
|
||||
static InputMethod unicode_input_method = {
|
||||
"unicode", unicode_input, NULL, NULL,
|
||||
};
|
||||
|
||||
|
|
@ -127,9 +127,9 @@ static int kmap_input(int *match_buf, int match_buf_size,
|
|||
olen = 1;
|
||||
l1 = prefix_len; /* length of input pattern */
|
||||
for (;;) {
|
||||
/* c = 0x00 end of table
|
||||
/* c = 0x00 end of table
|
||||
* c = 0x01..0x1d delta unicode
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1f unicode input char follows.
|
||||
* c = 0x20..0x7f input character
|
||||
* c = 0x80 unused
|
||||
|
|
@ -235,7 +235,7 @@ static void load_input_methods(void)
|
|||
InputMethod *m;
|
||||
|
||||
input_method_fd = -1;
|
||||
|
||||
|
||||
if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)
|
||||
return;
|
||||
|
||||
|
|
@ -251,12 +251,12 @@ static void load_input_methods(void)
|
|||
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];
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static void handle_jis(FILE **fp, const char *name, const char *filename)
|
|||
|
||||
b1 = (c1 >> 8) & 0xff;
|
||||
b2 = (c1) & 0xff;
|
||||
|
||||
|
||||
/* compress the code */
|
||||
b1 = b1 - 0x21;
|
||||
b2 = b2 - 0x21;
|
||||
|
|
@ -142,8 +142,8 @@ static void handle_jis(FILE **fp, const char *name, const char *filename)
|
|||
if (table_b2_max[i] != 0) {
|
||||
for (j = 0; j <= b2_max; j++) {
|
||||
if ((n & 7) == 0)
|
||||
printf(" ");
|
||||
printf("0x%04x, ", table[i * 94 + j]);
|
||||
printf(" ");
|
||||
printf(" 0x%04x,", table[i * 94 + j]);
|
||||
if ((n++ & 7) == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ int main(int argc, char **argv)
|
|||
|
||||
strcpy(name, get_basename(filename));
|
||||
*get_extension(name) = '\0';
|
||||
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
perror(filename);
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ About .kmap files
|
|||
Mind Tuning: The Unicode theory and Unicode-savvy text editors make
|
||||
a clear (and useful) distinction among
|
||||
|
||||
1. the keyboard key(s) typed
|
||||
2. the Unicode character(s) entered and stored in a file or
|
||||
buffer, and
|
||||
3. the glyph(s) (i.e. the graphic shapes) that are displayed.
|
||||
1. the keyboard key(s) typed
|
||||
2. the Unicode character(s) entered and stored in a file or
|
||||
buffer, and
|
||||
3. the glyph(s) (i.e. the graphic shapes) that are displayed.
|
||||
|
||||
Rendering: The mapping between the Unicode characters stored in a
|
||||
file or buffer and the display of glyphs is handled by a Rendering
|
||||
|
|
@ -37,9 +37,9 @@ About .kmap files
|
|||
example, Yudit comes supplied with three different .kmap files for
|
||||
Arabic input:
|
||||
|
||||
Arabic.kmap
|
||||
ArabicTranslit.kmap
|
||||
ArabicKeyboard.kmap
|
||||
Arabic.kmap
|
||||
ArabicTranslit.kmap
|
||||
ArabicKeyboard.kmap
|
||||
|
||||
and you might not like any of them. That's OK, because it is
|
||||
fairly simple to write your own .kmap file.
|
||||
|
|
@ -110,13 +110,13 @@ Writing a New .kmap File
|
|||
Input keystroke sequences should be chosen with care to avoid
|
||||
ambiguity and clashes; for human convenience, the input sequences
|
||||
should also be maximally mnemonic.
|
||||
|
||||
|
||||
The choice of "cx" is a very suitable sequence for Esperanto entry
|
||||
of c-with-circumflex because
|
||||
|
||||
1. The letter x is not normally used in Esperanto orthography, and
|
||||
2. There is already a well-known convention for typing Esperanto
|
||||
that uses "cx" for c-with-circumflex when the real letter is
|
||||
2. There is already a well-known convention for typing Esperanto
|
||||
that uses "cx" for c-with-circumflex when the real letter is
|
||||
not available.
|
||||
|
||||
However, there are other conventions for typing Esperanto, and some
|
||||
|
|
@ -268,7 +268,7 @@ More Detail on the Syntax of .kmap Files:
|
|||
literal equal sign. The literal backslash itself is notated \\.
|
||||
|
||||
Examples:
|
||||
" s = 0x0633 " , // one to one
|
||||
" s = 0x0633 " , // one to one
|
||||
" cx = 0x0109 " , // many to one
|
||||
" \= = 0x0109 " , // type a literal equal sign to input 0x0109
|
||||
" \\ ~ n = 0x00f1 " , // allow LaTeX-like input of n-with-tilde;
|
||||
|
|
@ -277,9 +277,9 @@ More Detail on the Syntax of .kmap Files:
|
|||
// the user types literal \ then literal "
|
||||
// then a to input Unicode a-with-dieresis
|
||||
// (a with two dots above)
|
||||
" \+u = 0x00FC " , // user types literal + followed by u
|
||||
// to input 0x00FC, which is u with dieresis
|
||||
// (two dots above)
|
||||
" \+u = 0x00FC " , // user types literal + followed by u
|
||||
// to input 0x00FC, which is u with dieresis
|
||||
// (two dots above)
|
||||
" X = 0x0644 0x0627 ", // one to many
|
||||
" 0x32 = 0x0662 " , // type ASCII '2' get ARABIC-INDIC DIGIT 2
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ More Detail on the Syntax of .kmap Files:
|
|||
or using the ASCII value of the plus sign (0x2B)
|
||||
|
||||
" 0x2b z = 0x10df " ,
|
||||
|
||||
|
||||
|
||||
Literal white spaces: Whitespace between between characters in a
|
||||
kmap entry are normally ignored; this allows you to space out the
|
||||
|
|
@ -341,7 +341,7 @@ More Detail on the Syntax of .kmap Files:
|
|||
"\033 KE=0x30F5", // SMALL KE
|
||||
"\"R=0x201D", // RIGHT DOUBLE QUOTATION MARK
|
||||
"kke=0x3063 0x3051",
|
||||
"0x20 = 0x201D", // INPUT LITERAL BLANK
|
||||
"0x20 = 0x201D", // INPUT LITERAL BLANK
|
||||
"0x3D=0x003D", // INPUT '=' SIGN THIS WAY
|
||||
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ Sub-translations:
|
|||
|
||||
Sub-translation may contain empty strings
|
||||
"=0x0021",
|
||||
but consecutive ones cannot.
|
||||
but consecutive ones cannot.
|
||||
|
||||
Matching strategy for sub-translations: When the first
|
||||
sub-translation would match the null string, one character may be
|
||||
|
|
@ -466,14 +466,14 @@ Generic .mys Source Text-Conversion Files [for the future]
|
|||
Better documentation will be required before the average user can
|
||||
understand and use .mys files.
|
||||
|
||||
If you need a keymap file for SMP (Supplementary Multilingual
|
||||
Plane) all you can use is mys format.
|
||||
If you need a keymap file for SMP (Supplementary Multilingual
|
||||
Plane) all you can use is mys format.
|
||||
|
||||
Take a look at the source mys file in Yudit source tree:
|
||||
|
||||
yudit-2.7.8/mytool/mys/OldItalic.mys
|
||||
|
||||
You can compile OldItalic.mys with
|
||||
You can compile OldItalic.mys with
|
||||
|
||||
mytool -convert my -write OldItalic.my -mys OldItalic.mys
|
||||
|
||||
|
|
|
|||
16
kmaptoqe.c
16
kmaptoqe.c
|
|
@ -72,7 +72,7 @@ static int offset, write_data;
|
|||
|
||||
static void put_byte(int b)
|
||||
{
|
||||
if (write_data)
|
||||
if (write_data)
|
||||
*outbuf_ptr++ = b;
|
||||
offset++;
|
||||
}
|
||||
|
|
@ -125,9 +125,9 @@ static void gen_map(void)
|
|||
if (gen_table)
|
||||
first = 1;
|
||||
|
||||
/* c = 0x00 end of table
|
||||
/* c = 0x00 end of table
|
||||
* c = 0x01..0x1d delta unicode
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1f unicode input char follows.
|
||||
* c = 0x20..0x7f input character
|
||||
* c = 0x80 unused
|
||||
|
|
@ -312,7 +312,7 @@ static int dump_kmap(const char *filename)
|
|||
|
||||
if (1) {
|
||||
int len, olen, flag, k, s, last = 0, sp;
|
||||
|
||||
|
||||
s = 0;
|
||||
for (k = 0;; k++) {
|
||||
unsigned char *input;
|
||||
|
|
@ -328,9 +328,9 @@ static int dump_kmap(const char *filename)
|
|||
if (c == EOF)
|
||||
break;
|
||||
|
||||
/* c = 0x00 end of table
|
||||
/* c = 0x00 end of table
|
||||
* c = 0x01..0x1d delta unicode
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1e unicode output mapping follows
|
||||
* c = 0x1f unicode input char follows.
|
||||
* c = 0x20..0x7f input character
|
||||
* c = 0x80 unused
|
||||
|
|
@ -590,7 +590,7 @@ int main(int argc, char **argv)
|
|||
nb_inputs++;
|
||||
continue;
|
||||
invalid:
|
||||
fprintf(stderr, "%s:%d: Invalid mapping: %s\n",
|
||||
fprintf(stderr, "%s:%d: Invalid mapping: %s\n",
|
||||
filename, line_num, line);
|
||||
skip:;
|
||||
}
|
||||
|
|
@ -648,7 +648,7 @@ int main(int argc, char **argv)
|
|||
fputc(0, outfile);
|
||||
fputc(0, outfile);
|
||||
fputc(0, outfile);
|
||||
|
||||
|
||||
fwrite(outbuf, 1, outbuf_ptr - outbuf, outfile);
|
||||
|
||||
fclose(outfile);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ static ModeDef latex_mode;
|
|||
/* TODO: add state handling to allow colorization of elements longer
|
||||
* than one line (eg, multi-line functions and strings)
|
||||
*/
|
||||
static void latex_colorize_line(unsigned int *buf, __unused__ int len,
|
||||
static void latex_colorize_line(unsigned int *buf, __unused__ int len,
|
||||
int *colorize_state_ptr,
|
||||
__unused__ int state_only)
|
||||
{
|
||||
|
|
@ -110,7 +110,7 @@ static void latex_colorize_line(unsigned int *buf, __unused__ int len,
|
|||
case '%':
|
||||
p++;
|
||||
/* line comment */
|
||||
while (*p != '\n')
|
||||
while (*p != '\n')
|
||||
p++;
|
||||
set_color(p_start, p, QE_STYLE_COMMENT);
|
||||
break;
|
||||
|
|
@ -305,7 +305,7 @@ static void do_latex(EditState *e, const char *cmd)
|
|||
char prompt[128];
|
||||
snprintf(prompt, sizeof(prompt), "%s command: ", func->name);
|
||||
minibuffer_edit(buf, prompt, &func->history,
|
||||
NULL /* completion */,
|
||||
NULL /* completion */,
|
||||
latex_cmd_run, func);
|
||||
} else {
|
||||
latex_cmd_run(func, buf);
|
||||
|
|
|
|||
44
libfbf.c
44
libfbf.c
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* libfbf.c - FBF font decoder
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -132,7 +132,7 @@ static void fbf_get_str(UniFontData *uf, char *buf, int buf_size)
|
|||
int i, len, c;
|
||||
char *q;
|
||||
|
||||
len = uf->fbf_getc(uf->infile);
|
||||
len = uf->fbf_getc(uf->infile);
|
||||
q = buf;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = uf->fbf_getc(uf->infile);
|
||||
|
|
@ -187,7 +187,7 @@ int fbf_load_font(UniFontData *uf)
|
|||
|
||||
/* compressed segments offsets */
|
||||
|
||||
uf->nb_csegs = (uf->nb_glyphs + uf->compressed_segment_size - 1) /
|
||||
uf->nb_csegs = (uf->nb_glyphs + uf->compressed_segment_size - 1) /
|
||||
uf->compressed_segment_size;
|
||||
uf->csegs_offsets = uf_malloc(uf, uf->nb_csegs * 2 * sizeof(int));
|
||||
if (!uf->csegs_offsets)
|
||||
|
|
@ -207,7 +207,7 @@ int fbf_load_font(UniFontData *uf)
|
|||
if (!uf->seg_table)
|
||||
goto fail;
|
||||
read_segments(uf);
|
||||
|
||||
|
||||
/* decoding context */
|
||||
if (uf->fbf_read(uf->infile, uf->ctx1, sizeof(uf->ctx1)) != sizeof(uf->ctx1))
|
||||
goto fail;
|
||||
|
|
@ -262,11 +262,11 @@ static void init_context_tables(void)
|
|||
freq0 += 2;
|
||||
else
|
||||
freq1 += 2;
|
||||
if (freq0 > 31 || freq1 > 31) {
|
||||
if (freq0 > 31 || freq1 > 31) {
|
||||
freq0 = (freq0 + 1) >> 1;
|
||||
freq1 = (freq1 + 1) >> 1;
|
||||
}
|
||||
val = (((freq0 - 1) >> 1) << 4) |
|
||||
val = (((freq0 - 1) >> 1) << 4) |
|
||||
((freq1 - 1) >> 1);
|
||||
ctx_incr[bit][ctxval] = val;
|
||||
// printf("%d %02x %02x\n", bit, ctxval, val);
|
||||
|
|
@ -332,7 +332,7 @@ static inline unsigned int decode_ctx(UniFontData *uf, unsigned char *ctx)
|
|||
if (shift & 0x40)
|
||||
range = range * 3;
|
||||
range = range >> (shift & 0x3f);
|
||||
|
||||
|
||||
/* which bit is was encoded ? */
|
||||
b = (alow >= range);
|
||||
if (b) {
|
||||
|
|
@ -341,7 +341,7 @@ static inline unsigned int decode_ctx(UniFontData *uf, unsigned char *ctx)
|
|||
} else {
|
||||
arange = range;
|
||||
}
|
||||
|
||||
|
||||
/* increment context */
|
||||
b = b ^ (shift >> 7);
|
||||
ctx[0] = ctx_incr[b][ctxval];
|
||||
|
|
@ -408,9 +408,9 @@ static inline int get_ctx(int x, int y, unsigned char *p)
|
|||
return v;
|
||||
}
|
||||
|
||||
static void decode_glyph(UniFontData *uf,
|
||||
static void decode_glyph(UniFontData *uf,
|
||||
unsigned char *ctx1,
|
||||
unsigned char *ctx_adapt,
|
||||
unsigned char *ctx_adapt,
|
||||
unsigned char *outbuf,
|
||||
int w, int h)
|
||||
{
|
||||
|
|
@ -515,11 +515,11 @@ static GlyphSegment *decode_metrics_segment(UniFontData *uf, int segment)
|
|||
glyph_end = uf->nb_glyphs;
|
||||
nb_glyphs = glyph_end - glyph_start;
|
||||
|
||||
g = uf_malloc(uf, sizeof(GlyphSegment) +
|
||||
g = uf_malloc(uf, sizeof(GlyphSegment) +
|
||||
(nb_glyphs - 1) * sizeof(GlyphEntry));
|
||||
if (!g)
|
||||
return NULL;
|
||||
|
||||
|
||||
g->first_glyph = glyph_start;
|
||||
g->nb_glyphs = nb_glyphs;
|
||||
g->bitmap_table = NULL;
|
||||
|
|
@ -527,7 +527,7 @@ static GlyphSegment *decode_metrics_segment(UniFontData *uf, int segment)
|
|||
uf->fbf_seek(uf->infile, uf->msegs_offsets[segment]);
|
||||
|
||||
arith_init(uf);
|
||||
|
||||
|
||||
memset(&metric_ctx, 0, sizeof(metric_ctx));
|
||||
for (i = 0; i < nb_glyphs; i++) {
|
||||
m = &g->metrics[i];
|
||||
|
|
@ -552,7 +552,7 @@ static int decode_glyphs_segment(UniFontData *uf, GlyphSegment *g, int segment)
|
|||
nb_glyphs = glyph_end - glyph_start;
|
||||
|
||||
uf->fbf_seek(uf->infile, uf->csegs_offsets[segment]);
|
||||
|
||||
|
||||
/* allocate bitmap */
|
||||
bitmap_size = 0;
|
||||
for (i = 0; i < nb_glyphs; i++) {
|
||||
|
|
@ -586,7 +586,7 @@ static int decode_glyphs_segment(UniFontData *uf, GlyphSegment *g, int segment)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int fbf_decode_glyph(UniFontData *uf,
|
||||
int fbf_decode_glyph(UniFontData *uf,
|
||||
GlyphEntry **glyph_entry_ptr,
|
||||
int index)
|
||||
{
|
||||
|
|
@ -601,8 +601,8 @@ int fbf_decode_glyph(UniFontData *uf,
|
|||
redo:
|
||||
for (i = 0; i < CSEG_CACHE_SIZE; i++) {
|
||||
gseg = uf->cseg_cache[i];
|
||||
if (gseg &&
|
||||
index >= gseg->first_glyph &&
|
||||
if (gseg &&
|
||||
index >= gseg->first_glyph &&
|
||||
index < gseg->first_glyph + gseg->nb_glyphs) {
|
||||
gseg->use_count++;
|
||||
*glyph_entry_ptr = &gseg->metrics[index - gseg->first_glyph];
|
||||
|
|
@ -632,7 +632,7 @@ int fbf_decode_glyph(UniFontData *uf,
|
|||
uf_free(uf, gseg);
|
||||
*pgseg = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* create a glyph segment and decode only its metrics */
|
||||
segment = index / uf->compressed_segment_size;
|
||||
gseg = decode_metrics_segment(uf, segment);
|
||||
|
|
@ -658,7 +658,7 @@ int fbf_unicode_to_glyph(UniFontData *uf, int code)
|
|||
/* map to composite glyph area */
|
||||
return code - 0xAC00 + uf->nb_glyphs;
|
||||
}
|
||||
|
||||
|
||||
start = 0;
|
||||
end = uf->nb_segs - 1;
|
||||
while (end >= start) {
|
||||
|
|
@ -812,14 +812,14 @@ static int decode_hangul_glyph(UniFontData *uf,
|
|||
glyph_entry->y = 0;
|
||||
glyph_entry->xincr = 16;
|
||||
wrap = (glyph_entry->w + 7) >> 3;
|
||||
|
||||
|
||||
l = code / (21 * 28);
|
||||
m = ((code / 28) % 21) + 1;
|
||||
f = code % 28;
|
||||
|
||||
|
||||
/* first glyph */
|
||||
ind[0] = lconBase[l] + ((f > 0) ? lconMap2[m] : lconMap1[m]);
|
||||
|
||||
|
||||
/* second glyph */
|
||||
ind[1] = vowBase[m];
|
||||
if (vowType[m] == 1) {
|
||||
|
|
|
|||
10
libfbf.h
10
libfbf.h
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* libfbf.c - FBF font decoder
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -52,7 +52,7 @@ typedef struct {
|
|||
#define MAXDIST 4
|
||||
|
||||
#define MAXWIDTH 128
|
||||
#define MAXHEIGHT 128
|
||||
#define MAXHEIGHT 128
|
||||
#define MAXWRAP ((MAXWIDTH+7)/8)
|
||||
|
||||
#define WRAP (MAXWIDTH + 2 * MAXDIST)
|
||||
|
|
@ -95,7 +95,7 @@ struct UniFontData {
|
|||
int nb_glyphs; /* real number of glyphs */
|
||||
int nb_glyphs_total; /* total number, including algorithmically
|
||||
generated ones */
|
||||
unsigned int flags;
|
||||
unsigned int flags;
|
||||
int compressed_segment_size;
|
||||
int max_width, max_height; /* maximum dimensions of bitmaps */
|
||||
int x_res, y_res, pt_size;
|
||||
|
|
@ -120,7 +120,7 @@ struct UniFontData {
|
|||
void *mem_opaque;
|
||||
void *(*fbf_malloc)(void *mem_opaque, int size);
|
||||
void (*fbf_free)(void *mem_opaque, void *ptr);
|
||||
|
||||
|
||||
/* file input handlings */
|
||||
void *infile;
|
||||
int (*fbf_seek)(void *infile, long pos);
|
||||
|
|
@ -151,7 +151,7 @@ int fbf_load_font(UniFontData *uf);
|
|||
void fbf_free_font(UniFontData *uf);
|
||||
|
||||
int fbf_unicode_to_glyph(UniFontData *uf, int code);
|
||||
int fbf_decode_glyph(UniFontData *uf,
|
||||
int fbf_decode_glyph(UniFontData *uf,
|
||||
GlyphEntry **glyph_entry_ptr,
|
||||
int index);
|
||||
|
||||
|
|
|
|||
342
libqhtml/css.c
342
libqhtml/css.c
File diff suppressed because it is too large
Load diff
|
|
@ -99,7 +99,7 @@ enum CSSProperties {
|
|||
CSS_border_top,
|
||||
CSS_border_right,
|
||||
CSS_border_bottom,
|
||||
|
||||
|
||||
CSS_padding,
|
||||
CSS_padding_left,
|
||||
CSS_padding_top,
|
||||
|
|
@ -206,7 +206,7 @@ typedef struct CSSPropertyDef {
|
|||
#define CSS_TYPE_LENGTH 0x00000001
|
||||
#define CSS_TYPE_COLOR 0x00000002
|
||||
#define CSS_TYPE_ENUM 0x00000004
|
||||
#define CSS_TYPE_BORDER_STYLE 0x00000008
|
||||
#define CSS_TYPE_BORDER_STYLE 0x00000008
|
||||
#define CSS_TYPE_FONT_FAMILY 0x00000010
|
||||
#define CSS_TYPE_BORDER_ENUM 0x00000020
|
||||
#define CSS_TYPE_STRING 0x00000040
|
||||
|
|
@ -302,7 +302,7 @@ typedef struct CSSProperty {
|
|||
unsigned short property;
|
||||
unsigned short nb_values;
|
||||
struct CSSProperty *next; /* may change: use array ? */
|
||||
CSSPropertyValue value; /* in fact an array, but need
|
||||
CSSPropertyValue value; /* in fact an array, but need
|
||||
to change all the types */
|
||||
} CSSProperty;
|
||||
|
||||
|
|
@ -355,9 +355,9 @@ struct CSSBox {
|
|||
/* next inline box in an inline formatting context. Only used
|
||||
during bidi pass, so we could put this field in another field
|
||||
to save space */
|
||||
struct CSSBox *next_inline;
|
||||
struct CSSBox *next_inline;
|
||||
/* parent box */
|
||||
struct CSSBox *parent;
|
||||
struct CSSBox *parent;
|
||||
union {
|
||||
struct {
|
||||
struct CSSBox *last; /* used only when building the tree */
|
||||
|
|
@ -500,14 +500,14 @@ void css_dump_style_sheet(CSSStyleSheet *s);
|
|||
void css_merge_style_sheet(CSSStyleSheet *s, CSSStyleSheet *a);
|
||||
|
||||
CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str);
|
||||
void css_add_prop_values(CSSProperty ***last_prop,
|
||||
int property_index,
|
||||
void css_add_prop_values(CSSProperty ***last_prop,
|
||||
int property_index,
|
||||
int nb_values, CSSPropertyValue *val_ptr);
|
||||
void css_add_prop(CSSProperty ***last_prop,
|
||||
void css_add_prop(CSSProperty ***last_prop,
|
||||
int property_index, CSSPropertyValue *val_ptr);
|
||||
void css_add_prop_unit(CSSProperty ***last_prop,
|
||||
void css_add_prop_unit(CSSProperty ***last_prop,
|
||||
int property_index, int type, int val);
|
||||
void css_add_prop_int(CSSProperty ***last_prop,
|
||||
void css_add_prop_int(CSSProperty ***last_prop,
|
||||
int property_index, int val);
|
||||
CSSStyleSheetEntry *add_style_entry(CSSStyleSheet *s,
|
||||
CSSSimpleSelector *ss,
|
||||
|
|
@ -537,7 +537,7 @@ typedef struct CSSContext {
|
|||
int selection_bgcolor;
|
||||
int selection_fgcolor;
|
||||
int default_bgcolor;
|
||||
|
||||
|
||||
/* edit buffer */
|
||||
EditBuffer *b;
|
||||
/* selection handling */
|
||||
|
|
@ -557,7 +557,7 @@ typedef struct CSSContext {
|
|||
CSSCounterValue *counter_stack_base;
|
||||
|
||||
/* css attributes for the boxes are shared here */
|
||||
CSSState *hash_props[PROPS_HASH_SIZE];
|
||||
CSSState *hash_props[PROPS_HASH_SIZE];
|
||||
} CSSContext;
|
||||
|
||||
/* document managing */
|
||||
|
|
@ -571,21 +571,21 @@ void css_delete_document(CSSContext *s);
|
|||
int css_compute(CSSContext *s, CSSBox *box);
|
||||
int css_layout(CSSContext *s, CSSBox *box, int width,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque);
|
||||
void css_display(CSSContext *s, CSSBox *box,
|
||||
void css_display(CSSContext *s, CSSBox *box,
|
||||
CSSRect *clip_box, int dx, int dy);
|
||||
|
||||
/* cursor/edition handling */
|
||||
int box_get_text(CSSContext *s,
|
||||
unsigned int *line_buf, int max_size,
|
||||
unsigned int *line_buf, int max_size,
|
||||
int *offsets, CSSBox *box);
|
||||
int css_get_cursor_pos(CSSContext *s, CSSBox *box,
|
||||
int css_get_cursor_pos(CSSContext *s, CSSBox *box,
|
||||
CSSBox **box_ptr, int *x0_ptr, int *y0_ptr,
|
||||
CSSRect *cursor_ptr, int *dir_ptr,
|
||||
CSSRect *cursor_ptr, int *dir_ptr,
|
||||
int offset);
|
||||
int css_get_offset_pos(CSSContext *s, CSSBox *box, int xc, int dir);
|
||||
|
||||
typedef int (*CSSIterateFunc)(void *opaque, CSSBox *box, int x0, int y0);
|
||||
int css_box_iterate(CSSContext *s, CSSBox *box, void *opaque,
|
||||
int css_box_iterate(CSSContext *s, CSSBox *box, void *opaque,
|
||||
CSSIterateFunc iterate_func);
|
||||
|
||||
|
||||
|
|
@ -614,12 +614,12 @@ typedef struct XMLState XMLState;
|
|||
#define XML_HTML_SYNTAX 0x0008 /* modify xml parser to accept HTML syntax */
|
||||
|
||||
XMLState *xml_begin(CSSStyleSheet *style_sheet, int flags,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque,
|
||||
const char *filename, QECharset *charset);
|
||||
int xml_parse(XMLState *s, char *buf, int buf_len);
|
||||
CSSBox *xml_end(XMLState *s);
|
||||
|
||||
CSSBox *xml_parse_buffer(EditBuffer *b, int offset_start, int offset_end,
|
||||
CSSBox *xml_parse_buffer(EditBuffer *b, int offset_start, int offset_end,
|
||||
CSSStyleSheet *style_sheet, int flags,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque);
|
||||
int find_entity(const char *str);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ static int css_get_length(int *length_ptr, int *unit_ptr, const char *p)
|
|||
break;
|
||||
case CSS_UNIT_PERCENT:
|
||||
if (f < 0) {
|
||||
/* CG: ain't wrong ? */
|
||||
/* CG: ain't wrong ? */
|
||||
if (f >= 100)
|
||||
return -1;
|
||||
f = 100 - f;
|
||||
|
|
@ -172,8 +172,8 @@ static char *css_parse_string(const char **pp)
|
|||
c = *p++;
|
||||
if (c == 'A') {
|
||||
c = CSS_CONTENT_EOL;
|
||||
}
|
||||
/* XXX: hex digits */
|
||||
}
|
||||
/* XXX: hex digits */
|
||||
}
|
||||
if ((q - buf) < (int)sizeof(buf) - 1)
|
||||
*q++ = c;
|
||||
|
|
@ -185,8 +185,8 @@ static char *css_parse_string(const char **pp)
|
|||
}
|
||||
|
||||
/* add a given number of values */
|
||||
void css_add_prop_values(CSSProperty ***last_prop,
|
||||
int property_index,
|
||||
void css_add_prop_values(CSSProperty ***last_prop,
|
||||
int property_index,
|
||||
int nb_values, CSSPropertyValue *val_ptr)
|
||||
{
|
||||
CSSProperty *prop;
|
||||
|
|
@ -199,18 +199,18 @@ void css_add_prop_values(CSSProperty ***last_prop,
|
|||
prop->next = NULL;
|
||||
prop->nb_values = nb_values;
|
||||
memcpy(&prop->value, val_ptr, nb_values * sizeof(CSSPropertyValue));
|
||||
|
||||
|
||||
**last_prop = prop;
|
||||
*last_prop = &prop->next;
|
||||
}
|
||||
|
||||
void css_add_prop(CSSProperty ***last_prop,
|
||||
void css_add_prop(CSSProperty ***last_prop,
|
||||
int property_index, CSSPropertyValue *val_ptr)
|
||||
{
|
||||
css_add_prop_values(last_prop, property_index, 1, val_ptr);
|
||||
}
|
||||
|
||||
void css_add_prop_unit(CSSProperty ***last_prop,
|
||||
void css_add_prop_unit(CSSProperty ***last_prop,
|
||||
int property_index, int type, int val)
|
||||
{
|
||||
CSSPropertyValue value;
|
||||
|
|
@ -219,15 +219,15 @@ void css_add_prop_unit(CSSProperty ***last_prop,
|
|||
css_add_prop(last_prop, property_index, &value);
|
||||
}
|
||||
|
||||
void css_add_prop_int(CSSProperty ***last_prop,
|
||||
void css_add_prop_int(CSSProperty ***last_prop,
|
||||
int property_index, int val)
|
||||
{
|
||||
css_add_prop_unit(last_prop, property_index, CSS_UNIT_NONE, val);
|
||||
}
|
||||
|
||||
static const char border_style_enum[] =
|
||||
static const char border_style_enum[] =
|
||||
"none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset";
|
||||
static const char list_style_enum[] =
|
||||
static const char list_style_enum[] =
|
||||
"disc,circle,square,decimal,lower-alpha,upper-alpha,lower-roman,upper-roman,none";
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
|
@ -251,7 +251,7 @@ CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str)
|
|||
p = props_str;
|
||||
for (;;) {
|
||||
get_str(&p, property, sizeof(property), ":");
|
||||
if (*p == '\0')
|
||||
if (*p == '\0')
|
||||
break;
|
||||
if (*p == ':')
|
||||
p++;
|
||||
|
|
@ -286,7 +286,7 @@ CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str)
|
|||
if (nb_args >= 2 &&
|
||||
!(type & (CSS_TYPE_FOUR|CSS_TYPE_ARGS)))
|
||||
break;
|
||||
if (nb_args >= 4 &&
|
||||
if (nb_args >= 4 &&
|
||||
(!type & CSS_TYPE_ARGS))
|
||||
break;
|
||||
if (nb_args >= MAX_ARGS)
|
||||
|
|
@ -401,7 +401,7 @@ CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str)
|
|||
goto got_val;
|
||||
}
|
||||
}
|
||||
css_error1(b, "unrecognized value '%s' for property '%s'",
|
||||
css_error1(b, "unrecognized value '%s' for property '%s'",
|
||||
buf, def->name);
|
||||
goto next;
|
||||
got_val:
|
||||
|
|
@ -431,20 +431,20 @@ CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str)
|
|||
case CSS_border_right:
|
||||
case CSS_border_bottom:
|
||||
if (unit == CSS_VALUE_COLOR) {
|
||||
property_index1 = property_index +
|
||||
property_index1 = property_index +
|
||||
CSS_border_color - CSS_border;
|
||||
} else if (unit == CSS_UNIT_NONE) {
|
||||
property_index1 = property_index +
|
||||
property_index1 = property_index +
|
||||
CSS_border_style - CSS_border;
|
||||
} else {
|
||||
property_index1 = property_index +
|
||||
property_index1 = property_index +
|
||||
CSS_border_width - CSS_border;
|
||||
}
|
||||
args[0].type = unit;
|
||||
args[0].u.val = val;
|
||||
if (property_index == CSS_border) {
|
||||
for (i = 0; i < 4; i++)
|
||||
css_add_prop(&last_prop, property_index1 + 1 + i,
|
||||
for (i = 0; i < 4; i++)
|
||||
css_add_prop(&last_prop, property_index1 + 1 + i,
|
||||
&args[0]);
|
||||
} else {
|
||||
css_add_prop(&last_prop, property_index1, &args[0]);
|
||||
|
|
@ -496,12 +496,12 @@ CSSProperty *css_parse_properties(CSSParseState *b, const char *props_str)
|
|||
args[0] = v4;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
css_add_prop(&last_prop, property_index + 1 + i, &args[i]);
|
||||
} else if (type & CSS_TYPE_TWO) {
|
||||
if (nb_args == 1)
|
||||
args[1] = args[0];
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
css_add_prop(&last_prop, property_index + 1 + i, &args[i]);
|
||||
} else if (type & CSS_TYPE_ARGS) {
|
||||
/* unbounded number of args */
|
||||
|
|
@ -555,7 +555,7 @@ void css_dump_properties(CSSProperty *prop)
|
|||
const char *p, *p1;
|
||||
int i, len;
|
||||
char buf[100];
|
||||
|
||||
|
||||
if (def->type & CSS_TYPE_BORDER_STYLE)
|
||||
p = border_style_enum;
|
||||
else
|
||||
|
|
@ -589,8 +589,8 @@ void css_dump_properties(CSSProperty *prop)
|
|||
printf("attr(%s)", css_ident_str(value->u.attr_id));
|
||||
break;
|
||||
case CSS_VALUE_COUNTER:
|
||||
printf("counter(%s,%d)",
|
||||
css_ident_str(value->u.counter.counter_id),
|
||||
printf("counter(%s,%d)",
|
||||
css_ident_str(value->u.counter.counter_id),
|
||||
value->u.counter.type);
|
||||
break;
|
||||
case CSS_VALUE_INTEGER:
|
||||
|
|
@ -644,7 +644,7 @@ void css_free_style_sheet(CSSStyleSheet *s)
|
|||
|
||||
for (e = s->first_entry; e != NULL; e = e1) {
|
||||
e1 = e->next;
|
||||
|
||||
|
||||
for (ss = e->sel.next; ss != NULL; ss = ss1) {
|
||||
ss1 = ss->next;
|
||||
free_selector(ss);
|
||||
|
|
@ -658,7 +658,7 @@ void css_free_style_sheet(CSSStyleSheet *s)
|
|||
}
|
||||
qe_free(&e);
|
||||
}
|
||||
|
||||
|
||||
qe_free(&s);
|
||||
}
|
||||
|
||||
|
|
@ -719,7 +719,7 @@ static void read_string(CSSParseState *b, int *ch_ptr, char *ident, int ident_si
|
|||
}
|
||||
*q = '\0';
|
||||
ch = bgetc(b);
|
||||
*ch_ptr = ch;
|
||||
*ch_ptr = ch;
|
||||
}
|
||||
|
||||
static void read_ident(CSSParseState *b, int *ch_ptr, char *ident, int ident_size)
|
||||
|
|
@ -754,7 +754,7 @@ void add_attribute(CSSStyleSheetAttributeEntry ***last_attr,
|
|||
CSSIdent attr, int op, const char *value)
|
||||
{
|
||||
CSSStyleSheetAttributeEntry *ae;
|
||||
|
||||
|
||||
ae = qe_malloc_hack(CSSStyleSheetAttributeEntry, strlen(value));
|
||||
ae->attr = attr;
|
||||
ae->op = op;
|
||||
|
|
@ -771,14 +771,14 @@ CSSStyleSheetEntry *add_style_entry(CSSStyleSheet *s,
|
|||
int media)
|
||||
{
|
||||
CSSStyleSheetEntry *e, **pp;
|
||||
|
||||
|
||||
/* add the style sheet entry */
|
||||
e = qe_mallocz(CSSStyleSheetEntry);
|
||||
if (!e)
|
||||
return NULL;
|
||||
e->sel = *ss;
|
||||
e->media = media;
|
||||
|
||||
|
||||
/* add in entry list */
|
||||
*s->plast_entry = e;
|
||||
s->plast_entry = &e->next;
|
||||
|
|
@ -829,7 +829,7 @@ void css_merge_style_sheet(CSSStyleSheet *s, CSSStyleSheet *a)
|
|||
/* add selector */
|
||||
dup_selector(&ss2, &e->sel);
|
||||
e1 = add_style_entry(s, &ss2, e->media);
|
||||
|
||||
|
||||
/* add selector operations */
|
||||
pss = &e1->sel.next;
|
||||
for (ss = e->sel.next; ss != NULL; ss = ss->next) {
|
||||
|
|
@ -869,7 +869,7 @@ static void parse_simple_selector(CSSSimpleSelector *ss, CSSParseState *b,
|
|||
CSSStyleSheetAttributeEntry *first_attr, **last_attr;
|
||||
|
||||
ch = *ch_ptr;
|
||||
|
||||
|
||||
/* read the tag */
|
||||
first_attr = NULL;
|
||||
last_attr = &first_attr;
|
||||
|
|
@ -970,7 +970,7 @@ void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
|
|||
CSSStyleSheetEntry *e, **first_eprops;
|
||||
CSSSimpleSelector ss2, *ss = &ss2, *last_ss, *ss1;
|
||||
CSSProperty *props;
|
||||
|
||||
|
||||
ch = bgetc(b);
|
||||
media = CSS_MEDIA_ALL;
|
||||
for (;;) {
|
||||
|
|
@ -1000,7 +1000,7 @@ void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
|
|||
bskip_spaces(b, &ch);
|
||||
read_ident(b, &ch, tag, sizeof(tag));
|
||||
val = css_get_enum(tag, "tty,screen,print,tv,speech,all");
|
||||
if (val < 0 || val == 5)
|
||||
if (val < 0 || val == 5)
|
||||
media = CSS_MEDIA_ALL;
|
||||
else
|
||||
media |= (1 << val);
|
||||
|
|
@ -1035,7 +1035,7 @@ void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
|
|||
ch = bgetc(b);
|
||||
goto redo;
|
||||
}
|
||||
|
||||
|
||||
/* parse a selector list */
|
||||
for (;;) {
|
||||
/* parse simple selectors with operations */
|
||||
|
|
@ -1091,7 +1091,7 @@ void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
|
|||
ch = bgetc(b);
|
||||
}
|
||||
*q = '\0';
|
||||
|
||||
|
||||
if (ch == '}')
|
||||
ch = bgetc(b);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Some CSS styles for DocBook V4.
|
||||
* (Not exhaustive. Has enough styles to render the LDP Author Guide.)
|
||||
*
|
||||
|
|
@ -117,7 +117,7 @@ msgsub,
|
|||
msgtext,
|
||||
note,
|
||||
orderedlist,
|
||||
otheraddr,
|
||||
otheraddr,
|
||||
othercredit,
|
||||
othername,
|
||||
para,
|
||||
|
|
@ -160,11 +160,11 @@ screenco,
|
|||
screenshot,
|
||||
secondaryie,
|
||||
sect1,
|
||||
sect2,
|
||||
sect3,
|
||||
sect4,
|
||||
sect5,
|
||||
section,
|
||||
sect2,
|
||||
sect3,
|
||||
sect4,
|
||||
sect5,
|
||||
section,
|
||||
seealsoie,
|
||||
seeie,
|
||||
seglistitem,
|
||||
|
|
@ -192,7 +192,7 @@ term,
|
|||
tertiaryie,
|
||||
textobject,
|
||||
tip,
|
||||
title,
|
||||
title,
|
||||
toc,
|
||||
tocback,
|
||||
tocchap,
|
||||
|
|
@ -204,9 +204,9 @@ toclevel3,
|
|||
toclevel4,
|
||||
toclevel5,
|
||||
tocpart,
|
||||
variablelist,
|
||||
variablelist,
|
||||
varlistentry,
|
||||
videoobject,
|
||||
videoobject,
|
||||
warning {
|
||||
display: block;
|
||||
}
|
||||
|
|
@ -271,25 +271,25 @@ article > subtitle {
|
|||
}
|
||||
|
||||
sect1 > title, sect2 > title, sect3 > title, sect4 > title, sect5 > title,
|
||||
section > title {
|
||||
section > title {
|
||||
font-weight: bold;
|
||||
color: maroon;
|
||||
}
|
||||
sect1 > title,
|
||||
section > title {
|
||||
section > title {
|
||||
font-size: 1.5em;
|
||||
margin-top: .83ex;
|
||||
margin-bottom: .83ex;
|
||||
}
|
||||
sect2 > title,
|
||||
section section > title {
|
||||
section section > title {
|
||||
font-size: 1.17em;
|
||||
margin-top: 1ex;
|
||||
margin-bottom: 1ex;
|
||||
}
|
||||
sect3 > title, sect4 > title, sect5 > title,
|
||||
section section section > title,
|
||||
section section * section > title {
|
||||
section section * section > title {
|
||||
font-size: 1em;
|
||||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
|
|
@ -333,7 +333,7 @@ section section section * section > title:before {
|
|||
* Table style
|
||||
*/
|
||||
|
||||
table,
|
||||
table,
|
||||
informaltable {
|
||||
display: block;
|
||||
margin-top: 1.33ex;
|
||||
|
|
@ -354,22 +354,22 @@ tgroup {
|
|||
colspec, spanspec {
|
||||
display: table-column;
|
||||
}
|
||||
thead, tbody, tfoot {
|
||||
thead, tbody, tfoot {
|
||||
display: table-row-group;
|
||||
vertical-align: eval(attr(valign));
|
||||
}
|
||||
row {
|
||||
row {
|
||||
display: table-row;
|
||||
vertical-align: eval(attr(valign));
|
||||
}
|
||||
entry {
|
||||
entry {
|
||||
display: table-cell;
|
||||
text-align: eval(attr(align));
|
||||
vertical-align: eval(attr(valign));
|
||||
border: 1px inset gray;
|
||||
padding: 2px;
|
||||
}
|
||||
entry > *:first-child {
|
||||
entry > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
@ -383,9 +383,9 @@ entrytbl {
|
|||
* Block styles
|
||||
*/
|
||||
|
||||
para,
|
||||
para,
|
||||
simpara,
|
||||
formalpara {
|
||||
formalpara {
|
||||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
}
|
||||
|
|
@ -398,12 +398,12 @@ formalpara > title {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
listitem > *:first-child {
|
||||
listitem > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
itemizedlist {
|
||||
itemizedlist {
|
||||
margin-left: 2ex;
|
||||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
|
|
@ -419,18 +419,18 @@ itemizedlist > listitem itemizedlist > listitem:before {
|
|||
display: marker;
|
||||
content: square;
|
||||
}
|
||||
itemizedlist > listitem itemizedlist > listitem
|
||||
itemizedlist > listitem itemizedlist > listitem
|
||||
itemizedlist > listitem:before {
|
||||
display: marker;
|
||||
content: icon(diamond);
|
||||
}
|
||||
itemizedlist > listitem itemizedlist > listitem itemizedlist > listitem
|
||||
itemizedlist > listitem itemizedlist > listitem itemizedlist > listitem
|
||||
itemizedlist > listitem:before {
|
||||
display: marker;
|
||||
content: circle;
|
||||
}
|
||||
|
||||
orderedlist {
|
||||
orderedlist {
|
||||
margin-left: 2ex;
|
||||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
|
|
@ -465,7 +465,7 @@ orderedlist[numeration=upperroman] > listitem:before {
|
|||
content: counter(n, upper-roman);
|
||||
}
|
||||
|
||||
variablelist {
|
||||
variablelist {
|
||||
margin-left: 2ex;
|
||||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
|
|
@ -488,7 +488,7 @@ glossentry > glossterm {
|
|||
glossdef {
|
||||
margin-left: 4ex;
|
||||
}
|
||||
glossdef > *:first-child {
|
||||
glossdef > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
@ -504,26 +504,26 @@ question,
|
|||
answer {
|
||||
margin-left: 4ex;
|
||||
}
|
||||
question:before {
|
||||
question:before {
|
||||
content: "Q:";
|
||||
display: marker;
|
||||
color: olive;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
answer:before {
|
||||
answer:before {
|
||||
content: "A:";
|
||||
display: marker;
|
||||
color: olive;
|
||||
font-weight: bold;
|
||||
}
|
||||
question > *:first-child,
|
||||
answer > *:first-child {
|
||||
answer > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
simplelist {
|
||||
simplelist {
|
||||
margin-left: 4ex;
|
||||
}
|
||||
member {
|
||||
|
|
@ -560,7 +560,7 @@ footnote:before {
|
|||
}
|
||||
|
||||
programlisting,
|
||||
screen {
|
||||
screen {
|
||||
white-space: pre;
|
||||
background-color: #E0E0E0;
|
||||
border: thin solid gray;
|
||||
|
|
@ -576,7 +576,7 @@ programlistingco {
|
|||
margin-top: 1.33ex;
|
||||
margin-bottom: 1.33ex;
|
||||
}
|
||||
programlistingco programlisting {
|
||||
programlistingco programlisting {
|
||||
border-style: none;
|
||||
}
|
||||
areaspec:before {
|
||||
|
|
@ -593,7 +593,7 @@ co {
|
|||
callout {
|
||||
margin-left: 6ex;
|
||||
}
|
||||
callout > *:first-child {
|
||||
callout > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
@ -617,12 +617,12 @@ figure > title,
|
|||
caption {
|
||||
font-style: italic;
|
||||
}
|
||||
caption > *:first-child {
|
||||
caption > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
/*
|
||||
* Showing a 400x200 thumbnail is sufficient.
|
||||
/*
|
||||
* Showing a 400x200 thumbnail is sufficient.
|
||||
* If you don't like that, replace the content property by a more traditional:
|
||||
* content: image(attr(fileref));
|
||||
*/
|
||||
|
|
@ -677,12 +677,12 @@ replaceable {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
anchor:after {
|
||||
content: icon(left-target);
|
||||
anchor:after {
|
||||
content: icon(left-target);
|
||||
vertical-align: text-top;
|
||||
color: olive;
|
||||
}
|
||||
link,
|
||||
link,
|
||||
ulink,
|
||||
email {
|
||||
color: navy;
|
||||
|
|
@ -747,7 +747,7 @@ quote:after {
|
|||
}
|
||||
|
||||
* {
|
||||
background-color: transparent;
|
||||
background-color: transparent;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
with XHTML. */
|
||||
|
||||
address,
|
||||
blockquote,
|
||||
body, dd, div,
|
||||
dl, dt,
|
||||
blockquote,
|
||||
body, dd, div,
|
||||
dl, dt,
|
||||
fieldset, form,
|
||||
frame, frameset,
|
||||
h1, h2, h3, h4,
|
||||
h5, h6, iframe,
|
||||
noframes,
|
||||
object, ol, p,
|
||||
ul, applet,
|
||||
center, dir,
|
||||
h1, h2, h3, h4,
|
||||
h5, h6, iframe,
|
||||
noframes,
|
||||
object, ol, p,
|
||||
ul, applet,
|
||||
center, dir,
|
||||
hr, menu, pre { display: block }
|
||||
li { display: list-item }
|
||||
head { display: none }
|
||||
table { display: table; border-collapse: separate;
|
||||
table { display: table; border-collapse: separate;
|
||||
border-spacing: 2px; text-align: left; }
|
||||
tr { display: table-row; vertical-align: middle }
|
||||
thead { display: table-header-group }
|
||||
|
|
@ -73,19 +73,19 @@ a[href] { text-decoration: underline; color: blue }
|
|||
:focus { outline: thin dotted invert }
|
||||
*/
|
||||
|
||||
/* Begin bidirectionality settings (do not change) */
|
||||
bdo[dir="ltr"] { direction: ltr; unicode-bidi: bidi-override }
|
||||
bdo[dir="rtl"] { direction: rtl; unicode-bidi: bidi-override }
|
||||
*[dir="ltr"] { direction: ltr; unicode-bidi: embed }
|
||||
*[dir="rtl"] { direction: rtl; unicode-bidi: embed }
|
||||
/* Begin bidirectionality settings (do not change) */
|
||||
bdo[dir="ltr"] { direction: ltr; unicode-bidi: bidi-override }
|
||||
bdo[dir="rtl"] { direction: rtl; unicode-bidi: bidi-override }
|
||||
*[dir="ltr"] { direction: ltr; unicode-bidi: embed }
|
||||
*[dir="rtl"] { direction: rtl; unicode-bidi: embed }
|
||||
|
||||
/* Elements that are block-level in HTML4 */
|
||||
address, blockquote, body, dd, div, dl, dt, fieldset,
|
||||
form, frame, frameset, h1, h2, h3, h4, h5, h6, iframe,
|
||||
noscript, noframes, object, ol, p, ul, applet, center,
|
||||
dir, hr, menu, pre, li, table, tr, thead, tbody, tfoot,
|
||||
col, colgroup, td, th, caption { unicode-bidi: embed }
|
||||
/* End bidi settings */
|
||||
/* Elements that are block-level in HTML4 */
|
||||
address, blockquote, body, dd, div, dl, dt, fieldset,
|
||||
form, frame, frameset, h1, h2, h3, h4, h5, h6, iframe,
|
||||
noscript, noframes, object, ol, p, ul, applet, center,
|
||||
dir, hr, menu, pre, li, table, tr, thead, tbody, tfoot,
|
||||
col, colgroup, td, th, caption { unicode-bidi: embed }
|
||||
/* End bidi settings */
|
||||
|
||||
/* additional special qemacs attributes */
|
||||
body {
|
||||
|
|
@ -101,22 +101,22 @@ input[type="radio"]:before { content: "(*)"; white-space: pre }
|
|||
|
||||
input[type="checkbox"]:before { content: "[X]"; white-space: pre }
|
||||
|
||||
input[type="button"],
|
||||
input[type="button"],
|
||||
input[type="reset"],
|
||||
input[type="submit"],
|
||||
button { color: black; background-color: gray; padding: 4px; border: 3px ridge }
|
||||
|
||||
input[type="text"],
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
input[type="file"],
|
||||
textarea { color: black; background-color: white; padding: 2px; border: 3px ridge;
|
||||
textarea { color: black; background-color: white; padding: 2px; border: 3px ridge;
|
||||
font-size: 14pt; font-family: monospace; white-space: pre; text-align: left; }
|
||||
|
||||
input[type="file"] { width: 20em; }
|
||||
|
||||
textarea { display: block }
|
||||
|
||||
select { color: black; background-color: white; padding: 2px; border: 3px ridge;
|
||||
select { color: black; background-color: white; padding: 2px; border: 3px ridge;
|
||||
font-size: 14pt; width: 6em; }
|
||||
option { display: none }
|
||||
option[selected] { display: inline }
|
||||
|
|
@ -124,7 +124,7 @@ optgroup { display: none }
|
|||
|
||||
/* NOTE: this style is only used to display the ALT content. It is
|
||||
highly dependent on qemacs CSS2 render */
|
||||
img, input[type="img"] { font-family: sans; font-size: 10pt;
|
||||
img, input[type="img"] { font-family: sans; font-size: 10pt;
|
||||
vertical-align: top; text-align: left; overflow: hidden;
|
||||
text-decoration: none; }
|
||||
|
||||
|
|
@ -139,13 +139,13 @@ ul, ol { counter-reset: list-item }
|
|||
@page { margin: 10% }
|
||||
h1, h2, h3,
|
||||
h4, h5, h6 { page-break-after: avoid; page-break-inside: avoid }
|
||||
blockquote,
|
||||
blockquote,
|
||||
pre { page-break-inside: avoid }
|
||||
ul, ol, dl { page-break-before: avoid }
|
||||
}
|
||||
|
||||
@media speech {
|
||||
h1, h2, h3,
|
||||
h1, h2, h3,
|
||||
h4, h5, h6 { voice-family: paul, male; stress: 20; richness: 90 }
|
||||
h1 { pitch: x-low; pitch-range: 90 }
|
||||
h2 { pitch: x-low; pitch-range: 80 }
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ ENTITY(lArr , 8656) /* leftwards double arrow, U+21D0 ISOtech */
|
|||
ENTITY(uArr , 8657) /* upwards double arrow, U+21D1 ISOamsa */
|
||||
ENTITY(rArr , 8658) /* rightwards double arrow,
|
||||
U+21D2 ISOtech */
|
||||
/* Unicode does not say this is the 'implies' character but does not have
|
||||
/* Unicode does not say this is the 'implies' character but does not have
|
||||
another character with this function so ?
|
||||
rArr can be used for 'implies' as ISOtech suggests */
|
||||
ENTITY(dArr , 8659) /* downwards double arrow, U+21D3 ISOamsa */
|
||||
|
|
@ -419,9 +419,9 @@ ENTITY(ge , 8805) /* greater-than or equal to,
|
|||
U+2265 ISOtech */
|
||||
ENTITY(sub , 8834) /* subset of, U+2282 ISOtech */
|
||||
ENTITY(sup , 8835) /* superset of, U+2283 ISOtech */
|
||||
/* note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
|
||||
/* note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
|
||||
font encoding and is not included. Should it be, for symmetry?
|
||||
It is in ISOamsn */
|
||||
It is in ISOamsn */
|
||||
ENTITY(nsub , 8836) /* not a subset of, U+2284 ISOamsn */
|
||||
ENTITY(sube , 8838) /* subset of or equal to, U+2286 ISOtech */
|
||||
ENTITY(supe , 8839) /* superset of or equal to,
|
||||
|
|
@ -444,11 +444,11 @@ ENTITY(lfloor , 8970) /* left floor = apl downstile,
|
|||
ENTITY(rfloor , 8971) /* right floor, U+230B ISOamsc */
|
||||
ENTITY(lang , 9001) /* left-pointing angle bracket = bra,
|
||||
U+2329 ISOtech */
|
||||
/* lang is NOT the same character as U+003C 'less than'
|
||||
/* lang is NOT the same character as U+003C 'less than'
|
||||
or U+2039 'single left-pointing angle quotation mark' */
|
||||
ENTITY(rang , 9002) /* right-pointing angle bracket = ket,
|
||||
U+232A ISOtech */
|
||||
/* rang is NOT the same character as U+003E 'greater than'
|
||||
/* rang is NOT the same character as U+003E 'greater than'
|
||||
or U+203A 'single right-pointing angle quotation mark' */
|
||||
|
||||
/* Geometric Shapes */
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ struct XMLState {
|
|||
add to that */
|
||||
enum XMLParseState state;
|
||||
int line_num;
|
||||
CSSAbortFunc *abort_func;
|
||||
CSSAbortFunc *abort_func;
|
||||
void *abort_opaque;
|
||||
QECharset *charset;
|
||||
int base_font; /* XXX: is it correct ? */
|
||||
|
|
@ -267,11 +267,11 @@ struct XMLState {
|
|||
/* start xml parsing */
|
||||
|
||||
XMLState *xml_begin(CSSStyleSheet *style_sheet, int flags,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque,
|
||||
const char *filename, QECharset *charset)
|
||||
{
|
||||
XMLState *s;
|
||||
|
||||
|
||||
s = qe_mallocz(XMLState);
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
|
@ -333,7 +333,7 @@ static const char *css_attr_strlower(CSSBox *box, CSSIdent attr_id)
|
|||
css_strtolower(buf, sizeof(buf));
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int css_attr_int(CSSBox *box, CSSIdent attr_id, int def_val)
|
||||
{
|
||||
|
|
@ -362,26 +362,26 @@ static void html_table_borders(CSSBox *box, int border, int padding)
|
|||
while (*last_prop != NULL)
|
||||
last_prop = &(*last_prop)->next;
|
||||
if (border >= 1) {
|
||||
css_add_prop_unit(&last_prop, CSS_border_left_width,
|
||||
css_add_prop_unit(&last_prop, CSS_border_left_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
css_add_prop_unit(&last_prop, CSS_border_right_width,
|
||||
css_add_prop_unit(&last_prop, CSS_border_right_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
css_add_prop_unit(&last_prop, CSS_border_top_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
css_add_prop_unit(&last_prop, CSS_border_bottom_width,
|
||||
css_add_prop_unit(&last_prop, CSS_border_bottom_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
|
||||
css_add_prop_int(&last_prop, CSS_border_left_style,
|
||||
css_add_prop_int(&last_prop, CSS_border_left_style,
|
||||
CSS_BORDER_STYLE_RIDGE);
|
||||
css_add_prop_int(&last_prop, CSS_border_right_style,
|
||||
css_add_prop_int(&last_prop, CSS_border_right_style,
|
||||
CSS_BORDER_STYLE_RIDGE);
|
||||
css_add_prop_int(&last_prop, CSS_border_top_style,
|
||||
css_add_prop_int(&last_prop, CSS_border_top_style,
|
||||
CSS_BORDER_STYLE_RIDGE);
|
||||
css_add_prop_int(&last_prop, CSS_border_bottom_style,
|
||||
css_add_prop_int(&last_prop, CSS_border_bottom_style,
|
||||
CSS_BORDER_STYLE_RIDGE);
|
||||
}
|
||||
if (padding >= 1) {
|
||||
css_add_prop_unit(&last_prop, CSS_padding_left,
|
||||
css_add_prop_unit(&last_prop, CSS_padding_left,
|
||||
CSS_UNIT_PIXEL, padding);
|
||||
css_add_prop_unit(&last_prop, CSS_padding_right,
|
||||
CSS_UNIT_PIXEL, padding);
|
||||
|
|
@ -433,7 +433,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
arg.u.str = qe_strdup(value);
|
||||
css_add_prop(&last_prop, CSS_content_alt, &arg);
|
||||
}
|
||||
|
||||
|
||||
width = css_attr_int(box, CSS_ID_width, 0);
|
||||
if (width <= 0)
|
||||
width = DEFAULT_IMG_WIDTH;
|
||||
|
|
@ -441,9 +441,9 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
if (height <= 0)
|
||||
height = DEFAULT_IMG_HEIGHT;
|
||||
|
||||
css_add_prop_unit(&last_prop, CSS_width,
|
||||
css_add_prop_unit(&last_prop, CSS_width,
|
||||
CSS_UNIT_PIXEL, width);
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
CSS_UNIT_PIXEL, height);
|
||||
|
||||
/* border */
|
||||
|
|
@ -477,7 +477,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
}
|
||||
val = css_attr_int(box, CSS_ID_vspace, -1);
|
||||
if (val >= 0) {
|
||||
css_add_prop_unit(&last_prop, CSS_margin_top,
|
||||
css_add_prop_unit(&last_prop, CSS_margin_top,
|
||||
CSS_UNIT_PIXEL, val);
|
||||
css_add_prop_unit(&last_prop, CSS_margin_bottom,
|
||||
CSS_UNIT_PIXEL, val);
|
||||
|
|
@ -501,7 +501,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
ss->tag = CSS_ID_a;
|
||||
plast_attr = &ss->attrs;
|
||||
add_attribute(&plast_attr, CSS_ID_href, CSS_ATTR_OP_SET, "");
|
||||
|
||||
|
||||
e = add_style_entry(s->style_sheet, ss, CSS_MEDIA_ALL);
|
||||
|
||||
/* add color property */
|
||||
|
|
@ -526,10 +526,10 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
if (box->tag == CSS_ID_basefont)
|
||||
s->base_font = val;
|
||||
/* XXX: incorrect for basefont */
|
||||
css_add_prop_unit(&last_prop, CSS_font_size,
|
||||
css_add_prop_unit(&last_prop, CSS_font_size,
|
||||
CSS_UNIT_IN, get_font_size(val - 1));
|
||||
}
|
||||
|
||||
|
||||
/* color */
|
||||
value = css_attr_str(box, CSS_ID_color);
|
||||
if (value && !css_get_color(&color, value)) {
|
||||
|
|
@ -553,7 +553,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
}
|
||||
border = css_attr_int(box, CSS_ID_border, -1);
|
||||
if (border >= 0) {
|
||||
css_add_prop_unit(&last_prop, CSS_border_left_width,
|
||||
css_add_prop_unit(&last_prop, CSS_border_left_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
css_add_prop_unit(&last_prop, CSS_border_right_width,
|
||||
CSS_UNIT_PIXEL, border);
|
||||
|
|
@ -575,7 +575,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
}
|
||||
val = css_attr_int(box, CSS_ID_cellspacing, -1);
|
||||
if (val >= 0) {
|
||||
css_add_prop_unit(&last_prop, CSS_border_spacing_horizontal,
|
||||
css_add_prop_unit(&last_prop, CSS_border_spacing_horizontal,
|
||||
CSS_UNIT_PIXEL, val);
|
||||
css_add_prop_unit(&last_prop, CSS_border_spacing_vertical,
|
||||
CSS_UNIT_PIXEL, val);
|
||||
|
|
@ -618,7 +618,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
}
|
||||
}
|
||||
/* XXX: add value, but needs a css extension */
|
||||
if (box->tag == CSS_ID_ol)
|
||||
if (box->tag == CSS_ID_ol)
|
||||
val = CSS_ID_start;
|
||||
else
|
||||
val = CSS_ID_value;
|
||||
|
|
@ -655,7 +655,7 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
box->attrs = attr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parse_input:
|
||||
if (type == CSS_ID_image)
|
||||
goto parse_img;
|
||||
|
|
@ -684,20 +684,20 @@ static void html_eval_tag(XMLState *s, CSSBox *box)
|
|||
val = css_attr_int(box, CSS_ID_cols, 10);
|
||||
if (val < 1)
|
||||
val = 1;
|
||||
css_add_prop_unit(&last_prop, CSS_width,
|
||||
css_add_prop_unit(&last_prop, CSS_width,
|
||||
CSS_UNIT_EM, val << CSS_LENGTH_FRAC_BITS);
|
||||
|
||||
val = css_attr_int(box, CSS_ID_rows, 1);
|
||||
if (val < 1)
|
||||
val = 1;
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
CSS_UNIT_EM, val << CSS_LENGTH_FRAC_BITS);
|
||||
break;
|
||||
case CSS_ID_select:
|
||||
val = css_attr_int(box, CSS_ID_size, 1);
|
||||
if (val < 1)
|
||||
val = 1;
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
css_add_prop_unit(&last_prop, CSS_height,
|
||||
CSS_UNIT_EM, val << CSS_LENGTH_FRAC_BITS);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -817,7 +817,7 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
CSSAttribute *first_attr, **pattr, *attr;
|
||||
|
||||
p = buf;
|
||||
|
||||
|
||||
/* ignore XML commands */
|
||||
if (p[0] == '!' || p[0] == '?')
|
||||
return XML_STATE_TEXT;
|
||||
|
|
@ -844,10 +844,10 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
if (s->ignore_case)
|
||||
css_strtolower(tag, sizeof(tag));
|
||||
css_tag = css_new_ident(tag);
|
||||
|
||||
|
||||
/* XXX: should test html_syntax, but need more patches */
|
||||
if (s->is_html && (css_tag == CSS_ID_style ||
|
||||
css_tag == CSS_ID_script))
|
||||
if (s->is_html && (css_tag == CSS_ID_style ||
|
||||
css_tag == CSS_ID_script))
|
||||
goto pretag;
|
||||
if (eot)
|
||||
goto end_of_tag;
|
||||
|
|
@ -874,7 +874,7 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
q = value;
|
||||
while (*p != '\0' && !strchr(" \t\n\r<>", *p)) {
|
||||
ch = parse_entity(&p);
|
||||
if ((q - value) < (int)sizeof(value) - 1)
|
||||
if ((q - value) < (int)sizeof(value) - 1)
|
||||
*q++ = ch;
|
||||
}
|
||||
*q = '\0';
|
||||
|
|
@ -883,7 +883,7 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
q = value;
|
||||
while (*p != och && *p != '\0' && *p != '<') {
|
||||
ch = parse_entity(&p);
|
||||
if ((q - value) < (int)sizeof(value) - 1)
|
||||
if ((q - value) < (int)sizeof(value) - 1)
|
||||
*q++ = ch;
|
||||
}
|
||||
*q = '\0';
|
||||
|
|
@ -925,7 +925,7 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
ct++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* create the new box and add it */
|
||||
box = css_new_box(css_tag, NULL);
|
||||
box->attrs = first_attr;
|
||||
|
|
@ -936,8 +936,8 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
css_add_box(s->box, box);
|
||||
}
|
||||
s->box = box;
|
||||
|
||||
if ((s->flags & XML_DOCBOOK) &&
|
||||
|
||||
if ((s->flags & XML_DOCBOOK) &&
|
||||
css_tag == CSS_ID_programlisting) {
|
||||
pretag:
|
||||
pstrcpy(s->pretag, sizeof(s->pretag), tag);
|
||||
|
|
@ -971,7 +971,7 @@ static int parse_tag(XMLState *s, const char *buf)
|
|||
}
|
||||
if (!box1) {
|
||||
if (css_tag != CSS_ID_form)
|
||||
xml_error(s, "unmatched closing tag </%s>",
|
||||
xml_error(s, "unmatched closing tag </%s>",
|
||||
css_ident_str(css_tag));
|
||||
} else {
|
||||
html_eval_tag(s, box1);
|
||||
|
|
@ -1019,7 +1019,7 @@ static void flush_text(XMLState *s, const char *buf)
|
|||
static void flush_text_buffer(XMLState *s, int offset0, int offset1)
|
||||
{
|
||||
CSSBox *box, *box1;
|
||||
|
||||
|
||||
box = s->box;
|
||||
/* if no current box, discard */
|
||||
if (!box)
|
||||
|
|
@ -1164,12 +1164,12 @@ static int xml_parse_internal(XMLState *s, const char *buf_start, int buf_len,
|
|||
strbuf_addch(&s->str, ch);
|
||||
taglen = s->pretaglen + 2;
|
||||
len = s->str.size - taglen;
|
||||
if (len >= 0 &&
|
||||
s->str.buf[len] == '<' &&
|
||||
if (len >= 0 &&
|
||||
s->str.buf[len] == '<' &&
|
||||
s->str.buf[len + 1] == '/' &&
|
||||
!xml_tagcmp((char *)s->str.buf + len + 2, s->pretag)) {
|
||||
s->str.buf[len] = '\0';
|
||||
|
||||
|
||||
if (!xml_tagcmp(s->pretag, "style")) {
|
||||
if (s->style_sheet) {
|
||||
CSSParseState b1, *bp = &b1;
|
||||
|
|
@ -1244,7 +1244,7 @@ int xml_parse(XMLState *s, char *buf, int buf_len)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now no chars are left in the lookahead buffer so we can parse at full speed */
|
||||
len1 = buf_len - (LOOKAHEAD_SIZE - 1);
|
||||
if (len1 > 0) {
|
||||
|
|
@ -1254,7 +1254,7 @@ int xml_parse(XMLState *s, char *buf, int buf_len)
|
|||
buf_len -= len;
|
||||
buf += len;
|
||||
}
|
||||
|
||||
|
||||
/* put all the remaining chars in the lookahead buffer */
|
||||
memcpy(s->lookahead_buf, buf, buf_len);
|
||||
s->lookahead_size = buf_len;
|
||||
|
|
@ -1280,13 +1280,13 @@ CSSBox *xml_end(XMLState *s)
|
|||
|
||||
strbuf_reset(&s->str);
|
||||
root_box = s->root_box;
|
||||
|
||||
|
||||
qe_free(&s);
|
||||
return root_box;
|
||||
}
|
||||
|
||||
/* XML in edit buffer parsing */
|
||||
CSSBox *xml_parse_buffer(EditBuffer *b, int offset_start, int offset_end,
|
||||
CSSBox *xml_parse_buffer(EditBuffer *b, int offset_start, int offset_end,
|
||||
CSSStyleSheet *style_sheet, int flags,
|
||||
CSSAbortFunc *abort_func, void *abort_opaque)
|
||||
{
|
||||
|
|
@ -1295,7 +1295,7 @@ CSSBox *xml_parse_buffer(EditBuffer *b, int offset_start, int offset_end,
|
|||
int ret;
|
||||
|
||||
s = xml_begin(style_sheet, flags, abort_func, abort_opaque, b->name, NULL);
|
||||
ret = xml_parse_internal(s, NULL, offset_end - offset_start,
|
||||
ret = xml_parse_internal(s, NULL, offset_end - offset_start,
|
||||
b, offset_start);
|
||||
box = xml_end(s);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
18
ligtoqe.c
18
ligtoqe.c
|
|
@ -90,7 +90,7 @@ static int sort_func(const void *a1, const void *b1)
|
|||
int val;
|
||||
|
||||
val = a->buf_in[0] - b->buf_in[0];
|
||||
if (val == 0 &&
|
||||
if (val == 0 &&
|
||||
a->buf_in_size >= 2 && b->buf_in_size >= 2) {
|
||||
val = a->buf_in[1] - b->buf_in[1];
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
l = &ligs[nb_ligs++];
|
||||
|
||||
l->buf_in_size = 0;
|
||||
|
|
@ -171,7 +171,7 @@ int main(int argc, char **argv)
|
|||
l->buf_in[l->buf_in_size++] = strtoul(p, &p, 0);
|
||||
}
|
||||
p++;
|
||||
|
||||
|
||||
l->buf_out_size = 0;
|
||||
for (;;) {
|
||||
p = skipspaces(p);
|
||||
|
|
@ -207,7 +207,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* sort everything */
|
||||
qsort(ligs, nb_ligs, sizeof(Ligature), sort_func);
|
||||
|
||||
|
||||
outfile = fopen(lig_res_filename, "w");
|
||||
if (!outfile) {
|
||||
perror(lig_res_filename);
|
||||
|
|
@ -237,7 +237,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
subst1_count = n;
|
||||
|
||||
|
||||
/* output the ligature table (2 chars -> 1 char) */
|
||||
j = 0;
|
||||
l1 = 0;
|
||||
|
|
@ -265,9 +265,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
subst2_count = n;
|
||||
|
||||
|
||||
/* output the long ligature table */
|
||||
n = 0;
|
||||
for (i = 0; i < nb_ligs; i++) {
|
||||
|
|
@ -275,9 +275,9 @@ int main(int argc, char **argv)
|
|||
if (l->buf_in_size > 2 || l->buf_out_size > 1) {
|
||||
put_be16(outfile, l->buf_in_size);
|
||||
put_be16(outfile, l->buf_out_size);
|
||||
for (j = 0; j < l->buf_in_size; j++)
|
||||
for (j = 0; j < l->buf_in_size; j++)
|
||||
put_be16(outfile, l->buf_in[j]);
|
||||
for (j = 0; j < l->buf_out_size; j++)
|
||||
for (j = 0; j < l->buf_out_size; j++)
|
||||
put_be16(outfile, l->buf_out[j]);
|
||||
n += 2 + l->buf_in_size + l->buf_out_size;
|
||||
}
|
||||
|
|
|
|||
2
list.c
2
list.c
|
|
@ -65,7 +65,7 @@ void list_toggle_selection(EditState *s)
|
|||
unsigned char ch;
|
||||
|
||||
offset = list_get_offset(s);
|
||||
|
||||
|
||||
eb_read(s->b, offset , &ch, 1);
|
||||
if (ch == ' ')
|
||||
ch = '*';
|
||||
|
|
|
|||
176
makemode.c
176
makemode.c
|
|
@ -22,13 +22,13 @@
|
|||
|
||||
/*---------------- Makefile colors ----------------*/
|
||||
|
||||
#define MAKEFILE_TEXT QE_STYLE_DEFAULT
|
||||
#define MAKEFILE_COMMENT QE_STYLE_COMMENT
|
||||
#define MAKEFILE_STRING QE_STYLE_STRING
|
||||
#define MAKEFILE_PREPROCESS QE_STYLE_PREPROCESS
|
||||
#define MAKEFILE_TEXT QE_STYLE_DEFAULT
|
||||
#define MAKEFILE_COMMENT QE_STYLE_COMMENT
|
||||
#define MAKEFILE_STRING QE_STYLE_STRING
|
||||
#define MAKEFILE_PREPROCESS QE_STYLE_PREPROCESS
|
||||
#define MAKEFILE_TARGET QE_STYLE_FUNCTION
|
||||
#define MAKEFILE_VARIABLE QE_STYLE_VARIABLE
|
||||
#define MAKEFILE_MACRO QE_STYLE_TYPE
|
||||
#define MAKEFILE_VARIABLE QE_STYLE_VARIABLE
|
||||
#define MAKEFILE_MACRO QE_STYLE_TYPE
|
||||
|
||||
static void makefile_colorize_line(unsigned int *str, int n, int *statep,
|
||||
int state_only)
|
||||
|
|
@ -53,86 +53,86 @@ static void makefile_colorize_line(unsigned int *str, int n, int *statep,
|
|||
}
|
||||
|
||||
while (i < n) {
|
||||
switch (str[i]) {
|
||||
case '$':
|
||||
i += 1;
|
||||
j = i + 1;
|
||||
if (str[i] == '(') {
|
||||
i += 1;
|
||||
level = 1;
|
||||
for (j = i; j < n; j++) {
|
||||
if (str[j] == '(')
|
||||
level++;
|
||||
if (str[j] == ')' && --level <= 0)
|
||||
break;
|
||||
if (str[j] == ' ' || str[j] == '$') {
|
||||
/* should have function color */
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i < j)
|
||||
set_color(str + i, str + j, MAKEFILE_MACRO);
|
||||
i = j;
|
||||
continue;
|
||||
case ' ':
|
||||
case '\t':
|
||||
if (i == 0)
|
||||
j = 1;
|
||||
break;
|
||||
case '+':
|
||||
if (!j && str[i+1] == '=')
|
||||
goto variable;
|
||||
case ':':
|
||||
if (j)
|
||||
break;
|
||||
if (str[i+1] == '=')
|
||||
goto variable;
|
||||
set_color(str + j, str + i, MAKEFILE_TARGET);
|
||||
break;
|
||||
case '=':
|
||||
if (j)
|
||||
break;
|
||||
variable:
|
||||
set_color(str + j, str + i, MAKEFILE_VARIABLE);
|
||||
break;
|
||||
case '#':
|
||||
if (i > 0 && str[i - 1] == '\\')
|
||||
break;
|
||||
set_color(str + i, str + n, MAKEFILE_COMMENT);
|
||||
i = n;
|
||||
continue;
|
||||
case '!':
|
||||
/* case '.':*/
|
||||
if (i > 0)
|
||||
break;
|
||||
preprocess:
|
||||
/* scan for comment */
|
||||
for (j = i + 1; j < n; j++) {
|
||||
if (str[j] == '#')
|
||||
break;
|
||||
}
|
||||
set_color(str + i, str + j, MAKEFILE_PREPROCESS);
|
||||
i = j;
|
||||
continue;
|
||||
case '\'':
|
||||
case '`':
|
||||
case '"':
|
||||
/* parse string const */
|
||||
for (j = i + 1; j < n; j++) {
|
||||
if (str[j] == str[i]) {
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
set_color(str + i, str + j, MAKEFILE_STRING);
|
||||
i = j;
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
switch (str[i]) {
|
||||
case '$':
|
||||
i += 1;
|
||||
j = i + 1;
|
||||
if (str[i] == '(') {
|
||||
i += 1;
|
||||
level = 1;
|
||||
for (j = i; j < n; j++) {
|
||||
if (str[j] == '(')
|
||||
level++;
|
||||
if (str[j] == ')' && --level <= 0)
|
||||
break;
|
||||
if (str[j] == ' ' || str[j] == '$') {
|
||||
/* should have function color */
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i < j)
|
||||
set_color(str + i, str + j, MAKEFILE_MACRO);
|
||||
i = j;
|
||||
continue;
|
||||
case ' ':
|
||||
case '\t':
|
||||
if (i == 0)
|
||||
j = 1;
|
||||
break;
|
||||
case '+':
|
||||
if (!j && str[i+1] == '=')
|
||||
goto variable;
|
||||
case ':':
|
||||
if (j)
|
||||
break;
|
||||
if (str[i+1] == '=')
|
||||
goto variable;
|
||||
set_color(str + j, str + i, MAKEFILE_TARGET);
|
||||
break;
|
||||
case '=':
|
||||
if (j)
|
||||
break;
|
||||
variable:
|
||||
set_color(str + j, str + i, MAKEFILE_VARIABLE);
|
||||
break;
|
||||
case '#':
|
||||
if (i > 0 && str[i - 1] == '\\')
|
||||
break;
|
||||
set_color(str + i, str + n, MAKEFILE_COMMENT);
|
||||
i = n;
|
||||
continue;
|
||||
case '!':
|
||||
/* case '.':*/
|
||||
if (i > 0)
|
||||
break;
|
||||
preprocess:
|
||||
/* scan for comment */
|
||||
for (j = i + 1; j < n; j++) {
|
||||
if (str[j] == '#')
|
||||
break;
|
||||
}
|
||||
set_color(str + i, str + j, MAKEFILE_PREPROCESS);
|
||||
i = j;
|
||||
continue;
|
||||
case '\'':
|
||||
case '`':
|
||||
case '"':
|
||||
/* parse string const */
|
||||
for (j = i + 1; j < n; j++) {
|
||||
if (str[j] == str[i]) {
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
set_color(str + i, str + j, MAKEFILE_STRING);
|
||||
i = j;
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -151,8 +151,8 @@ static int makefile_mode_probe(ModeProbeData *p)
|
|||
/* check file name or extension */
|
||||
if (match_extension(base, "mk|mak")
|
||||
|| stristart(base, "makefile", NULL))
|
||||
return 70;
|
||||
|
||||
return 70;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
6
mpeg.c
6
mpeg.c
|
|
@ -52,7 +52,7 @@ static int mpeg_display(EditState *s, DisplayState *ds, int offset)
|
|||
display_eol(ds, -1, -1);
|
||||
goto the_end;
|
||||
}
|
||||
|
||||
|
||||
if (ret == 4) {
|
||||
startcode = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||
if ((startcode & 0xffffff00) == 0x00000100) {
|
||||
|
|
@ -78,7 +78,7 @@ static int mpeg_display(EditState *s, DisplayState *ds, int offset)
|
|||
offset_start = offset;
|
||||
offset += 4;
|
||||
display_printf(ds, offset_start, offset, " [%08x] ", startcode);
|
||||
|
||||
|
||||
switch (startcode) {
|
||||
case SEQ_END_CODE:
|
||||
display_printf(ds, -1, -1, "SEQ_END");
|
||||
|
|
@ -164,7 +164,7 @@ static int mpeg_mode_probe(ModeProbeData *p)
|
|||
}
|
||||
|
||||
static ModeDef mpeg_mode = {
|
||||
"mpeg",
|
||||
"mpeg",
|
||||
mode_probe: mpeg_mode_probe,
|
||||
mode_init: mpeg_mode_init,
|
||||
mode_close: NULL,
|
||||
|
|
|
|||
418
perl.c
418
perl.c
|
|
@ -24,19 +24,19 @@ static const char *perl_mode_extensions = "pl|perl|pm";
|
|||
|
||||
/*---------------- Perl colors ----------------*/
|
||||
|
||||
#define PERL_TEXT QE_STYLE_DEFAULT
|
||||
#define PERL_COMMENT QE_STYLE_COMMENT
|
||||
#define PERL_STRING QE_STYLE_STRING
|
||||
#define PERL_REGEX QE_STYLE_STRING
|
||||
#define PERL_DELIM QE_STYLE_KEYWORD
|
||||
#define PERL_KEYWORD QE_STYLE_KEYWORD
|
||||
#define PERL_VAR QE_STYLE_VARIABLE
|
||||
#define PERL_NUMBER QE_STYLE_NUMBER
|
||||
#define PERL_TEXT QE_STYLE_DEFAULT
|
||||
#define PERL_COMMENT QE_STYLE_COMMENT
|
||||
#define PERL_STRING QE_STYLE_STRING
|
||||
#define PERL_REGEX QE_STYLE_STRING
|
||||
#define PERL_DELIM QE_STYLE_KEYWORD
|
||||
#define PERL_KEYWORD QE_STYLE_KEYWORD
|
||||
#define PERL_VAR QE_STYLE_VARIABLE
|
||||
#define PERL_NUMBER QE_STYLE_NUMBER
|
||||
|
||||
#define IN_STRING1 0x01 /* single quote */
|
||||
#define IN_STRING2 0x02 /* double quote */
|
||||
#define IN_FORMAT 0x04 /* format = ... */
|
||||
#define IN_INPUT 0x08
|
||||
#define IN_STRING1 0x01 /* single quote */
|
||||
#define IN_STRING2 0x02 /* double quote */
|
||||
#define IN_FORMAT 0x04 /* format = ... */
|
||||
#define IN_INPUT 0x08
|
||||
|
||||
/* CG: bogus if multiple regions are colorized, should use signature */
|
||||
static unsigned int perl_eos[100];
|
||||
|
|
@ -45,14 +45,14 @@ static int perl_eos_len;
|
|||
static int perl_var(const unsigned int *str, int j, int n)
|
||||
{
|
||||
if (qe_isdigit(str[j]))
|
||||
return j;
|
||||
return j;
|
||||
for (; j < n; j++) {
|
||||
if (qe_isalnum_(str[j]))
|
||||
continue;
|
||||
if (str[j] == '\'' && qe_isalpha_(str[j + 1]))
|
||||
j++;
|
||||
else
|
||||
break;
|
||||
if (qe_isalnum_(str[j]))
|
||||
continue;
|
||||
if (str[j] == '\'' && qe_isalpha_(str[j + 1]))
|
||||
j++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
|
@ -60,28 +60,28 @@ static int perl_var(const unsigned int *str, int j, int n)
|
|||
static int perl_number(const unsigned int *str, int j, __unused__ int n)
|
||||
{
|
||||
if (str[j] == '0') {
|
||||
j++;
|
||||
if (str[j] == 'x' || str[j] == 'X') {
|
||||
do j++; while (qe_isxdigit(str[j]));
|
||||
return j;
|
||||
}
|
||||
if (str[j] >= '0' && str[j] <= '7') {
|
||||
j++;
|
||||
if (str[j] == 'x' || str[j] == 'X') {
|
||||
do j++; while (qe_isxdigit(str[j]));
|
||||
return j;
|
||||
}
|
||||
if (str[j] >= '0' && str[j] <= '7') {
|
||||
do j++; while (str[j] >= '0' && str[j] <= '7');
|
||||
return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
}
|
||||
while (qe_isdigit(str[j]))
|
||||
j++;
|
||||
j++;
|
||||
|
||||
if (str[j] == '.')
|
||||
do j++; while (qe_isdigit(str[j]));
|
||||
do j++; while (qe_isdigit(str[j]));
|
||||
|
||||
if (str[j] == 'E' || str[j] == 'e') {
|
||||
j++;
|
||||
if (str[j] == '-' || str[j] == '+')
|
||||
j++;
|
||||
while (qe_isdigit(str[j]))
|
||||
j++;
|
||||
j++;
|
||||
if (str[j] == '-' || str[j] == '+')
|
||||
j++;
|
||||
while (qe_isdigit(str[j]))
|
||||
j++;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
|
@ -91,11 +91,11 @@ static int perl_string(const unsigned int *str, unsigned int delim,
|
|||
int j, int n)
|
||||
{
|
||||
for (; j < n; j++) {
|
||||
if (str[j] == '\\')
|
||||
j++;
|
||||
else
|
||||
if (str[j] == delim)
|
||||
return j;
|
||||
if (str[j] == '\\')
|
||||
j++;
|
||||
else
|
||||
if (str[j] == delim)
|
||||
return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
|
@ -107,23 +107,23 @@ static void perl_colorize_line(unsigned int *str, int n, int *statep,
|
|||
int colstate = *statep;
|
||||
|
||||
if (colstate & (IN_STRING1|IN_STRING2)) {
|
||||
delim = (colstate & IN_STRING1) ? '\'' : '\"';
|
||||
i = perl_string(str, delim, j, n);
|
||||
if (i < n) {
|
||||
i++;
|
||||
colstate &= ~(IN_STRING1|IN_STRING2);
|
||||
}
|
||||
set_color(str + j, str + i, PERL_STRING);
|
||||
delim = (colstate & IN_STRING1) ? '\'' : '\"';
|
||||
i = perl_string(str, delim, j, n);
|
||||
if (i < n) {
|
||||
i++;
|
||||
colstate &= ~(IN_STRING1|IN_STRING2);
|
||||
}
|
||||
set_color(str + j, str + i, PERL_STRING);
|
||||
} else
|
||||
if (colstate & IN_FORMAT) {
|
||||
i = n;
|
||||
if (n == 1 && str[0] == '.')
|
||||
colstate &= ~IN_FORMAT;
|
||||
set_color(str + j, str + i, PERL_STRING);
|
||||
i = n;
|
||||
if (n == 1 && str[0] == '.')
|
||||
colstate &= ~IN_FORMAT;
|
||||
set_color(str + j, str + i, PERL_STRING);
|
||||
}
|
||||
if (colstate & IN_INPUT) {
|
||||
i = n;
|
||||
if (n == perl_eos_len && !umemcmp(perl_eos, str, n)) {
|
||||
i = n;
|
||||
if (n == perl_eos_len && !umemcmp(perl_eos, str, n)) {
|
||||
colstate &= ~IN_INPUT;
|
||||
set_color(str + j, str + i, PERL_KEYWORD);
|
||||
} else {
|
||||
|
|
@ -132,170 +132,170 @@ static void perl_colorize_line(unsigned int *str, int n, int *statep,
|
|||
}
|
||||
|
||||
while (i < n) {
|
||||
j = i + 1;
|
||||
c1 = str[j];
|
||||
switch (c = str[i]) {
|
||||
case '$':
|
||||
if (c1 == '^' && qe_isalpha(str[i + 2])) {
|
||||
j = i + 3;
|
||||
goto keyword;
|
||||
}
|
||||
if (c1 == '#' && qe_isalpha_(str[i + 2]))
|
||||
j++;
|
||||
else
|
||||
if (memchr("|%=-~^123456789&`'+_./\\,\"#$?*0[];!@", c1, 35)) {
|
||||
/* Special variable */
|
||||
j = i + 2;
|
||||
goto keyword;
|
||||
}
|
||||
/* FALL THRU */
|
||||
case '*':
|
||||
case '@': /* arrays */
|
||||
case '%': /* associative arrays */
|
||||
case '&':
|
||||
if (j >= n)
|
||||
break;
|
||||
s1 = perl_var(str, j, n);
|
||||
if (s1 > j) {
|
||||
set_color(str + i, str + s1, PERL_VAR);
|
||||
i = s1;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
if (c1 == '-') {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (qe_isalpha(c1) && !qe_isalnum(str[i + 2])) {
|
||||
j = i + 2;
|
||||
goto keyword;
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
set_color(str + i, str + n, PERL_COMMENT);
|
||||
i = n;
|
||||
continue;
|
||||
case '<':
|
||||
if (c1 == '<') {
|
||||
/* Should check for unary context */
|
||||
s1 = i + 2;
|
||||
c2 = str[s1];
|
||||
if (c2 == '"' || c2 == '\'' || c2 == '`') {
|
||||
s2 = perl_string(str, c2, ++s1, n);
|
||||
j = i + 1;
|
||||
c1 = str[j];
|
||||
switch (c = str[i]) {
|
||||
case '$':
|
||||
if (c1 == '^' && qe_isalpha(str[i + 2])) {
|
||||
j = i + 3;
|
||||
goto keyword;
|
||||
}
|
||||
if (c1 == '#' && qe_isalpha_(str[i + 2]))
|
||||
j++;
|
||||
else
|
||||
if (memchr("|%=-~^123456789&`'+_./\\,\"#$?*0[];!@", c1, 35)) {
|
||||
/* Special variable */
|
||||
j = i + 2;
|
||||
goto keyword;
|
||||
}
|
||||
/* FALL THRU */
|
||||
case '*':
|
||||
case '@': /* arrays */
|
||||
case '%': /* associative arrays */
|
||||
case '&':
|
||||
if (j >= n)
|
||||
break;
|
||||
s1 = perl_var(str, j, n);
|
||||
if (s1 > j) {
|
||||
set_color(str + i, str + s1, PERL_VAR);
|
||||
i = s1;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
if (c1 == '-') {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (qe_isalpha(c1) && !qe_isalnum(str[i + 2])) {
|
||||
j = i + 2;
|
||||
goto keyword;
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
set_color(str + i, str + n, PERL_COMMENT);
|
||||
i = n;
|
||||
continue;
|
||||
case '<':
|
||||
if (c1 == '<') {
|
||||
/* Should check for unary context */
|
||||
s1 = i + 2;
|
||||
c2 = str[s1];
|
||||
if (c2 == '"' || c2 == '\'' || c2 == '`') {
|
||||
s2 = perl_string(str, c2, ++s1, n);
|
||||
} else {
|
||||
s2 = perl_var(str, s1, n);
|
||||
}
|
||||
if (s2 > s1) {
|
||||
umemcpy(perl_eos, str + s1, s2 - s1);
|
||||
perl_eos_len = s2 - s1;
|
||||
colstate |= IN_INPUT;
|
||||
}
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
delim = '>';
|
||||
goto string;
|
||||
case '/':
|
||||
case '?':
|
||||
/* Should check for unary context */
|
||||
/* parse regex */
|
||||
s1 = perl_string(str, c, j, n);
|
||||
if (s1 >= n)
|
||||
break;
|
||||
set_color1(str + i, PERL_DELIM);
|
||||
set_color(str + i + 1, str + s1, PERL_REGEX);
|
||||
i = s1;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s1, str + i, PERL_DELIM);
|
||||
continue;
|
||||
case '\'':
|
||||
case '`':
|
||||
case '"':
|
||||
delim = c;
|
||||
string:
|
||||
/* parse string const */
|
||||
s1 = perl_string(str, delim, j, n);
|
||||
if (s1 >= n) {
|
||||
if (c == '\'') {
|
||||
set_color(str + i, str + n, PERL_STRING);
|
||||
i = n;
|
||||
colstate |= IN_STRING1;
|
||||
continue;
|
||||
}
|
||||
if (c == '\"') {
|
||||
set_color(str + i, str + n, PERL_STRING);
|
||||
i = n;
|
||||
colstate |= IN_STRING2;
|
||||
continue;
|
||||
}
|
||||
if (s2 > s1) {
|
||||
umemcpy(perl_eos, str + s1, s2 - s1);
|
||||
perl_eos_len = s2 - s1;
|
||||
colstate |= IN_INPUT;
|
||||
}
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
delim = '>';
|
||||
goto string;
|
||||
case '/':
|
||||
case '?':
|
||||
/* Should check for unary context */
|
||||
/* parse regex */
|
||||
s1 = perl_string(str, c, j, n);
|
||||
if (s1 >= n)
|
||||
break;
|
||||
set_color1(str + i, PERL_DELIM);
|
||||
set_color(str + i + 1, str + s1, PERL_REGEX);
|
||||
i = s1;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s1, str + i, PERL_DELIM);
|
||||
continue;
|
||||
case '\'':
|
||||
case '`':
|
||||
case '"':
|
||||
delim = c;
|
||||
string:
|
||||
/* parse string const */
|
||||
s1 = perl_string(str, delim, j, n);
|
||||
if (s1 >= n) {
|
||||
if (c == '\'') {
|
||||
set_color(str + i, str + n, PERL_STRING);
|
||||
i = n;
|
||||
colstate |= IN_STRING1;
|
||||
continue;
|
||||
}
|
||||
if (c == '\"') {
|
||||
set_color(str + i, str + n, PERL_STRING);
|
||||
i = n;
|
||||
colstate |= IN_STRING2;
|
||||
continue;
|
||||
}
|
||||
/* ` string spanning more than one line treated as
|
||||
* operator.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
s1++;
|
||||
set_color(str + i, str + s1, PERL_STRING);
|
||||
i = s1;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
s1++;
|
||||
set_color(str + i, str + s1, PERL_STRING);
|
||||
i = s1;
|
||||
continue;
|
||||
case '.':
|
||||
if (qe_isdigit(c1))
|
||||
goto number;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
if (qe_isdigit(c)) {
|
||||
number:
|
||||
j = perl_number(str, i, n);
|
||||
set_color(str + i, str + j, PERL_NUMBER);
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
if (!qe_isalpha_(c))
|
||||
break;
|
||||
j = perl_number(str, i, n);
|
||||
set_color(str + i, str + j, PERL_NUMBER);
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
if (!qe_isalpha_(c))
|
||||
break;
|
||||
|
||||
j = perl_var(str, i, n);
|
||||
if (j == i)
|
||||
break;
|
||||
j = perl_var(str, i, n);
|
||||
if (j == i)
|
||||
break;
|
||||
|
||||
if (j >= n)
|
||||
goto keyword;
|
||||
if (j >= n)
|
||||
goto keyword;
|
||||
|
||||
/* Should check for context */
|
||||
if ((j == i + 1 && (c == 'm' || c == 'q'))
|
||||
|| (j == i + 2 && c == 'q' && (c1 == 'q' || c1 == 'x'))) {
|
||||
s1 = perl_string(str, str[j], j + 1, n);
|
||||
if (s1 >= n)
|
||||
goto keyword;
|
||||
set_color(str + i, str + j + 1, PERL_DELIM);
|
||||
set_color(str + j + 1, str + s1, PERL_REGEX);
|
||||
i = s1;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s1, str + i, PERL_DELIM);
|
||||
continue;
|
||||
}
|
||||
/* Should check for context */
|
||||
if ((j == i + 1 && (c == 's' /* || c == 'y' */))
|
||||
|| (j == i + 2 && c == 't' && c1 == 'r')) {
|
||||
s1 = perl_string(str, str[j], j + 1, n);
|
||||
if (s1 >= n)
|
||||
goto keyword;
|
||||
s2 = perl_string(str, str[j], s1 + 1, n);
|
||||
if (s2 >= n)
|
||||
goto keyword;
|
||||
set_color(str + i, str + j + 1, PERL_DELIM);
|
||||
set_color(str + j + 1, str + s1, PERL_REGEX);
|
||||
set_color1(str + s1, PERL_DELIM);
|
||||
set_color(str + s1 + 1, str + s2, PERL_REGEX);
|
||||
i = s2;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s2, str + i, PERL_DELIM);
|
||||
continue;
|
||||
}
|
||||
keyword:
|
||||
/* Should check for context */
|
||||
if ((j == i + 1 && (c == 'm' || c == 'q'))
|
||||
|| (j == i + 2 && c == 'q' && (c1 == 'q' || c1 == 'x'))) {
|
||||
s1 = perl_string(str, str[j], j + 1, n);
|
||||
if (s1 >= n)
|
||||
goto keyword;
|
||||
set_color(str + i, str + j + 1, PERL_DELIM);
|
||||
set_color(str + j + 1, str + s1, PERL_REGEX);
|
||||
i = s1;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s1, str + i, PERL_DELIM);
|
||||
continue;
|
||||
}
|
||||
/* Should check for context */
|
||||
if ((j == i + 1 && (c == 's' /* || c == 'y' */))
|
||||
|| (j == i + 2 && c == 't' && c1 == 'r')) {
|
||||
s1 = perl_string(str, str[j], j + 1, n);
|
||||
if (s1 >= n)
|
||||
goto keyword;
|
||||
s2 = perl_string(str, str[j], s1 + 1, n);
|
||||
if (s2 >= n)
|
||||
goto keyword;
|
||||
set_color(str + i, str + j + 1, PERL_DELIM);
|
||||
set_color(str + j + 1, str + s1, PERL_REGEX);
|
||||
set_color1(str + s1, PERL_DELIM);
|
||||
set_color(str + s1 + 1, str + s2, PERL_REGEX);
|
||||
i = s2;
|
||||
while (++i < n && qe_isalpha(str[i]))
|
||||
continue;
|
||||
set_color(str + s2, str + i, PERL_DELIM);
|
||||
continue;
|
||||
}
|
||||
keyword:
|
||||
if (j - i == 6 && ustristart(str + i, "format", NULL)) {
|
||||
for (s1 = 0; s1 < i; s1++) {
|
||||
if (!qe_isspace(str[s1]))
|
||||
|
|
@ -306,12 +306,12 @@ static void perl_colorize_line(unsigned int *str, int n, int *statep,
|
|||
colstate |= IN_FORMAT;
|
||||
}
|
||||
}
|
||||
set_color(str + i, str + j, PERL_KEYWORD);
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
set_color(str + i, str + j, PERL_KEYWORD);
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
*statep = colstate;
|
||||
}
|
||||
|
|
@ -334,8 +334,8 @@ static int perl_mode_probe(ModeProbeData *p)
|
|||
{
|
||||
/* just check file extension */
|
||||
if (match_extension(p->filename, perl_mode_extensions))
|
||||
return 80;
|
||||
|
||||
return 80;
|
||||
|
||||
if (p->buf[0] == '#' && p->buf[1] == '!' &&
|
||||
memstr(p->buf, p->line_len, "/usr/bin/perl"))
|
||||
return 80;
|
||||
|
|
|
|||
40
qe-doc.html
40
qe-doc.html
|
|
@ -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 December, 21 2007 by texi2html 1.76 -->
|
||||
<!-- Created on January, 3 2008 by texi2html 1.76 -->
|
||||
<!--
|
||||
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
||||
Karl Berry <karl@freefriends.org>
|
||||
|
|
@ -69,7 +69,7 @@ UNIX editor. It has features that even big editors lack :
|
|||
</li><li> Can edit files of hundreds of Megabytes without being slow by using
|
||||
a highly optimized internal representation and by mmaping the file.
|
||||
|
||||
</li><li> Full <em>Unicode</em> support, including multi charset handling
|
||||
</li><li> Full <em>Unicode</em> support, including multi charset handling
|
||||
(8859-x, UTF8, SJIS, EUC-JP, ...) and bidirectional editing respecting
|
||||
the Unicode bidi algorithm. Arabic and Indic scripts handling (in
|
||||
progress).
|
||||
|
|
@ -82,10 +82,10 @@ rendering on VT100 terminals.
|
|||
</li><li> C mode: coloring with immediate update. Emacs like auto-indent.
|
||||
|
||||
</li><li> Shell mode: colorized VT100 emulation so that your shell work
|
||||
exactly as you expect. Compile mode with next/prev error.
|
||||
exactly as you expect. Compile mode with next/prev error.
|
||||
|
||||
</li><li> Input methods for most languages, including Chinese (input methods
|
||||
come from the Yudit editor).
|
||||
come from the Yudit editor).
|
||||
|
||||
</li><li> <em>Hexadecimal editing</em> mode with insertion and block commands. Unicode
|
||||
hexa editing is also supported.
|
||||
|
|
@ -97,7 +97,7 @@ rendering on VT100 terminals.
|
|||
(as XEmacs). X Input methods supported. Xft extension supported for
|
||||
anti aliased font display.
|
||||
|
||||
</li><li>
|
||||
</li><li>
|
||||
Small! Full version (including HTML/XML/CSS2/DocBook rendering and all
|
||||
charsets): 270KB big. Basic version (without bidir/unicode
|
||||
scripts/input/X11/C/Shell/HTML/dired): 88KB.
|
||||
|
|
@ -124,7 +124,7 @@ rendering on VT100 terminals.
|
|||
</tr></table>
|
||||
<h1 class="chapter"> 2. Invocation </h1>
|
||||
|
||||
<table><tr><td> </td><td><pre class="example">usage: qe [-h] [-nw] [-display display] [-geometry WxH]
|
||||
<table><tr><td> </td><td><pre class="example">usage: qe [-h] [-nw] [-display display] [-geometry WxH]
|
||||
[-fs ptsize] [filename...]
|
||||
</pre></td></tr></table>
|
||||
<dl compact="compact">
|
||||
|
|
@ -151,7 +151,7 @@ rendering on VT100 terminals.
|
|||
</dl>
|
||||
|
||||
<p>When invoked as
|
||||
</p><table><tr><td> </td><td><pre class="example">usage: ffplay
|
||||
</p><table><tr><td> </td><td><pre class="example">usage: ffplay
|
||||
</pre></td></tr></table>
|
||||
<p>QEmacs goes to <code>dired</code> mode automatically so that you can browse your
|
||||
files easily (same as <kbd>C-x C-d</kbd> key).
|
||||
|
|
@ -628,7 +628,7 @@ C-x C-d : dired
|
|||
|
||||
<p>QEmacs tries to load a configuration file in <tt>`~/.qe/config'</tt>. Each
|
||||
line of the configuration file is a QEmacs command with a C like syntax
|
||||
('-' in command name can be replaced by '_').
|
||||
('-' in command name can be replaced by '_').
|
||||
</p>
|
||||
<p>Read the example file <tt>`config.eg'</tt> to have some examples.
|
||||
</p>
|
||||
|
|
@ -678,7 +678,7 @@ common style names)
|
|||
|
||||
<p>Any <tt>`.so'</tt> file found in the qemacs resource paths is considered as
|
||||
a <em>plugin</em>. It is a piece of code containing new features for
|
||||
qemacs.
|
||||
qemacs.
|
||||
</p>
|
||||
<p>Currently, no plugins are compiled in, but you can look at the
|
||||
<tt>`plugin-example/'</tt> directory to learn how to make one.
|
||||
|
|
@ -731,12 +731,12 @@ from the Linux Kernel 2.4 module system.
|
|||
charset can be selected for each buffer with <kbd>C-x RET f</kbd>
|
||||
(<code>set-buffer-file-coding-system</code>).
|
||||
</p>
|
||||
<p>Currently, QEmacs automatically detects the UTF8 encoding.
|
||||
<p>Currently, QEmacs automatically detects the UTF8 encoding.
|
||||
</p>
|
||||
<p>Note that unlike in other editors, changing the charset of a buffer
|
||||
does not modify its content: buffers always contain bytes, and the charset
|
||||
is only used when the buffer content may be converted to characters, for
|
||||
example to display it on screen.
|
||||
example to display it on screen.
|
||||
</p>
|
||||
<p>You can use the UniHex editing mode (<kbd>M-x unihex-mode</kbd>) to see the
|
||||
Unicode values of each character in your file with the associated byte
|
||||
|
|
@ -767,7 +767,7 @@ convert the buffer <em>content</em> to another charset.
|
|||
|
||||
<p>The current input method can be changed with <kbd>C-x RET \</kbd>
|
||||
(<code>set-input-method</code>). You can switch between this input method and
|
||||
the default one with 'C-\'.
|
||||
the default one with 'C-\'.
|
||||
</p>
|
||||
<p>The input methods are currently stored in the resource file <tt>`kmaps'</tt>.
|
||||
They are extracted from the <em>Yudit</em> editor keyboard maps.
|
||||
|
|
@ -792,7 +792,7 @@ They are extracted from the <em>Yudit</em> editor keyboard maps.
|
|||
</tr></table>
|
||||
<h2 class="section"> 5.3 Bidirectional editing </h2>
|
||||
|
||||
<p>QEmacs fully supports the Unicode bidi algorithm.
|
||||
<p>QEmacs fully supports the Unicode bidi algorithm.
|
||||
</p>
|
||||
<p>By default, in text editing mode, qemacs is not in bidirectional mode (it
|
||||
may change soon). You can use 'C-x RET b' to toogle between bidi and normal
|
||||
|
|
@ -822,7 +822,7 @@ properties are supported.
|
|||
<h2 class="section"> 5.4 Unicode scripts </h2>
|
||||
|
||||
<p>Currently, QEmacs fully supports Arabic shapping. Devanagari shaping is on
|
||||
the way.
|
||||
the way.
|
||||
</p>
|
||||
<p>The resource file <tt>`ligatures'</tt> contains all the standard Unicode rules
|
||||
to handle character modifiers such as accents. It means that even if your
|
||||
|
|
@ -894,7 +894,7 @@ activated automatically when a C file is loaded.
|
|||
|
||||
|
||||
<p>Unlike other editors, QEmacs has powerful hexadecimal editing modes: all
|
||||
common commands are working these modes, including the block commands.
|
||||
common commands are working these modes, including the block commands.
|
||||
</p>
|
||||
<p>The hexadecimal mode (<kbd>M-x hex-mode</kbd>) shows both the hexa decimal
|
||||
and ascii (bytes) values. You can toggle between the hexa and ascii columns
|
||||
|
|
@ -1257,7 +1257,7 @@ activated automatically when an HTML file is loaded.
|
|||
|
||||
</li><li> column-span: QEmacs extension
|
||||
</li><li> row-span: QEmacs extension
|
||||
</li><li> content-alt: QEmacs extension. Same behavior as property 'content' but used for images
|
||||
</li><li> content-alt: QEmacs extension. Same behavior as property 'content' but used for images
|
||||
|
||||
</li><li> list-style-position
|
||||
|
||||
|
|
@ -1445,7 +1445,7 @@ data). <kbd>C-x C-d</kbd> can be used to have an interactive file viewer.
|
|||
<p>Available commands:
|
||||
</p>
|
||||
<dl compact="compact">
|
||||
<dt> <kbd>t</kbd> </dt>
|
||||
<dt> <kbd>t</kbd></dt>
|
||||
<dd><p>(<samp>`M-x image-rotate'</samp>) Rotate right image by 90 degrees.
|
||||
</p></dd>
|
||||
<dt> <kbd>f</kbd></dt>
|
||||
|
|
@ -1463,7 +1463,7 @@ pixels. The <samp>`transparent'</samp> color displayed a <samp>`gimp'</samp> lik
|
|||
</p></dd>
|
||||
</dl>
|
||||
|
||||
<p>Status information:
|
||||
<p>Status information:
|
||||
</p>
|
||||
<ul class="toc">
|
||||
<li> The image resolution is displayed as <samp>`NxM'</samp>.
|
||||
|
|
@ -1810,7 +1810,7 @@ linked plugins.
|
|||
</tr></table>
|
||||
<h1>About This Document</h1>
|
||||
<p>
|
||||
This document was generated by <em>Charlie Gordon</em> on <em>December, 21 2007</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, 3 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 @@ linked plugins.
|
|||
<hr size="1">
|
||||
<p>
|
||||
<font size="-1">
|
||||
This document was generated by <em>Charlie Gordon</em> on <em>December, 21 2007</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, 3 2008</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
|
||||
</font>
|
||||
<br>
|
||||
|
||||
|
|
|
|||
38
qe-doc.texi
38
qe-doc.texi
|
|
@ -21,7 +21,7 @@ UNIX editor. It has features that even big editors lack :
|
|||
@item Can edit files of hundreds of Megabytes without being slow by using
|
||||
a highly optimized internal representation and by mmaping the file.
|
||||
|
||||
@item Full @emph{Unicode} support, including multi charset handling
|
||||
@item Full @emph{Unicode} support, including multi charset handling
|
||||
(8859-x, UTF8, SJIS, EUC-JP, ...) and bidirectional editing respecting
|
||||
the Unicode bidi algorithm. Arabic and Indic scripts handling (in
|
||||
progress).
|
||||
|
|
@ -34,10 +34,10 @@ rendering on VT100 terminals.
|
|||
@item C mode: coloring with immediate update. Emacs like auto-indent.
|
||||
|
||||
@item Shell mode: colorized VT100 emulation so that your shell work
|
||||
exactly as you expect. Compile mode with next/prev error.
|
||||
exactly as you expect. Compile mode with next/prev error.
|
||||
|
||||
@item Input methods for most languages, including Chinese (input methods
|
||||
come from the Yudit editor).
|
||||
come from the Yudit editor).
|
||||
|
||||
@item @emph{Hexadecimal editing} mode with insertion and block commands. Unicode
|
||||
hexa editing is also supported.
|
||||
|
|
@ -49,7 +49,7 @@ rendering on VT100 terminals.
|
|||
(as XEmacs). X Input methods supported. Xft extension supported for
|
||||
anti aliased font display.
|
||||
|
||||
@item
|
||||
@item
|
||||
Small! Full version (including HTML/XML/CSS2/DocBook rendering and all
|
||||
charsets): 270KB big. Basic version (without bidir/unicode
|
||||
scripts/input/X11/C/Shell/HTML/dired): 88KB.
|
||||
|
|
@ -59,7 +59,7 @@ rendering on VT100 terminals.
|
|||
@chapter Invocation
|
||||
|
||||
@example
|
||||
usage: qe [-h] [-nw] [-display display] [-geometry WxH]
|
||||
usage: qe [-h] [-nw] [-display display] [-geometry WxH]
|
||||
[-fs ptsize] [filename...]
|
||||
@end example
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ set default font size
|
|||
|
||||
When invoked as
|
||||
@example
|
||||
usage: ffplay
|
||||
usage: ffplay
|
||||
@end example
|
||||
|
||||
QEmacs goes to @code{dired} mode automatically so that you can browse your
|
||||
|
|
@ -280,7 +280,7 @@ All resources and configuration files are looked in the following paths:
|
|||
|
||||
QEmacs tries to load a configuration file in @file{~/.qe/config}. Each
|
||||
line of the configuration file is a QEmacs command with a C like syntax
|
||||
('-' in command name can be replaced by '_').
|
||||
('-' in command name can be replaced by '_').
|
||||
|
||||
Read the example file @file{config.eg} to have some examples.
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ common style names)
|
|||
|
||||
Any @file{.so} file found in the qemacs resource paths is considered as
|
||||
a @dfn{plugin}. It is a piece of code containing new features for
|
||||
qemacs.
|
||||
qemacs.
|
||||
|
||||
Currently, no plugins are compiled in, but you can look at the
|
||||
@file{plugin-example/} directory to learn how to make one.
|
||||
|
|
@ -325,12 +325,12 @@ QEmacs supports many common charsets including UTF8, shift JIS and EUC-JP. A
|
|||
charset can be selected for each buffer with @kbd{C-x RET f}
|
||||
(@code{set-buffer-file-coding-system}).
|
||||
|
||||
Currently, QEmacs automatically detects the UTF8 encoding.
|
||||
Currently, QEmacs automatically detects the UTF8 encoding.
|
||||
|
||||
Note that unlike in other editors, changing the charset of a buffer
|
||||
does not modify its content: buffers always contain bytes, and the charset
|
||||
is only used when the buffer content may be converted to characters, for
|
||||
example to display it on screen.
|
||||
example to display it on screen.
|
||||
|
||||
You can use the UniHex editing mode (@kbd{M-x unihex-mode}) to see the
|
||||
Unicode values of each character in your file with the associated byte
|
||||
|
|
@ -343,14 +343,14 @@ convert the buffer @emph{content} to another charset.
|
|||
|
||||
The current input method can be changed with @kbd{C-x RET \}
|
||||
(@code{set-input-method}). You can switch between this input method and
|
||||
the default one with 'C-\'.
|
||||
the default one with 'C-\'.
|
||||
|
||||
The input methods are currently stored in the resource file @file{kmaps}.
|
||||
They are extracted from the @emph{Yudit} editor keyboard maps.
|
||||
|
||||
@section Bidirectional editing
|
||||
|
||||
QEmacs fully supports the Unicode bidi algorithm.
|
||||
QEmacs fully supports the Unicode bidi algorithm.
|
||||
|
||||
By default, in text editing mode, qemacs is not in bidirectional mode (it
|
||||
may change soon). You can use 'C-x RET b' to toogle between bidi and normal
|
||||
|
|
@ -362,7 +362,7 @@ properties are supported.
|
|||
@section Unicode scripts
|
||||
|
||||
Currently, QEmacs fully supports Arabic shapping. Devanagari shaping is on
|
||||
the way.
|
||||
the way.
|
||||
|
||||
The resource file @file{ligatures} contains all the standard Unicode rules
|
||||
to handle character modifiers such as accents. It means that even if your
|
||||
|
|
@ -380,7 +380,7 @@ activated automatically when a C file is loaded.
|
|||
|
||||
|
||||
Unlike other editors, QEmacs has powerful hexadecimal editing modes: all
|
||||
common commands are working these modes, including the block commands.
|
||||
common commands are working these modes, including the block commands.
|
||||
|
||||
The hexadecimal mode (@kbd{M-x hex-mode}) shows both the hexa decimal
|
||||
and ascii (bytes) values. You can toggle between the hexa and ascii columns
|
||||
|
|
@ -581,7 +581,7 @@ The following properties are partially (see comments) or totally supported:
|
|||
|
||||
@item column-span: QEmacs extension
|
||||
@item row-span: QEmacs extension
|
||||
@item content-alt: QEmacs extension. Same behavior as property 'content' but used for images
|
||||
@item content-alt: QEmacs extension. Same behavior as property 'content' but used for images
|
||||
|
||||
@item list-style-position
|
||||
|
||||
|
|
@ -734,7 +734,7 @@ data). @kbd{C-x C-d} can be used to have an interactive file viewer.
|
|||
Available commands:
|
||||
|
||||
@table @kbd
|
||||
@item t
|
||||
@item t
|
||||
(@samp{M-x image-rotate}) Rotate right image by 90 degrees.
|
||||
@item f
|
||||
(@samp{M-x toggle-full-screen}) Toggle full screen mode
|
||||
|
|
@ -748,7 +748,7 @@ color. The background is only visible if the image contains transparent
|
|||
pixels. The @samp{transparent} color displayed a @samp{gimp} like grid.
|
||||
@end table
|
||||
|
||||
Status information:
|
||||
Status information:
|
||||
|
||||
@itemize
|
||||
@item The image resolution is displayed as @samp{NxM}.
|
||||
|
|
@ -824,7 +824,7 @@ usually included in the linux distributions. You can find it at
|
|||
|
||||
QEmacs knows three basic font families:
|
||||
|
||||
@itemize
|
||||
@itemize
|
||||
@item @samp{sans} for sans serif fonts.
|
||||
@item @samp{serif} for serif fonts.
|
||||
@item @samp{fixed} for fixed or monospace fonts.
|
||||
|
|
@ -873,7 +873,7 @@ Hangul.
|
|||
|
||||
@section Invocation
|
||||
|
||||
@example
|
||||
@example
|
||||
usage: html2png [-h] [-x] [-w width] [-o outfile] [-f charset] infile
|
||||
@end example
|
||||
|
||||
|
|
|
|||
74
qe.h
74
qe.h
|
|
@ -119,7 +119,7 @@ typedef struct QEmacsState QEmacsState;
|
|||
/* low level I/O events */
|
||||
void set_read_handler(int fd, void (*cb)(void *opaque), void *opaque);
|
||||
void set_write_handler(int fd, void (*cb)(void *opaque), void *opaque);
|
||||
int set_pid_handler(int pid,
|
||||
int set_pid_handler(int pid,
|
||||
void (*cb)(void *opaque, int status), void *opaque);
|
||||
void url_exit(void);
|
||||
void register_bottom_half(void (*cb)(void *opaque), void *opaque);
|
||||
|
|
@ -166,12 +166,14 @@ typedef struct FindFileState FindFileState;
|
|||
FindFileState *find_file_open(const char *path, const char *pattern);
|
||||
int find_file_next(FindFileState *s, char *filename, int filename_size_max);
|
||||
void find_file_close(FindFileState *s);
|
||||
void canonize_path(char *buf, int buf_size, const char *path);
|
||||
void canonize_absolute_path(char *buf, int buf_size, const char *path1);
|
||||
void canonicalize_path(char *buf, int buf_size, const char *path);
|
||||
void canonicalize_absolute_path(char *buf, int buf_size, const char *path1);
|
||||
const char *basename(const char *filename);
|
||||
const char *extension(const char *filename);
|
||||
char *get_dirname(char *dest, int size, const char *file);
|
||||
int match_extension(const char *filename, const char *extlist);
|
||||
int remove_slash(char *buf);
|
||||
int append_slash(char *buf, int buf_size);
|
||||
char *makepath(char *buf, int buf_size, const char *path, const char *filename);
|
||||
void splitpath(char *dirname, int dirname_size,
|
||||
char *filename, int filename_size, const char *pathname);
|
||||
|
|
@ -410,7 +412,7 @@ typedef struct QECharset {
|
|||
const unsigned char **);
|
||||
/* return NULL if cannot encode. Currently no state since speed is
|
||||
not critical yet */
|
||||
unsigned char *(*encode_func)(struct QECharset *, unsigned char *, int);
|
||||
unsigned char *(*encode_func)(struct QECharset *, unsigned char *, int);
|
||||
u8 table_alloc; /* true if CharsetDecodeState.table must be malloced */
|
||||
/* private data for some charsets */
|
||||
u8 eol_char; /* 0x0A for ASCII, 0x25 for EBCDIC */
|
||||
|
|
@ -425,10 +427,10 @@ extern QECharset charset_vt100; /* used for the tty output */
|
|||
|
||||
typedef struct CharsetDecodeState {
|
||||
/* 256 ushort table for hyper fast decoding */
|
||||
unsigned short *table;
|
||||
unsigned short *table;
|
||||
/* slower decode function for complicated cases */
|
||||
int (*decode_func)(struct CharsetDecodeState *,
|
||||
const unsigned char **);
|
||||
const unsigned char **);
|
||||
QECharset *charset;
|
||||
} CharsetDecodeState;
|
||||
|
||||
|
|
@ -445,7 +447,7 @@ int utf8_encode(char *q, int c);
|
|||
int utf8_decode(const char **pp);
|
||||
extern unsigned char utf8_length[256];
|
||||
|
||||
int utf8_to_unicode(unsigned int *dest, int dest_length,
|
||||
int utf8_to_unicode(unsigned int *dest, int dest_length,
|
||||
const char *str);
|
||||
|
||||
void charset_completion(StringArray *cs, const char *charset_str);
|
||||
|
|
@ -619,7 +621,7 @@ void qe_ungrab_keys(void);
|
|||
#define PG_VALID_COLORS 0x0008 /* color state is valid */
|
||||
|
||||
typedef struct Page {
|
||||
int size; /* data size */
|
||||
int size; /* data size */
|
||||
u8 *data;
|
||||
int flags;
|
||||
/* the following are needed to handle line / column computation */
|
||||
|
|
@ -681,7 +683,7 @@ struct EditBuffer {
|
|||
/* buffer data type (default is raw) */
|
||||
struct EditBufferDataType *data_type;
|
||||
void *data; /* associated buffer data, used if data_type != raw_data */
|
||||
|
||||
|
||||
/* charset handling */
|
||||
CharsetDecodeState charset_state;
|
||||
QECharset *charset;
|
||||
|
|
@ -697,7 +699,7 @@ struct EditBuffer {
|
|||
|
||||
/* asynchronous loading/saving support */
|
||||
struct BufferIOState *io_state;
|
||||
|
||||
|
||||
/* used during loading */
|
||||
int probed;
|
||||
|
||||
|
|
@ -710,7 +712,7 @@ struct EditBuffer {
|
|||
/* CG: should instead keep a pointer to last window using this
|
||||
* buffer, even if no longer on screen
|
||||
*/
|
||||
struct ModeSavedData *saved_data;
|
||||
struct ModeSavedData *saved_data;
|
||||
|
||||
EditBuffer *next; /* next editbuffer in qe_state buffer list */
|
||||
char name[MAX_BUFFERNAME_SIZE]; /* buffer name */
|
||||
|
|
@ -741,8 +743,8 @@ void eb_trace_bytes(const void *buf, int size, int state);
|
|||
void eb_init(void);
|
||||
int eb_read(EditBuffer *b, int offset, void *buf, int size);
|
||||
void eb_write(EditBuffer *b, int offset, const void *buf, int size);
|
||||
void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
||||
EditBuffer *src, int src_offset,
|
||||
void eb_insert_buffer(EditBuffer *dest, int dest_offset,
|
||||
EditBuffer *src, int src_offset,
|
||||
int size);
|
||||
void eb_insert(EditBuffer *b, int offset, const void *buf, int size);
|
||||
void eb_delete(EditBuffer *b, int offset, int size);
|
||||
|
|
@ -857,14 +859,14 @@ extern EditBufferDataType raw_data_type;
|
|||
/* qe.c */
|
||||
|
||||
/* colorize & transform a line, lower level then ColorizeFunc */
|
||||
typedef int (*GetColorizedLineFunc)(EditState *s,
|
||||
typedef int (*GetColorizedLineFunc)(EditState *s,
|
||||
unsigned int *buf, int buf_size,
|
||||
int offset1, int line_num);
|
||||
|
||||
/* colorize a line : this function modifies buf to set the char
|
||||
styles. 'buf' is guaranted to have one more char after its len
|
||||
(it is either '\n' or '\0') */
|
||||
typedef void (*ColorizeFunc)(unsigned int *buf, int len,
|
||||
typedef void (*ColorizeFunc)(unsigned int *buf, int len,
|
||||
int *colorize_state_ptr, int state_only);
|
||||
|
||||
/* contains all the information necessary to uniquely identify a line,
|
||||
|
|
@ -888,7 +890,7 @@ enum WrapType {
|
|||
struct EditState {
|
||||
int offset; /* offset of the cursor */
|
||||
/* text display state */
|
||||
int offset_top;
|
||||
int offset_top;
|
||||
int y_disp; /* virtual position of the displayed text */
|
||||
int x_disp[2]; /* position for LTR and RTL text resp. */
|
||||
int minibuf; /* true if single line editing */
|
||||
|
|
@ -927,12 +929,12 @@ struct EditState {
|
|||
EditBuffer *b;
|
||||
|
||||
/* state before line n, one byte per line */
|
||||
unsigned char *colorize_states;
|
||||
unsigned char *colorize_states;
|
||||
int colorize_nb_lines;
|
||||
int colorize_nb_valid_lines;
|
||||
/* maximum valid offset, INT_MAX if not modified. Needed to invalide
|
||||
'colorize_states' */
|
||||
int colorize_max_valid_offset;
|
||||
int colorize_max_valid_offset;
|
||||
|
||||
int busy; /* true if editing cannot be done if the window
|
||||
(e.g. the parser HTML is parsing the buffer to
|
||||
|
|
@ -1064,14 +1066,14 @@ enum QEStyle {
|
|||
typedef struct QEStyleDef {
|
||||
const char *name;
|
||||
/* if any style is 0, then default edit style applies */
|
||||
QEColor fg_color, bg_color;
|
||||
QEColor fg_color, bg_color;
|
||||
short font_style;
|
||||
short font_size;
|
||||
} QEStyleDef;
|
||||
|
||||
/* CG: Should register styles as well */
|
||||
extern QEStyleDef qe_styles[QE_STYLE_NB];
|
||||
|
||||
|
||||
/* QEmacs state structure */
|
||||
|
||||
#define NB_YANK_BUFFERS 10
|
||||
|
|
@ -1246,7 +1248,7 @@ CmdDef *qe_find_cmd(const char *cmd_name);
|
|||
typedef struct TextFragment {
|
||||
unsigned short embedding_level;
|
||||
short width; /* fragment width */
|
||||
short ascent;
|
||||
short ascent;
|
||||
short descent;
|
||||
short style; /* style index */
|
||||
short line_index; /* index in line_buf */
|
||||
|
|
@ -1276,17 +1278,17 @@ typedef struct DisplayState {
|
|||
int cur_hex_mode; /* true if current char is in hex mode */
|
||||
int hex_mode; /* hex mode from edit_state, -1 if all chars wanted */
|
||||
void *cursor_opaque;
|
||||
int (*cursor_func)(struct DisplayState *,
|
||||
int (*cursor_func)(struct DisplayState *,
|
||||
int offset1, int offset2, int line_num,
|
||||
int x, int y, int w, int h, int hex_mode);
|
||||
int eod; /* end of display requested */
|
||||
/* if base == RTL, then all x are equivalent to width - x */
|
||||
DirType base;
|
||||
DirType base;
|
||||
int embedding_level_max;
|
||||
int wrap;
|
||||
int eol_reached;
|
||||
EditState *edit_state;
|
||||
|
||||
|
||||
/* fragment buffers */
|
||||
TextFragment fragments[MAX_SCREEN_WIDTH];
|
||||
int nb_fragments;
|
||||
|
|
@ -1294,9 +1296,9 @@ typedef struct DisplayState {
|
|||
int word_index; /* fragment index of the start of the current
|
||||
word */
|
||||
/* line char (in fact glyph) buffer */
|
||||
unsigned int line_chars[MAX_SCREEN_WIDTH];
|
||||
unsigned int line_chars[MAX_SCREEN_WIDTH];
|
||||
short line_char_widths[MAX_SCREEN_WIDTH];
|
||||
int line_offsets[MAX_SCREEN_WIDTH][2];
|
||||
int line_offsets[MAX_SCREEN_WIDTH][2];
|
||||
unsigned char line_hex_mode[MAX_SCREEN_WIDTH];
|
||||
int line_index;
|
||||
|
||||
|
|
@ -1351,13 +1353,13 @@ static inline void set_color1(unsigned int *p, int style) {
|
|||
|
||||
typedef struct InputMethod {
|
||||
const char *name;
|
||||
/* input match returns:
|
||||
/* input match returns:
|
||||
n > 0: number of code points in replacement found for a sequence
|
||||
of keystrokes in buf. number of keystrokes in match was stored
|
||||
in '*match_len_ptr'.
|
||||
INPUTMETHOD_NOMATCH if no match was found
|
||||
INPUTMETHOD_NOMATCH if no match was found
|
||||
INPUTMETHOD_MORECHARS if more chars need to be typed to find
|
||||
a suitable completion
|
||||
a suitable completion
|
||||
*/
|
||||
int (*input_match)(int *match_buf, int match_buf_size,
|
||||
int *match_len_ptr, const u8 *data,
|
||||
|
|
@ -1405,7 +1407,7 @@ void register_completion(const char *name, CompletionFunc completion_func);
|
|||
//void vput_status(EditState *s, const char *fmt, va_list ap);
|
||||
void put_status(EditState *s, const char *fmt, ...) __attr_printf(2,3);
|
||||
void put_error(EditState *s, const char *fmt, ...) __attr_printf(2,3);
|
||||
void minibuffer_edit(const char *input, const char *prompt,
|
||||
void minibuffer_edit(const char *input, const char *prompt,
|
||||
StringArray *hist, CompletionFunc completion_func,
|
||||
void (*cb)(void *opaque, char *buf), void *opaque);
|
||||
void command_completion(StringArray *cs, const char *input);
|
||||
|
|
@ -1561,7 +1563,7 @@ void do_yank_pop(EditState *s);
|
|||
void do_exchange_point_and_mark(EditState *s);
|
||||
QECharset *read_charset(EditState *s, const char *charset_str);
|
||||
void do_set_buffer_file_coding_system(EditState *s, const char *charset_str);
|
||||
void do_convert_buffer_file_coding_system(EditState *s,
|
||||
void do_convert_buffer_file_coding_system(EditState *s,
|
||||
const char *charset_str);
|
||||
void do_toggle_bidir(EditState *s);
|
||||
void do_toggle_line_numbers(EditState *s);
|
||||
|
|
@ -1576,11 +1578,11 @@ void display_window_borders(EditState *e);
|
|||
QEStyleDef *find_style(const char *name);
|
||||
void style_completion(StringArray *cs, const char *input);
|
||||
void do_define_color(EditState *e, const char *name, const char *value);
|
||||
void do_set_style(EditState *e, const char *stylestr,
|
||||
void do_set_style(EditState *e, const char *stylestr,
|
||||
const char *propstr, const char *value);
|
||||
void do_set_display_size(EditState *s, int w, int h);
|
||||
void do_toggle_mode_line(EditState *s);
|
||||
void do_set_system_font(EditState *s, const char *qe_font_name,
|
||||
void do_set_system_font(EditState *s, const char *qe_font_name,
|
||||
const char *system_fonts);
|
||||
void call_func(CmdSig sig, CmdProto func, int nb_args, CmdArg *args,
|
||||
unsigned char *args_type);
|
||||
|
|
@ -1608,7 +1610,7 @@ void do_find_alternate_file(EditState *s, const char *filename);
|
|||
void do_load_file_from_path(EditState *s, const char *filename);
|
||||
void do_set_visited_file_name(EditState *s, const char *filename,
|
||||
const char *renamefile);
|
||||
int eb_search(EditBuffer *b, int offset, int dir, u8 *buf, int size,
|
||||
int eb_search(EditBuffer *b, int offset, int dir, u8 *buf, int size,
|
||||
int flags, CSSAbortFunc *abort_func, void *abort_opaque);
|
||||
int search_abort_func(void *opaque);
|
||||
void do_doctor(EditState *s);
|
||||
|
|
@ -1643,7 +1645,7 @@ void get_style(EditState *e, QEStyleDef *style, int style_index);
|
|||
void do_dired(EditState *s);
|
||||
|
||||
/* c_mode.c */
|
||||
void c_colorize_line(unsigned int *buf, int len,
|
||||
void c_colorize_line(unsigned int *buf, int len,
|
||||
int *colorize_state_ptr, int state_only);
|
||||
|
||||
/* xml.c */
|
||||
|
|
@ -1653,7 +1655,7 @@ int xml_mode_probe(ModeProbeData *p1);
|
|||
|
||||
extern ModeDef html_mode;
|
||||
|
||||
int gxml_mode_init(EditState *s,
|
||||
int gxml_mode_init(EditState *s,
|
||||
ModeSavedData *saved_data,
|
||||
int is_html, const char *default_stylesheet);
|
||||
|
||||
|
|
|
|||
26
qeconfig.h
26
qeconfig.h
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* default qemacs configuration
|
||||
* default qemacs configuration
|
||||
*/
|
||||
static CmdDef basic_commands[] = {
|
||||
|
||||
|
|
@ -63,11 +63,11 @@ static CmdDef basic_commands[] = {
|
|||
do_exchange_point_and_mark)
|
||||
CMD0( KEY_CTRLX('h'), KEY_NONE, "mark-whole-buffer", do_mark_whole_buffer)
|
||||
CMD0( KEY_META(KEY_CTRL('w')) , KEY_NONE,
|
||||
"append-next-kill", do_append_next_kill)
|
||||
"append-next-kill", do_append_next_kill)
|
||||
CMDV( KEY_CTRL('k'), KEY_NONE, "kill-line", do_kill_line, ESi, 1, "*v" )
|
||||
CMDV( KEY_NONE, KEY_NONE,
|
||||
"kill-beginning-of-line", do_kill_line, ESi, -1, "*v" )
|
||||
CMDV( KEY_META(KEY_DEL) , KEY_META(KEY_BS),
|
||||
"kill-beginning-of-line", do_kill_line, ESi, -1, "*v" )
|
||||
CMDV( KEY_META(KEY_DEL) , KEY_META(KEY_BS),
|
||||
"backward-kill-word", do_kill_word, ESi, -1, "*v" )
|
||||
CMDV( KEY_META('d') , KEY_NONE, "kill-word", do_kill_word, ESi, 1, "*v" )
|
||||
CMDV( KEY_CTRL('w'), KEY_NONE, "kill-region", do_kill_region, ESi, 1, "*v" )
|
||||
|
|
@ -79,7 +79,7 @@ static CmdDef basic_commands[] = {
|
|||
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('f')), KEY_NONE, "find-file", do_find_file, ESs,
|
||||
"s{Find file: }[file]|file|") /* u? */
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('v')), KEY_NONE, "find-alternate-file",
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('v')), KEY_NONE, "find-alternate-file",
|
||||
do_find_alternate_file, ESs,
|
||||
"s{Find alternate file: }[file]|file|") /* u? */
|
||||
CMD_( KEY_CTRLX('i'), KEY_NONE, "insert-file", do_insert_file, ESs,
|
||||
|
|
@ -93,7 +93,7 @@ static CmdDef basic_commands[] = {
|
|||
"s{Switch to buffer: }[buffer]|buffer|")
|
||||
CMD_( KEY_CTRLX('k'), KEY_NONE, "kill-buffer", do_kill_buffer, ESs,
|
||||
"s{Kill buffer: }[buffer]|buffer|")
|
||||
CMD0( KEY_CTRLX(KEY_CTRL('q')), KEY_NONE, "toggle-read-only",
|
||||
CMD0( KEY_CTRLX(KEY_CTRL('q')), KEY_NONE, "toggle-read-only",
|
||||
do_toggle_read_only)
|
||||
CMD_( KEY_META('~'), KEY_NONE, "not-modified", do_not_modified, ESi, "ui")
|
||||
CMD_( KEY_NONE, KEY_NONE, "set-visited-file-name",
|
||||
|
|
@ -181,7 +181,7 @@ static CmdDef basic_commands[] = {
|
|||
|
||||
CMD0( KEY_CTRLH(KEY_CTRL('h')), KEY_F1, "help-for-help", do_help_for_help)
|
||||
CMD0( KEY_CTRLH('b'), KEY_NONE, "describe-bindings", do_describe_bindings)
|
||||
CMD0( KEY_CTRLH('c'), KEY_CTRLH('k'), "describe-key-briefly",
|
||||
CMD0( KEY_CTRLH('c'), KEY_CTRLH('k'), "describe-key-briefly",
|
||||
do_describe_key_briefly)
|
||||
|
||||
/*---------------- International ----------------*/
|
||||
|
|
@ -196,15 +196,15 @@ static CmdDef basic_commands[] = {
|
|||
CMD_( KEY_CTRLXRET(KEY_CTRL('\\')), KEY_NONE, "set-input-method",
|
||||
do_set_input_method, ESs,
|
||||
"s{Input method: }[input]")
|
||||
CMD0( KEY_CTRLX(KEY_CTRL('\\')), KEY_NONE,
|
||||
CMD0( KEY_CTRLX(KEY_CTRL('\\')), KEY_NONE,
|
||||
"switch-input-method", do_switch_input_method)
|
||||
|
||||
/*---------------- Styles & display ----------------*/
|
||||
CMD_( KEY_NONE, KEY_NONE, "define-color", do_define_color, ESss,
|
||||
"s{Color name: }[color]|color|s{Color value: }[color]|color|")
|
||||
CMD_( KEY_NONE, KEY_NONE, "set-style", do_set_style, ESsss,
|
||||
"s{Style: }[style]|style|"
|
||||
"s{CSS Property Name: }"
|
||||
"s{Style: }[style]|style|"
|
||||
"s{CSS Property Name: }"
|
||||
"s{CSS Property Value: }")
|
||||
CMD_( KEY_NONE, KEY_NONE, "set-display-size", do_set_display_size, ESii,
|
||||
"i{Width: }i{Height: }")
|
||||
|
|
@ -213,7 +213,7 @@ static CmdDef basic_commands[] = {
|
|||
|
||||
/*---------------- Miscellaneous ----------------*/
|
||||
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('c')), KEY_NONE, "exit-qemacs",
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('c')), KEY_NONE, "exit-qemacs",
|
||||
do_exit_qemacs, ESi, "ui")
|
||||
CMD0( KEY_CTRL('l'), KEY_NONE, "refresh", do_refresh_complete)
|
||||
CMD0( KEY_NONE, KEY_NONE, "doctor", do_doctor)
|
||||
|
|
@ -238,7 +238,7 @@ static CmdDef basic_commands[] = {
|
|||
"s{Change default directory: }[file]|file|")
|
||||
CMD_( KEY_NONE, KEY_NONE, "set-mode", do_cmd_set_mode, ESs,
|
||||
"s{Set mode: }[mode]")
|
||||
|
||||
|
||||
/* tab & indent */
|
||||
CMD_( KEY_NONE, KEY_NONE, "set-tab-width", do_set_tab_width, ESi,
|
||||
"ui{Tab width: }")
|
||||
|
|
@ -254,7 +254,7 @@ static CmdDef basic_commands[] = {
|
|||
"s{Configuration file: }[file]|file|")
|
||||
CMD_( KEY_NONE, KEY_NONE, "load-qerc", do_load_qerc, ESs,
|
||||
"s{path: }[file]|file|")
|
||||
|
||||
|
||||
CMD_DEF_END,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
0, 0)
|
||||
STYLE_DEF(QE_STYLE_NUMBER, "number",
|
||||
QERGB(0xf8, 0xd8, 0xb0), COLOR_TRANSPARENT,
|
||||
0, 0)
|
||||
0, 0)
|
||||
STYLE_DEF(QE_STYLE_FUNCTION, "function",
|
||||
QERGB(0x80, 0xcc, 0xf0), COLOR_TRANSPARENT,
|
||||
0, 0)
|
||||
|
|
|
|||
36
qfribidi.c
36
qfribidi.c
|
|
@ -1,8 +1,8 @@
|
|||
/* FriBidi - Library of BiDi algorithm
|
||||
* Copyright (C) 1999 Dov Grobgeld
|
||||
*
|
||||
*
|
||||
* The optimizations to reduce the code size from 13 KB to 3 KB and
|
||||
* the embed/override hack handling are
|
||||
* the embed/override hack handling are
|
||||
* Copyright (C) 2000 Fabrice Bellard.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -44,10 +44,10 @@
|
|||
/* except for AB <-> BB, 3C <-> 3E, 5B <-> 5D, 7B <-> 7D which have
|
||||
their high order bit set */
|
||||
static const unsigned short mirror_table[] = {
|
||||
0x0028, 0x803C, 0x805B, 0x807B, 0x80AB, 0x2039, 0x2045, 0x207D,
|
||||
0x208D, 0x2264, 0x2266, 0x2268, 0x226A, 0x226E, 0x2270, 0x2272,
|
||||
0x2274, 0x22A2, 0x22C9, 0x22CB, 0x22D6, 0x22D8, 0x22DC, 0x22E6,
|
||||
0x22F0, 0x2308, 0x230A, 0x2329, 0x3008, 0x300A, 0x300C, 0x300E,
|
||||
0x0028, 0x803C, 0x805B, 0x807B, 0x80AB, 0x2039, 0x2045, 0x207D,
|
||||
0x208D, 0x2264, 0x2266, 0x2268, 0x226A, 0x226E, 0x2270, 0x2272,
|
||||
0x2274, 0x22A2, 0x22C9, 0x22CB, 0x22D6, 0x22D8, 0x22DC, 0x22E6,
|
||||
0x22F0, 0x2308, 0x230A, 0x2329, 0x3008, 0x300A, 0x300C, 0x300E,
|
||||
0x3010, 0x3014, 0x3016, 0x3018, 0x301A,
|
||||
};
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ static const unsigned short property_start[366] = {
|
|||
0xfe5f, 0xfe60, 0xfe62, 0xfe64, 0xfe69, 0xfe6b, 0xfe70, 0xfeff,
|
||||
0xff00, 0xff03, 0xff06, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f,
|
||||
0xff10, 0xff1a, 0xff1b, 0xff21, 0xff3b, 0xff41, 0xff5b, 0xff66,
|
||||
0xffe0, 0xffe2, 0xffe5, 0xffe8, 0xfff9, 0xfffc,
|
||||
0xffe0, 0xffe2, 0xffe5, 0xffe8, 0xfff9, 0xfffc,
|
||||
};
|
||||
|
||||
static const unsigned char property_val[366] = {
|
||||
|
|
@ -151,13 +151,13 @@ static const unsigned char property_val[366] = {
|
|||
0x06, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x0c, 0x0e,
|
||||
0x0f, 0x06, 0x0f, 0x06, 0x08, 0x06, 0x08, 0x05,
|
||||
0x04, 0x08, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00,
|
||||
0x06, 0x0f, 0x06, 0x0f, 0x0e, 0x0f,
|
||||
0x06, 0x0f, 0x06, 0x0f, 0x0e, 0x0f,
|
||||
};
|
||||
|
||||
FriBidiCharType fribidi_get_type(FriBidiChar ch)
|
||||
{
|
||||
int a, b, m, ch1;
|
||||
|
||||
|
||||
#if defined(TEST) || 0
|
||||
/* for testing only */
|
||||
if (ch >= 'A' && ch <= 'Z')
|
||||
|
|
@ -197,7 +197,7 @@ FriBidiChar
|
|||
fribidi_get_mirror_char(FriBidiChar ch)
|
||||
{
|
||||
int a, b, m, ch1, d, e;
|
||||
|
||||
|
||||
if (ch >= 0x8000)
|
||||
return ch;
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ static int type_to_char(int type)
|
|||
ch = 'N';
|
||||
else
|
||||
ch = '?';
|
||||
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ void fribidi_analyse_string(TypeLink * type_rl_list,
|
|||
unsigned char stack_level[STACK_SIZE];
|
||||
unsigned char stack_override[STACK_SIZE];
|
||||
int stack_index;
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
print_types_re(type_rl_list, 0);
|
||||
|
|
@ -432,9 +432,9 @@ void fribidi_analyse_string(TypeLink * type_rl_list,
|
|||
for (pp = type_rl_list + 1; pp->type != FRIBIDI_TYPE_EOT; pp++) {
|
||||
int type, i;
|
||||
type = RL_TYPE(pp);
|
||||
if (type == FRIBIDI_TYPE_LRE ||
|
||||
type == FRIBIDI_TYPE_RLE ||
|
||||
type == FRIBIDI_TYPE_LRO ||
|
||||
if (type == FRIBIDI_TYPE_LRE ||
|
||||
type == FRIBIDI_TYPE_RLE ||
|
||||
type == FRIBIDI_TYPE_LRO ||
|
||||
type == FRIBIDI_TYPE_RLO) {
|
||||
for (i = 0; i < RL_LEN(pp); i++) {
|
||||
if (stack_index < STACK_SIZE) {
|
||||
|
|
@ -593,10 +593,10 @@ void fribidi_analyse_string(TypeLink * type_rl_list,
|
|||
|
||||
/* 6. Resolving Implicit levels */
|
||||
max_level = base_level;
|
||||
|
||||
|
||||
for (pp = type_rl_list + 1; pp->type != FRIBIDI_TYPE_EOT; pp++) {
|
||||
int this_type = RL_TYPE(pp);
|
||||
|
||||
|
||||
level = RL_LEVEL(pp);
|
||||
if ((level & 1) == 0) {
|
||||
/* Even */
|
||||
|
|
@ -617,7 +617,7 @@ void fribidi_analyse_string(TypeLink * type_rl_list,
|
|||
else
|
||||
RL_LEVEL(pp) = level;
|
||||
}
|
||||
|
||||
|
||||
if (RL_LEVEL(pp) > max_level)
|
||||
max_level = RL_LEVEL(pp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* FriBidi - Library of BiDi algorithm
|
||||
* Copyright (C) 1999 Dov Grobgeld
|
||||
*
|
||||
*
|
||||
* The optimizations to reduce the code size from 13 KB to 3 KB and
|
||||
* the embed/override hack handling are
|
||||
* the embed/override hack handling are
|
||||
* Copyright (C) 2000 Fabrice Bellard.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
34
shell.c
34
shell.c
|
|
@ -121,7 +121,7 @@ static int get_pty(char *tty_str)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int run_process(const char *path, const char **argv,
|
||||
static int run_process(const char *path, const char **argv,
|
||||
int *fd_ptr, int *pid_ptr)
|
||||
{
|
||||
int pty_fd, pid, i, nb_fds;
|
||||
|
|
@ -140,7 +140,7 @@ static int run_process(const char *path, const char **argv,
|
|||
ws.ws_xpixel = ws.ws_col;
|
||||
ws.ws_ypixel = ws.ws_row;
|
||||
ioctl(pty_fd, TIOCSWINSZ, &ws);
|
||||
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
put_status(NULL, "run_process: cannot fork");
|
||||
|
|
@ -570,7 +570,7 @@ static void shell_key(void *opaque, int key)
|
|||
p = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (p)
|
||||
tty_write(s, p, len);
|
||||
}
|
||||
|
|
@ -579,7 +579,7 @@ static void tty_emulate(ShellState *s, int c)
|
|||
{
|
||||
int i, offset, offset1, offset2, n;
|
||||
char buf1[10];
|
||||
|
||||
|
||||
#define ESC2(c1,c2) (((c1)<<8)|((unsigned char)c2))
|
||||
/* some bytes are state independent */
|
||||
switch (c) {
|
||||
|
|
@ -696,7 +696,7 @@ static void tty_emulate(ShellState *s, int c)
|
|||
* linux: hts=\EH, rc=\E8, ri=\EM, rs1=\Ec\E]R, sc=\E7,
|
||||
* vt100: enacs=\E(B\E)0, hts=\EH, rc=\E8, ri=\EM$<5>,
|
||||
* rmkx=\E[?1l\E>,
|
||||
* rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
|
||||
* rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
|
||||
* smkx=\E[?1h\E=,
|
||||
* xterm: enacs=\E(B\E)0, hts=\EH, is2=\E[!p\E[?3;4l\E[4l\E>,
|
||||
* rc=\E8, ri=\EM, rmkx=\E[?1l\E>, rs1=\Ec,
|
||||
|
|
@ -765,7 +765,7 @@ static void tty_emulate(ShellState *s, int c)
|
|||
s->esc_params[s->nb_esc_params] = 0;
|
||||
s->has_params[s->nb_esc_params] = 1;
|
||||
}
|
||||
s->esc_params[s->nb_esc_params] =
|
||||
s->esc_params[s->nb_esc_params] =
|
||||
s->esc_params[s->nb_esc_params] * 10 + c - '0';
|
||||
}
|
||||
break;
|
||||
|
|
@ -874,7 +874,7 @@ static void tty_emulate(ShellState *s, int c)
|
|||
int col_num, cur_line;
|
||||
eb_get_pos(s->b, &cur_line, &col_num, s->cur_offset);
|
||||
/* XXX: actually send position of point in window */
|
||||
snprintf(buf2, sizeof(buf2), "\033[%d;%dR",
|
||||
snprintf(buf2, sizeof(buf2), "\033[%d;%dR",
|
||||
1, col_num + 1);
|
||||
tty_write(s, buf2, -1);
|
||||
}
|
||||
|
|
@ -978,7 +978,7 @@ static void shell_read_cb(void *opaque)
|
|||
len = read(s->pty_fd, buf, sizeof(buf));
|
||||
if (len <= 0)
|
||||
return;
|
||||
|
||||
|
||||
if (qs->trace_buffer)
|
||||
eb_trace_bytes(buf, len, EB_TRACE_SHELL);
|
||||
|
||||
|
|
@ -1003,7 +1003,7 @@ static void shell_pid_cb(void *opaque, int status)
|
|||
} else {
|
||||
time_t ti;
|
||||
char *time_str;
|
||||
|
||||
|
||||
ti = time(NULL);
|
||||
time_str = ctime(&ti);
|
||||
if (WIFEXITED(status))
|
||||
|
|
@ -1011,10 +1011,10 @@ static void shell_pid_cb(void *opaque, int status)
|
|||
else
|
||||
status = -1;
|
||||
if (status == 0) {
|
||||
snprintf(buf, sizeof(buf), "\nCompilation finished at %s",
|
||||
snprintf(buf, sizeof(buf), "\nCompilation finished at %s",
|
||||
time_str);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "\nCompilation exited abnormally with code %d at %s",
|
||||
snprintf(buf, sizeof(buf), "\nCompilation exited abnormally with code %d at %s",
|
||||
status, time_str);
|
||||
}
|
||||
}
|
||||
|
|
@ -1241,7 +1241,7 @@ static void shell_write_char(EditState *e, int c)
|
|||
case 4:
|
||||
do_delete_char(e, NO_ARG);
|
||||
break;
|
||||
// Do not do this: it is useless and causes infinite recursion
|
||||
// Do not do this: it is useless and causes infinite recursion
|
||||
//case 9:
|
||||
// do_tab(e, 1);
|
||||
// break;
|
||||
|
|
@ -1297,7 +1297,7 @@ static void do_compile(EditState *e, const char *cmd)
|
|||
|
||||
error_offset = -1;
|
||||
last_line_num = -1;
|
||||
|
||||
|
||||
/* create new buffer */
|
||||
argv[0] = "/bin/sh";
|
||||
argv[1] = "-c";
|
||||
|
|
@ -1306,7 +1306,7 @@ static void do_compile(EditState *e, const char *cmd)
|
|||
b = new_shell_buffer(NULL, "*compilation*", "/bin/sh", argv, 0);
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
|
||||
/* XXX: try to split window if necessary */
|
||||
switch_to_buffer(e, b);
|
||||
}
|
||||
|
|
@ -1421,9 +1421,9 @@ static CmdDef compile_commands[] = {
|
|||
CMD_( KEY_CTRLXRET('\r'), KEY_NONE, "shell", do_shell, ESi, "ui")
|
||||
CMD_( KEY_CTRLX(KEY_CTRL('e')), KEY_NONE, "compile", do_compile, ESs,
|
||||
"s{Compile command: }|compile|")
|
||||
CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE, "previous-error",
|
||||
CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE, "previous-error",
|
||||
do_compile_error, -1) /* u */
|
||||
CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_CTRLX('`'), "next-error",
|
||||
CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_CTRLX('`'), "next-error",
|
||||
do_compile_error, 1) /* u */
|
||||
CMD_DEF_END,
|
||||
};
|
||||
|
|
@ -1450,7 +1450,7 @@ static int shell_init(void)
|
|||
/* commands and default keys */
|
||||
qe_register_cmd_table(shell_commands, "shell");
|
||||
qe_register_cmd_table(compile_commands, NULL);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
24
tty.c
24
tty.c
|
|
@ -158,7 +158,7 @@ static int tty_term_init(QEditScreen *s,
|
|||
tty.c_cflag |= CS8;
|
||||
tty.c_cc[VMIN] = 1;
|
||||
tty.c_cc[VTIME] = 0;
|
||||
|
||||
|
||||
tcsetattr(fileno(s->STDIN), TCSANOW, &tty);
|
||||
|
||||
/* First switch to full screen mode */
|
||||
|
|
@ -187,7 +187,7 @@ static int tty_term_init(QEditScreen *s,
|
|||
/* CG: Should also have a command line switch */
|
||||
if (tty_state.term_code != TERM_CYGWIN) {
|
||||
int y, x, n;
|
||||
|
||||
|
||||
/* ^X ^Z ^M \170101 */
|
||||
//printf("%s", "\030\032" "\r\xEF\x81\x81" "\033[6n\033D");
|
||||
/* Just print utf-8 encoding for eacute and check cursor position */
|
||||
|
|
@ -277,7 +277,7 @@ static void tty_resize(__unused__ int sig)
|
|||
qe_realloc(&ts->screen, size * 2 + 1);
|
||||
qe_realloc(&ts->line_updated, s->height);
|
||||
ts->screen_size = count;
|
||||
|
||||
|
||||
/* Erase shadow buffer to impossible value */
|
||||
memset(ts->screen + count, 0xFF, size);
|
||||
/* Fill screen buffer with black spaces */
|
||||
|
|
@ -311,7 +311,7 @@ static int tty_term_is_user_input_pending(QEditScreen *s)
|
|||
{
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
FD_ZERO(&rfds);
|
||||
|
|
@ -537,7 +537,7 @@ unsigned int const tty_fg_colors[16] = {
|
|||
static int get_tty_color(QEColor color, unsigned int const *colors, int count)
|
||||
{
|
||||
int i, cmin, dmin, d;
|
||||
|
||||
|
||||
dmin = INT_MAX;
|
||||
cmin = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
|
|
@ -608,7 +608,7 @@ static void tty_term_close_font(__unused__ QEditScreen *s, QEFont *font)
|
|||
/*
|
||||
* Modified implementation of wcwidth() from Markus Kuhn. We do not
|
||||
* handle non spacing and enclosing combining characters and control
|
||||
* chars.
|
||||
* chars.
|
||||
*/
|
||||
|
||||
static int tty_term_glyph_width(__unused__ QEditScreen *s, unsigned int ucs)
|
||||
|
|
@ -628,7 +628,7 @@ static int tty_term_glyph_width(__unused__ QEditScreen *s, unsigned int ucs)
|
|||
(ucs >= 0xffe0 && ucs <= 0xffe6));
|
||||
}
|
||||
|
||||
static void tty_term_text_metrics(QEditScreen *s, __unused__ QEFont *font,
|
||||
static void tty_term_text_metrics(QEditScreen *s, __unused__ QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len)
|
||||
{
|
||||
|
|
@ -641,8 +641,8 @@ static void tty_term_text_metrics(QEditScreen *s, __unused__ QEFont *font,
|
|||
x += tty_term_glyph_width(s, str[i]);
|
||||
metrics->width = x;
|
||||
}
|
||||
|
||||
static void tty_term_draw_text(QEditScreen *s, __unused__ QEFont *font,
|
||||
|
||||
static void tty_term_draw_text(QEditScreen *s, __unused__ QEFont *font,
|
||||
int x, int y, const unsigned int *str, int len,
|
||||
QEColor color)
|
||||
{
|
||||
|
|
@ -650,10 +650,10 @@ static void tty_term_draw_text(QEditScreen *s, __unused__ QEFont *font,
|
|||
TTYChar *ptr;
|
||||
int fgcolor, w, n;
|
||||
unsigned int cc;
|
||||
|
||||
|
||||
if (y < s->clip_y1 || y >= s->clip_y2 || x >= s->clip_x2)
|
||||
return;
|
||||
|
||||
|
||||
ts->line_updated[y] = 1;
|
||||
fgcolor = get_tty_color(color, tty_fg_colors, countof(tty_fg_colors));
|
||||
ptr = ts->screen + y * s->width;
|
||||
|
|
@ -717,7 +717,7 @@ static void tty_term_flush(QEditScreen *s)
|
|||
bgcolor = -1;
|
||||
fgcolor = -1;
|
||||
shifted = 0;
|
||||
|
||||
|
||||
/* CG: Should optimize output by computing it in a temporary buffer
|
||||
* and flushing it in one call to fwrite()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Unicode joining algorithms for QEmacs.
|
||||
* Unicode joining algorithms for QEmacs.
|
||||
*
|
||||
* Copyright (c) 2000 Fabrice Bellard.
|
||||
*
|
||||
|
|
@ -46,7 +46,7 @@ static unsigned short *read_array_be16(FILE *f, int n)
|
|||
int i;
|
||||
|
||||
tab = qe_malloc_array(unsigned short, n);
|
||||
if (!tab)
|
||||
if (!tab)
|
||||
return NULL;
|
||||
for (i = 0; i < n; i++) {
|
||||
tab[i] = uni_get_be16(f);
|
||||
|
|
@ -75,10 +75,10 @@ int load_ligatures(void)
|
|||
long_count = uni_get_be16(f);
|
||||
|
||||
subst1 = read_array_be16(f, subst1_count * 2);
|
||||
if (!subst1)
|
||||
if (!subst1)
|
||||
goto fail;
|
||||
ligature2 = read_array_be16(f, ligature2_count * 3);
|
||||
if (!ligature2)
|
||||
if (!ligature2)
|
||||
goto fail;
|
||||
ligature_long = read_array_be16(f, long_count);
|
||||
if (!ligature_long)
|
||||
|
|
@ -119,7 +119,7 @@ static int find_ligature(int l1, int l2)
|
|||
|
||||
/* apply all the ligature rules in logical order. Always return a
|
||||
smaller buffer */
|
||||
static int unicode_ligature(unsigned int *buf_out,
|
||||
static int unicode_ligature(unsigned int *buf_out,
|
||||
unsigned int *pos_L_to_V,
|
||||
int len)
|
||||
{
|
||||
|
|
@ -127,7 +127,7 @@ static int unicode_ligature(unsigned int *buf_out,
|
|||
unsigned int *q;
|
||||
const unsigned short *lig;
|
||||
unsigned int buf[len];
|
||||
|
||||
|
||||
memcpy(buf, buf_out, len * sizeof(unsigned int));
|
||||
|
||||
q = buf_out;
|
||||
|
|
@ -207,8 +207,8 @@ static int unicode_classify(unsigned int *buf, int len)
|
|||
continue;
|
||||
mask |= UNICODE_NONASCII;
|
||||
if (c >= 0x2000) /* fast test for non handled scripts */
|
||||
continue;
|
||||
if (c >= 0x600 && c <= 0x6ff)
|
||||
continue;
|
||||
if (c >= 0x600 && c <= 0x6ff)
|
||||
mask |= UNICODE_ARABIC;
|
||||
else if (c >= 0x900 && c <= 0x97f)
|
||||
mask |= UNICODE_INDIC;
|
||||
|
|
@ -226,7 +226,7 @@ static void compose_char_to_glyph(unsigned int *ctog, int len, unsigned *ctog1)
|
|||
static void bidi_reverse_buf(unsigned int *str, int len)
|
||||
{
|
||||
int i, len2 = len / 2;
|
||||
|
||||
|
||||
for (i = 0; i < len2; i++) {
|
||||
unsigned int tmp = str[i];
|
||||
str[i] = fribidi_get_mirror_char(str[len - 1 - i]);
|
||||
|
|
@ -274,9 +274,9 @@ int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
|
|||
for (i = 0; i < len; i++)
|
||||
ctog[i] = i;
|
||||
memcpy(buf, src, len * sizeof(int));
|
||||
|
||||
|
||||
/* apply each filter */
|
||||
|
||||
|
||||
if (unicode_class & UNICODE_ARABIC) {
|
||||
len = arab_join(buf, ctog1, len);
|
||||
/* not needed for arabjoin */
|
||||
|
|
@ -287,7 +287,7 @@ int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
|
|||
len = devanagari_log2vis(buf, ctog1, len);
|
||||
compose_char_to_glyph(ctog, src_size, ctog1);
|
||||
}
|
||||
|
||||
|
||||
len = unicode_ligature(buf, ctog1, len);
|
||||
compose_char_to_glyph(ctog, src_size, ctog1);
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
|
|||
if (len > dst_size)
|
||||
len = dst_size;
|
||||
memcpy(dst, buf, len * sizeof(unsigned int));
|
||||
|
||||
|
||||
if (char_to_glyph_pos) {
|
||||
memcpy(char_to_glyph_pos, ctog, src_size * sizeof(unsigned int));
|
||||
}
|
||||
|
|
|
|||
6
unihex.c
6
unihex.c
|
|
@ -156,12 +156,12 @@ static void unihex_move_up_down(EditState *s, int dir)
|
|||
}
|
||||
|
||||
static ModeDef unihex_mode = {
|
||||
"unihex",
|
||||
"unihex",
|
||||
.instance_size = 0,
|
||||
.mode_probe = NULL,
|
||||
.mode_init = unihex_mode_init,
|
||||
.mode_init = unihex_mode_init,
|
||||
.mode_close = text_mode_close,
|
||||
.text_display = unihex_display,
|
||||
.text_display = unihex_display,
|
||||
.text_backward_offset = unihex_backward_offset,
|
||||
|
||||
.move_up_down = unihex_move_up_down,
|
||||
|
|
|
|||
8
unix.c
8
unix.c
|
|
@ -88,7 +88,7 @@ void set_write_handler(int fd, void (*cb)(void *opaque), void *opaque)
|
|||
/* register a callback which is called when process 'pid'
|
||||
terminates. When the callback is set to NULL, it is deleted */
|
||||
/* XXX: add consistency check ? */
|
||||
int set_pid_handler(int pid,
|
||||
int set_pid_handler(int pid,
|
||||
void (*cb)(void *opaque, int status), void *opaque)
|
||||
{
|
||||
PidHandler *p;
|
||||
|
|
@ -114,7 +114,7 @@ int set_pid_handler(int pid,
|
|||
}
|
||||
|
||||
/*
|
||||
* add an explicit call back to avoid recursions
|
||||
* add an explicit call back to avoid recursions
|
||||
*/
|
||||
void register_bottom_half(void (*cb)(void *opaque), void *opaque)
|
||||
{
|
||||
|
|
@ -243,7 +243,7 @@ static void url_block(void)
|
|||
#if 0
|
||||
{
|
||||
static int count;
|
||||
|
||||
|
||||
printf("%5d: delay=%d\n", count++, delay);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -269,7 +269,7 @@ static void url_block(void)
|
|||
uh++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* handle terminated children */
|
||||
for (;;) {
|
||||
if (list_empty(&pid_handlers))
|
||||
|
|
|
|||
206
util.c
206
util.c
|
|
@ -59,13 +59,13 @@ FindFileState *find_file_open(const char *path, const char *pattern)
|
|||
s->dir = NULL;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
int find_file_next(FindFileState *s, char *filename, int filename_size_max)
|
||||
{
|
||||
struct dirent *dirent;
|
||||
const char *p;
|
||||
char *q;
|
||||
|
||||
|
||||
if (s->dir == NULL)
|
||||
goto redo;
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ int find_file_next(FindFileState *s, char *filename, int filename_size_max)
|
|||
|
||||
void find_file_close(FindFileState *s)
|
||||
{
|
||||
if (s->dir)
|
||||
if (s->dir)
|
||||
closedir(s->dir);
|
||||
qe_free(&s);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ static void path_win_to_unix(char *buf)
|
|||
|
||||
/* suppress redundant ".", ".." and "/" from paths */
|
||||
/* XXX: make it better */
|
||||
static void canonize_path1(char *buf, int buf_size, const char *path)
|
||||
static void canonicalize_path1(char *buf, int buf_size, const char *path)
|
||||
{
|
||||
const char *p;
|
||||
char *q, *q1;
|
||||
|
|
@ -190,7 +190,7 @@ static void canonize_path1(char *buf, int buf_size, const char *path)
|
|||
}
|
||||
}
|
||||
|
||||
void canonize_path(char *buf, int buf_size, const char *path)
|
||||
void canonicalize_path(char *buf, int buf_size, const char *path)
|
||||
{
|
||||
const char *p;
|
||||
/* check for URL protocol or windows drive */
|
||||
|
|
@ -198,18 +198,18 @@ void canonize_path(char *buf, int buf_size, const char *path)
|
|||
p = strchr(path, ':');
|
||||
if (p) {
|
||||
if ((p - path) == 1) {
|
||||
/* windows drive : we canonize only the following path */
|
||||
/* windows drive: we canonicalize only the following path */
|
||||
buf[0] = p[0];
|
||||
buf[1] = p[1];
|
||||
/* CG: this will not work for non current drives */
|
||||
canonize_path1(buf + 2, buf_size - 2, p);
|
||||
canonicalize_path1(buf + 2, buf_size - 2, p);
|
||||
} else {
|
||||
/* URL: it is already canonized */
|
||||
/* URL: it is already canonical */
|
||||
pstrcpy(buf, buf_size, path);
|
||||
}
|
||||
} else {
|
||||
/* simple unix path */
|
||||
canonize_path1(buf, buf_size, path);
|
||||
canonicalize_path1(buf, buf_size, path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -217,6 +217,7 @@ void canonize_path(char *buf, int buf_size, const char *path)
|
|||
static int is_abs_path(const char *path)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
p = strchr(path, ':');
|
||||
if (p)
|
||||
p++;
|
||||
|
|
@ -225,51 +226,66 @@ static int is_abs_path(const char *path)
|
|||
return *p == '/';
|
||||
}
|
||||
|
||||
/* canonize the path and make it absolute */
|
||||
void canonize_absolute_path(char *buf, int buf_size, const char *path1)
|
||||
/* canonicalize the path and make it absolute */
|
||||
void canonicalize_absolute_path(char *buf, int buf_size, const char *path1)
|
||||
{
|
||||
char cwd[MAX_FILENAME_SIZE];
|
||||
char path[MAX_FILENAME_SIZE];
|
||||
char *homedir;
|
||||
|
||||
if (!is_abs_path(path1)) {
|
||||
/* XXX: should call it again */
|
||||
if (*path1 == '~' && (path1[1] == '\0' || path1[1] == '/')) {
|
||||
homedir = getenv("HOME");
|
||||
if (homedir) {
|
||||
/* CG: should test for trailing slash */
|
||||
pstrcpy(path, sizeof(path), homedir);
|
||||
pstrcat(path, sizeof(path), path1 + 1);
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
/* CG: not sufficient for windows drives */
|
||||
/* CG: should test result */
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
if (*path1 == '~') {
|
||||
if (path1[1] == '\0' || path1[1] == '/') {
|
||||
homedir = getenv("HOME");
|
||||
if (homedir) {
|
||||
pstrcpy(path, sizeof(path), homedir);
|
||||
#ifdef WIN32
|
||||
path_win_to_unix(cwd);
|
||||
path_win_to_unix(path);
|
||||
#endif
|
||||
makepath(path, sizeof(path), cwd, path1);
|
||||
} else {
|
||||
pstrcpy(path, sizeof(path), path1);
|
||||
remove_slash(path);
|
||||
pstrcat(path, sizeof(path), path1 + 1);
|
||||
path1 = path;
|
||||
}
|
||||
} else {
|
||||
/* CG: should get info from getpwnam */
|
||||
pstrcpy(path, sizeof(path), "/home/");
|
||||
pstrcat(path, sizeof(path), path1 + 1);
|
||||
path1 = path;
|
||||
}
|
||||
} else {
|
||||
/* CG: not sufficient for windows drives */
|
||||
/* CG: should test result */
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
#ifdef WIN32
|
||||
path_win_to_unix(cwd);
|
||||
#endif
|
||||
makepath(path, sizeof(path), cwd, path1);
|
||||
path1 = path;
|
||||
}
|
||||
}
|
||||
next:
|
||||
canonize_path(buf, buf_size, path);
|
||||
canonicalize_path(buf, buf_size, path1);
|
||||
}
|
||||
|
||||
/* Get the filename portion of a path */
|
||||
const char *basename(const char *filename)
|
||||
{
|
||||
const char *p;
|
||||
const char *base;
|
||||
|
||||
p = strrchr(filename, '/');
|
||||
if (!p) {
|
||||
/* should also scan for ':' and '\\' in WIN32 */
|
||||
return filename;
|
||||
} else {
|
||||
p++;
|
||||
return p;
|
||||
base = filename;
|
||||
if (base) {
|
||||
for (p = base; *p; p++) {
|
||||
#ifdef WIN32
|
||||
/* Simplitic DOS filename support */
|
||||
if (*p == '/' || *p == '\\' || *p == ':')
|
||||
base = p + 1;
|
||||
#else
|
||||
if (*p == '/')
|
||||
base = p + 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
/* Return the last extension in a path, ignoring leading dots */
|
||||
|
|
@ -277,20 +293,19 @@ const char *extension(const char *filename)
|
|||
{
|
||||
const char *p, *ext;
|
||||
|
||||
p = filename;
|
||||
restart:
|
||||
while (*p == '.')
|
||||
p++;
|
||||
p = basename(filename);
|
||||
ext = NULL;
|
||||
for (; *p; p++) {
|
||||
if (*p == '/') {
|
||||
if (p) {
|
||||
while (*p == '.')
|
||||
p++;
|
||||
goto restart;
|
||||
for (; *p; p++) {
|
||||
if (*p == '.')
|
||||
ext = p;
|
||||
}
|
||||
if (*p == '.')
|
||||
if (!ext)
|
||||
ext = p;
|
||||
}
|
||||
return ext ? ext : p;
|
||||
return ext;
|
||||
}
|
||||
|
||||
/* Extract the directory portion of a path:
|
||||
|
|
@ -303,17 +318,17 @@ char *get_dirname(char *dest, int size, const char *file)
|
|||
char *p;
|
||||
|
||||
if (dest) {
|
||||
p = dest;
|
||||
if (file) {
|
||||
p = dest;
|
||||
if (file) {
|
||||
pstrcpy(dest, size, file);
|
||||
p = dest + (basename(dest) - dest);
|
||||
if (p > dest + 1 && p[-1] != ':' && p[-2] != ':')
|
||||
p--;
|
||||
p = dest + (basename(dest) - dest);
|
||||
if (p > dest + 1 && p[-1] != ':' && p[-2] != ':')
|
||||
p--;
|
||||
|
||||
if (p == dest)
|
||||
*p++ = '.';
|
||||
}
|
||||
*p = '\0';
|
||||
if (p == dest)
|
||||
*p++ = '.';
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
|
@ -321,26 +336,45 @@ char *get_dirname(char *dest, int size, const char *file)
|
|||
int match_extension(const char *filename, const char *extlist)
|
||||
{
|
||||
const char *r;
|
||||
|
||||
|
||||
r = extension(filename);
|
||||
if (*r == '.') {
|
||||
return strfind(extlist, r + 1, 1);
|
||||
return strfind(extlist, r + 1, 1);
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove trailing slash from path, except for / directory */
|
||||
int remove_slash(char *buf)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen(buf);
|
||||
if (len > 1 && buf[len - 1] == '/') {
|
||||
buf[--len] = '\0';
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Append trailing slash to path if none there already */
|
||||
int append_slash(char *buf, int buf_size)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen(buf);
|
||||
if (len > 0 && buf[len - 1] != '/' && len + 1 < buf_size) {
|
||||
buf[len++] = '/';
|
||||
buf[len] = '\0';
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
char *makepath(char *buf, int buf_size, const char *path,
|
||||
const char *filename)
|
||||
{
|
||||
int len;
|
||||
|
||||
pstrcpy(buf, buf_size, path);
|
||||
len = strlen(path);
|
||||
if (len > 0 && path[len - 1] != '/' && len + 1 < buf_size) {
|
||||
buf[len++] = '/';
|
||||
buf[len] = '\0';
|
||||
}
|
||||
append_slash(buf, buf_size);
|
||||
return pstrcat(buf, buf_size, filename);
|
||||
}
|
||||
|
||||
|
|
@ -499,7 +533,7 @@ int strxcmp(const char *str1, const char *str2)
|
|||
{
|
||||
const char *p, *q;
|
||||
int d;
|
||||
|
||||
|
||||
p = str1;
|
||||
q = str2;
|
||||
for (;;) {
|
||||
|
|
@ -554,7 +588,7 @@ int umemcmp(const unsigned int *s1, const unsigned int *s2, int count)
|
|||
|
||||
/* Read a token from a string, stop on a set of characters.
|
||||
* Skip spaces before and after token.
|
||||
*/
|
||||
*/
|
||||
void get_str(const char **pp, char *buf, int buf_size, const char *stop)
|
||||
{
|
||||
char *q;
|
||||
|
|
@ -606,7 +640,7 @@ int css_get_enum(const char *str, const char *enum_str)
|
|||
static unsigned short const keycodes[] = {
|
||||
KEY_SPC, KEY_DEL, KEY_RET, KEY_ESC, KEY_TAB, KEY_SHIFT_TAB,
|
||||
KEY_CTRL(' '), KEY_DEL, KEY_CTRL('\\'),
|
||||
KEY_CTRL(']'), KEY_CTRL('^'), KEY_CTRL('_'),
|
||||
KEY_CTRL(']'), KEY_CTRL('^'), KEY_CTRL('_'), KEY_CTRL('_'),
|
||||
KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN,
|
||||
KEY_HOME, KEY_END, KEY_PAGEUP, KEY_PAGEDOWN,
|
||||
KEY_CTRL_LEFT, KEY_CTRL_RIGHT, KEY_CTRL_UP, KEY_CTRL_DOWN,
|
||||
|
|
@ -620,18 +654,18 @@ static unsigned short const keycodes[] = {
|
|||
};
|
||||
|
||||
static const char * const keystr[] = {
|
||||
"SPC", "DEL", "RET", "ESC", "TAB", "S-TAB",
|
||||
"C-SPC", "C-?", "C-\\", "C-]", "C-^", "C-_",
|
||||
"left", "right", "up", "down",
|
||||
"home", "end", "prior", "next",
|
||||
"C-left", "C-right", "C-up", "C-down",
|
||||
"C-home", "C-end", "C-prior", "C-next",
|
||||
"pageup", "pagedown", "C-pageup", "C-pagedown",
|
||||
"insert", "delete", "default",
|
||||
"f1", "f2", "f3", "f4", "f5",
|
||||
"f6", "f7", "f8", "f9", "f10",
|
||||
"f11", "f12", "f13", "f14", "f15",
|
||||
"f16", "f17", "f18", "f19", "f20",
|
||||
"SPC", "DEL", "RET", "ESC", "TAB", "S-TAB",
|
||||
"C-SPC", "C-?", "C-\\", "C-]", "C-^", "C-_", "C-/",
|
||||
"left", "right", "up", "down",
|
||||
"home", "end", "prior", "next",
|
||||
"C-left", "C-right", "C-up", "C-down",
|
||||
"C-home", "C-end", "C-prior", "C-next",
|
||||
"pageup", "pagedown", "C-pageup", "C-pagedown",
|
||||
"insert", "delete", "default",
|
||||
"f1", "f2", "f3", "f4", "f5",
|
||||
"f6", "f7", "f8", "f9", "f10",
|
||||
"f11", "f12", "f13", "f14", "f15",
|
||||
"f16", "f17", "f18", "f19", "f20",
|
||||
};
|
||||
|
||||
int compose_keys(unsigned int *keys, int *nb_keys)
|
||||
|
|
@ -685,6 +719,8 @@ static int strtokey1(const char **pp)
|
|||
return key;
|
||||
}
|
||||
#endif
|
||||
/* Should also support backslash escapes: \000 \x00 \u0000 */
|
||||
/* Should also support ^x and syntax and Ctrl- prefix for control keys */
|
||||
if (p[0] == 'C' && p[1] == '-' && p1 == p + 3) {
|
||||
/* control */
|
||||
key = KEY_CTRL(p[2]);
|
||||
|
|
@ -702,11 +738,13 @@ int strtokey(const char **pp)
|
|||
int key;
|
||||
|
||||
p = *pp;
|
||||
/* Should also support A- and Alt- prefix for meta keys */
|
||||
if (p[0] == 'M' && p[1] == '-') {
|
||||
p += 2;
|
||||
key = KEY_META(strtokey1(&p));
|
||||
} else
|
||||
if (p[0] == 'C' && p[1] == '-' && p[2] == 'M' && p[3] == '-') {
|
||||
/* Should pass buffer with C-xxx to strtokey1 */
|
||||
p += 4;
|
||||
key = KEY_META(KEY_CTRL(strtokey1(&p)));
|
||||
} else {
|
||||
|
|
@ -742,7 +780,7 @@ void keytostr(char *buf, int buf_size, int key)
|
|||
int i;
|
||||
char buf1[32];
|
||||
buf_t out;
|
||||
|
||||
|
||||
buf_init(&out, buf, buf_size);
|
||||
|
||||
for (i = 0; i < countof(keycodes); i++) {
|
||||
|
|
@ -807,7 +845,7 @@ static ColorDef const css_colors[] = {
|
|||
{ "teal", QERGB(0x00, 0x80, 0x80) },
|
||||
{ "fuchsia", QERGB(0xff, 0x00, 0xff) },
|
||||
{ "aqua", QERGB(0x00, 0xff, 0xff) },
|
||||
|
||||
|
||||
/* more colors */
|
||||
{ "cyan", QERGB(0x00, 0xff, 0xff) },
|
||||
{ "magenta", QERGB(0xff, 0x00, 0xff) },
|
||||
|
|
@ -909,7 +947,7 @@ int css_get_color(QEColor *color_ptr, const char *p)
|
|||
*color_ptr = def[index].color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
rgba[3] = 0xff;
|
||||
if (qe_isxdigit((unsigned char)*p)) {
|
||||
goto parse_num;
|
||||
|
|
@ -1105,7 +1143,7 @@ void free_strings(StringArray *cs)
|
|||
* failure, the data is not added. The dynamic string is guaranteed to
|
||||
* be 0 terminated, although it can be longer if it contains zeros.
|
||||
*
|
||||
* @return 0 if OK, -1 if allocation error.
|
||||
* @return 0 if OK, -1 if allocation error.
|
||||
*/
|
||||
int qmemcat(QString *q, const unsigned char *data1, int len1)
|
||||
{
|
||||
|
|
|
|||
98
video.c
98
video.c
|
|
@ -59,14 +59,14 @@ typedef struct VideoState {
|
|||
int abort_request;
|
||||
int paused;
|
||||
AVFormatContext *ic;
|
||||
|
||||
|
||||
int audio_stream;
|
||||
AVStream *audio_st;
|
||||
PacketQueue audioq;
|
||||
AVFormatContext *audio_out;
|
||||
int16_t sample_array[SAMPLE_ARRAY_SIZE];
|
||||
int sample_array_index;
|
||||
|
||||
|
||||
int video_stream;
|
||||
AVStream *video_st;
|
||||
PacketQueue videoq;
|
||||
|
|
@ -75,7 +75,7 @@ typedef struct VideoState {
|
|||
int pictq_size, pictq_rindex, pictq_windex;
|
||||
pthread_mutex_t pictq_mutex;
|
||||
pthread_cond_t pictq_cond;
|
||||
|
||||
|
||||
QETimer *video_timer;
|
||||
} VideoState;
|
||||
|
||||
|
|
@ -99,11 +99,11 @@ static int video_mode_probe(ModeProbeData *pd)
|
|||
{
|
||||
AVProbeData avpd;
|
||||
AVInputFormat *fmt;
|
||||
|
||||
|
||||
avpd.filename = pd->filename;
|
||||
avpd.buf = pd->buf;
|
||||
avpd.buf_size = pd->buf_size;
|
||||
|
||||
|
||||
fmt = av_probe_input_format(&avpd, 1);
|
||||
if (!fmt)
|
||||
return 0;
|
||||
|
|
@ -164,7 +164,7 @@ static void packet_queue_abort(PacketQueue *q)
|
|||
pthread_mutex_lock(&q->mutex);
|
||||
|
||||
q->abort_request = 1;
|
||||
|
||||
|
||||
pthread_cond_signal(&q->cond);
|
||||
|
||||
pthread_mutex_unlock(&q->mutex);
|
||||
|
|
@ -183,7 +183,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block)
|
|||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
pkt1 = q->first_pkt;
|
||||
if (pkt1) {
|
||||
q->first_pkt = pkt1->next;
|
||||
|
|
@ -220,22 +220,22 @@ static void video_refresh_timer(void *opaque)
|
|||
is->video_timer = qe_add_timer(40, s, video_refresh_timer);
|
||||
} else {
|
||||
vp = &is->pictq[is->pictq_rindex];
|
||||
|
||||
|
||||
/* launch timer for next picture */
|
||||
is->video_timer = qe_add_timer(vp->delay, s, video_refresh_timer);
|
||||
|
||||
/* invalidate window */
|
||||
edit_invalidate(s);
|
||||
is->no_background = 1; /* XXX: horrible, needs complete rewrite */
|
||||
|
||||
|
||||
/* display picture */
|
||||
edit_display(qs);
|
||||
dpy_flush(qs->screen);
|
||||
|
||||
|
||||
/* update queue size and signal for next picture */
|
||||
if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
|
||||
is->pictq_rindex = 0;
|
||||
|
||||
|
||||
pthread_mutex_lock(&is->pictq_mutex);
|
||||
is->pictq_size--;
|
||||
pthread_cond_signal(&is->pictq_cond);
|
||||
|
|
@ -247,11 +247,11 @@ static void video_refresh_timer(void *opaque)
|
|||
|
||||
/* if only audio stream, then display the audio bars (better
|
||||
than nothing, just to test the implementation */
|
||||
|
||||
|
||||
/* invalidate window */
|
||||
edit_invalidate(s);
|
||||
is->no_background = 1; /* XXX: horrible, needs complete rewrite */
|
||||
|
||||
|
||||
/* display picture */
|
||||
edit_display(qs);
|
||||
dpy_flush(qs->screen);
|
||||
|
|
@ -272,7 +272,7 @@ static void video_image_display(EditState *s)
|
|||
/* XXX: use variable in the frame */
|
||||
aspect_ratio = is->video_st->codec.aspect_ratio;
|
||||
if (aspect_ratio <= 0.0)
|
||||
aspect_ratio = (float)is->video_st->codec.width /
|
||||
aspect_ratio = (float)is->video_st->codec.width /
|
||||
(float)is->video_st->codec.height;
|
||||
/* XXX: we suppose the screen has a 1.0 pixel ratio */
|
||||
height = s->height;
|
||||
|
|
@ -289,11 +289,11 @@ static void video_image_display(EditState *s)
|
|||
} else {
|
||||
is->no_background = 0;
|
||||
}
|
||||
bmp_draw(s->screen, vp->bmp, s->xleft + x, s->ytop + y,
|
||||
bmp_draw(s->screen, vp->bmp, s->xleft + x, s->ytop + y,
|
||||
width, height, 0, 0, 0);
|
||||
} else {
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop, s->width, s->height,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop, s->width, s->height,
|
||||
QERGB(0x00, 0x00, 0x00));
|
||||
}
|
||||
}
|
||||
|
|
@ -303,8 +303,8 @@ static void video_audio_display(EditState *s)
|
|||
VideoState *is = s->mode_data;
|
||||
int i, x, y1, y, h, ys;
|
||||
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop, s->width, s->height,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft, s->ytop, s->width, s->height,
|
||||
QERGB(0x00, 0x00, 0x00));
|
||||
if (is->sample_array_index >= SAMPLE_ARRAY_SIZE) {
|
||||
i = 0;
|
||||
|
|
@ -318,8 +318,8 @@ static void video_audio_display(EditState *s)
|
|||
} else {
|
||||
ys = y1;
|
||||
}
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + x, ys, 1, y,
|
||||
fill_rectangle(s->screen,
|
||||
s->xleft + x, ys, 1, y,
|
||||
QERGB(0xff, 0xff, 0xff));
|
||||
if (++i >= SAMPLE_ARRAY_SIZE)
|
||||
i = 0;
|
||||
|
|
@ -337,7 +337,7 @@ static void video_display(EditState *s)
|
|||
if (s->display_invalid) {
|
||||
if (is->video_st)
|
||||
video_image_display(s);
|
||||
else if (is->audio_st)
|
||||
else if (is->audio_st)
|
||||
video_audio_display(s);
|
||||
s->display_invalid = 0;
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ static void alloc_picture(void *opaque)
|
|||
int is_yuv;
|
||||
|
||||
vp = &is->pictq[is->pictq_windex];
|
||||
|
||||
|
||||
bmp_free(s->screen, &vp->bmp);
|
||||
|
||||
/* XXX: use generic function */
|
||||
|
|
@ -373,7 +373,7 @@ static void alloc_picture(void *opaque)
|
|||
|
||||
retry:
|
||||
if (is_yuv) {
|
||||
vp->bmp = bmp_alloc(s->screen,
|
||||
vp->bmp = bmp_alloc(s->screen,
|
||||
is->video_st->codec.width,
|
||||
is->video_st->codec.height,
|
||||
QEBITMAP_FLAG_VIDEO);
|
||||
|
|
@ -386,7 +386,7 @@ static void alloc_picture(void *opaque)
|
|||
goto retry;
|
||||
}
|
||||
} else {
|
||||
vp->bmp = bmp_alloc(s->screen,
|
||||
vp->bmp = bmp_alloc(s->screen,
|
||||
is->video_st->codec.width,
|
||||
is->video_st->codec.height,
|
||||
0);
|
||||
|
|
@ -415,14 +415,14 @@ static int output_picture(VideoState *is, AVPicture *src_pict)
|
|||
pthread_cond_wait(&is->pictq_cond, &is->pictq_mutex);
|
||||
}
|
||||
pthread_mutex_unlock(&is->pictq_mutex);
|
||||
|
||||
|
||||
if (is->videoq.abort_request)
|
||||
return -1;
|
||||
|
||||
vp = &is->pictq[is->pictq_windex];
|
||||
|
||||
/* alloc or resize hardware picture buffer */
|
||||
if (!vp->bmp ||
|
||||
if (!vp->bmp ||
|
||||
vp->width != is->video_st->codec.width ||
|
||||
vp->height != is->video_st->codec.height) {
|
||||
|
||||
|
|
@ -445,21 +445,21 @@ static int output_picture(VideoState *is, AVPicture *src_pict)
|
|||
|
||||
if (vp->bmp) {
|
||||
/* get a pointer on the bitmap */
|
||||
bmp_lock(s->screen, vp->bmp, &qepict,
|
||||
bmp_lock(s->screen, vp->bmp, &qepict,
|
||||
0, 0, vp->bmp->width, vp->bmp->height);
|
||||
dst_pix_fmt = qe_bitmap_format_to_pix_fmt(vp->bmp->format);
|
||||
for (i = 0; i < 4; i++) {
|
||||
pict.data[i] = qepict.data[i];
|
||||
pict.linesize[i] = qepict.linesize[i];
|
||||
}
|
||||
img_convert(&pict, dst_pix_fmt,
|
||||
src_pict, is->video_st->codec.pix_fmt,
|
||||
img_convert(&pict, dst_pix_fmt,
|
||||
src_pict, is->video_st->codec.pix_fmt,
|
||||
is->video_st->codec.width, is->video_st->codec.height);
|
||||
/* update the bitmap content */
|
||||
bmp_unlock(s->screen, vp->bmp);
|
||||
|
||||
/* compute delay for the next frame */
|
||||
vp->delay = (1000 * is->video_st->codec.frame_rate_base) /
|
||||
vp->delay = (1000 * is->video_st->codec.frame_rate_base) /
|
||||
is->video_st->codec.frame_rate;
|
||||
/* XXX: just fixes .asf! */
|
||||
if (vp->delay > 40)
|
||||
|
|
@ -491,7 +491,7 @@ static void *video_thread(void *arg)
|
|||
break;
|
||||
ptr = pkt->data;
|
||||
if (is->video_st->codec.codec_id == CODEC_ID_RAWVIDEO) {
|
||||
avpicture_fill(&pict, ptr,
|
||||
avpicture_fill(&pict, ptr,
|
||||
is->video_st->codec.pix_fmt,
|
||||
is->video_st->codec.width,
|
||||
is->video_st->codec.height);
|
||||
|
|
@ -500,7 +500,7 @@ static void *video_thread(void *arg)
|
|||
} else {
|
||||
len = pkt->size;
|
||||
while (len > 0) {
|
||||
len1 = avcodec_decode_video(&is->video_st->codec,
|
||||
len1 = avcodec_decode_video(&is->video_st->codec,
|
||||
&frame, &got_picture, ptr, len);
|
||||
if (len1 < 0)
|
||||
break;
|
||||
|
|
@ -543,7 +543,7 @@ static void output_audio(VideoState *is, short *samples, int samples_size)
|
|||
is->sample_array_index += len;
|
||||
}
|
||||
|
||||
is->audio_out->oformat->write_packet(is->audio_out, 0,
|
||||
is->audio_out->oformat->write_packet(is->audio_out, 0,
|
||||
(uint8_t *)samples, samples_size, 0);
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +564,7 @@ static void *audio_thread(void *arg)
|
|||
ptr = pkt->data;
|
||||
len = pkt->size;
|
||||
while (len > 0) {
|
||||
len1 = avcodec_decode_audio(&is->audio_st->codec,
|
||||
len1 = avcodec_decode_audio(&is->audio_st->codec,
|
||||
samples, &data_size, ptr, len);
|
||||
if (len1 < 0)
|
||||
break;
|
||||
|
|
@ -591,7 +591,7 @@ static int stream_open(EditState *s, int stream_index)
|
|||
if (stream_index < 0 || stream_index >= ic->nb_streams)
|
||||
return -1;
|
||||
enc = &ic->streams[stream_index]->codec;
|
||||
|
||||
|
||||
|
||||
/* prepare audio output */
|
||||
if (enc->codec_type == CODEC_TYPE_AUDIO) {
|
||||
|
|
@ -638,7 +638,7 @@ static void stream_close(EditState *s, int stream_index)
|
|||
VideoState *is = s->mode_data;
|
||||
AVFormatContext *ic = is->ic;
|
||||
AVCodecContext *enc;
|
||||
|
||||
|
||||
enc = &ic->streams[stream_index]->codec;
|
||||
|
||||
switch (enc->codec_type) {
|
||||
|
|
@ -650,7 +650,7 @@ static void stream_close(EditState *s, int stream_index)
|
|||
|
||||
av_write_trailer(is->audio_out);
|
||||
av_freep(&is->audio_out);
|
||||
|
||||
|
||||
break;
|
||||
case CODEC_TYPE_VIDEO:
|
||||
packet_queue_abort(&is->videoq);
|
||||
|
|
@ -725,7 +725,7 @@ static void *decode_thread(void *arg)
|
|||
#ifdef DEBUG
|
||||
dump_format(ic, 0, s->b->filename, 0);
|
||||
#endif
|
||||
|
||||
|
||||
/* open the streams */
|
||||
if (audio_index >= 0) {
|
||||
stream_open(s, audio_index);
|
||||
|
|
@ -748,7 +748,7 @@ static void *decode_thread(void *arg)
|
|||
struct timespec tv;
|
||||
/* wait 10 ms */
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_nsec = 10 * 1000000;
|
||||
tv.tv_nsec = 10 * 1000000;
|
||||
nanosleep(&tv, NULL);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -820,7 +820,7 @@ static int video_mode_init(EditState *s, ModeSavedData *saved_data)
|
|||
is->paused = 1;
|
||||
}
|
||||
is->sample_array_index = SAMPLE_ARRAY_SIZE;
|
||||
|
||||
|
||||
err = pthread_create(&is->parse_tid, NULL, decode_thread, s);
|
||||
if (err != 0)
|
||||
return -1;
|
||||
|
|
@ -873,7 +873,7 @@ static int video_mode_line(EditState *s, char *buf, int buf_size)
|
|||
pos += snprintf(buf + pos, buf_size - pos, "[paused]--");
|
||||
}
|
||||
if (is->ic) {
|
||||
pos += snprintf(buf + pos, buf_size - pos, "%s",
|
||||
pos += snprintf(buf + pos, buf_size - pos, "%s",
|
||||
is->ic->iformat->name);
|
||||
}
|
||||
if (is->video_st) {
|
||||
|
|
@ -882,9 +882,9 @@ static int video_mode_line(EditState *s, char *buf, int buf_size)
|
|||
codec = dec->codec;
|
||||
if (codec)
|
||||
name = codec->name;
|
||||
pos += snprintf(buf + pos, buf_size - pos, "--%s/%s[%dx%d@%0.2ffps]",
|
||||
pos += snprintf(buf + pos, buf_size - pos, "--%s/%s[%dx%d@%0.2ffps]",
|
||||
name, get_stream_id(is->ic, is->video_st, buf1, sizeof(buf1)),
|
||||
dec->width, dec->height,
|
||||
dec->width, dec->height,
|
||||
(float)dec->frame_rate / dec->frame_rate_base);
|
||||
}
|
||||
if (is->audio_st) {
|
||||
|
|
@ -893,7 +893,7 @@ static int video_mode_line(EditState *s, char *buf, int buf_size)
|
|||
codec = dec->codec;
|
||||
if (codec)
|
||||
name = codec->name;
|
||||
pos += snprintf(buf + pos, buf_size - pos, "--%s/%s[%dHz:%dch]",
|
||||
pos += snprintf(buf + pos, buf_size - pos, "--%s/%s[%dHz:%dch]",
|
||||
name, get_stream_id(is->ic, is->audio_st, buf1, sizeof(buf1)),
|
||||
dec->sample_rate, dec->channels);
|
||||
}
|
||||
|
|
@ -913,7 +913,7 @@ static void av_cycle_stream(EditState *s, int codec_type)
|
|||
else
|
||||
start_index = is->audio_stream;
|
||||
if (start_index < 0) {
|
||||
put_status(s, "No %s stream to cycle",
|
||||
put_status(s, "No %s stream to cycle",
|
||||
(codec_type == CODEC_TYPE_VIDEO) ? "video" : "audio");
|
||||
return;
|
||||
}
|
||||
|
|
@ -923,7 +923,7 @@ static void av_cycle_stream(EditState *s, int codec_type)
|
|||
if (++stream_index >= ic->nb_streams)
|
||||
stream_index = 0;
|
||||
if (stream_index == start_index) {
|
||||
put_status(s, "Only one %s stream",
|
||||
put_status(s, "Only one %s stream",
|
||||
(codec_type == CODEC_TYPE_VIDEO) ? "video" : "audio");
|
||||
return;
|
||||
}
|
||||
|
|
@ -931,7 +931,7 @@ static void av_cycle_stream(EditState *s, int codec_type)
|
|||
if (st->codec.codec_type == codec_type)
|
||||
break;
|
||||
}
|
||||
put_status(s, "Switching to %s stream %s",
|
||||
put_status(s, "Switching to %s stream %s",
|
||||
(codec_type == CODEC_TYPE_VIDEO) ? "video" : "audio",
|
||||
get_stream_id(ic, st, buf, sizeof(buf)));
|
||||
stream_close(s, start_index);
|
||||
|
|
@ -947,7 +947,7 @@ static CmdDef video_commands[] = {
|
|||
};
|
||||
|
||||
ModeDef video_mode = {
|
||||
"av",
|
||||
"av",
|
||||
instance_size: sizeof(VideoState),
|
||||
mode_probe: video_mode_probe,
|
||||
mode_init: video_mode_init,
|
||||
|
|
|
|||
34
win32.c
34
win32.c
|
|
@ -41,7 +41,7 @@ typedef struct QEEventQ {
|
|||
QEEvent ev;
|
||||
struct QEEventQ *next;
|
||||
} QEEventQ;
|
||||
|
||||
|
||||
QEEventQ *first_event, *last_event;
|
||||
WinWindow win_ctx;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ WinWindow win_ctx;
|
|||
|
||||
/* the main is there. We simulate a unix command line by parsing the
|
||||
windows command line */
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
char **argv;
|
||||
|
|
@ -116,7 +116,7 @@ static int win_probe(void)
|
|||
static void init_application(void)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = qe_wnd_proc;
|
||||
wc.cbClsExtra = 0;
|
||||
|
|
@ -127,7 +127,7 @@ static void init_application(void)
|
|||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "qemacs";
|
||||
|
||||
|
||||
RegisterClass(&wc);
|
||||
}
|
||||
|
||||
|
|
@ -137,16 +137,16 @@ static int win_init(QEditScreen *s, int w, int h)
|
|||
TEXTMETRIC tm;
|
||||
HDC hdc;
|
||||
HWND desktop_hwnd;
|
||||
|
||||
if (!_hPrev)
|
||||
|
||||
if (!_hPrev)
|
||||
init_application();
|
||||
|
||||
memcpy(&s->dpy, &win32_dpy, sizeof(QEDisplay));
|
||||
|
||||
s->private = NULL;
|
||||
s->media = CSS_MEDIA_SCREEN;
|
||||
|
||||
win_ctx.font = CreateFont(-12, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
win_ctx.font = CreateFont(-12, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0,
|
||||
FIXED_PITCH, "fixed");
|
||||
|
||||
/* get font metric for window size */
|
||||
|
|
@ -171,7 +171,7 @@ static int win_init(QEditScreen *s, int w, int h)
|
|||
s->clip_x2 = s->width;
|
||||
s->clip_y2 = s->height;
|
||||
|
||||
win_ctx.w = CreateWindow("qemacs", "qemacs", WS_OVERLAPPEDWINDOW,
|
||||
win_ctx.w = CreateWindow("qemacs", "qemacs", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, xsize, ysize, NULL, NULL, _hInstance, NULL);
|
||||
|
||||
win_ctx.hdc = GetDC(win_ctx.w);
|
||||
|
|
@ -181,7 +181,7 @@ static int win_init(QEditScreen *s, int w, int h)
|
|||
|
||||
ShowWindow(win_ctx.w, SW_SHOW);
|
||||
UpdateWindow(win_ctx.w);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ static int win_is_user_input_pending(QEditScreen *s)
|
|||
static void push_event(QEEvent *ev)
|
||||
{
|
||||
QEEventQ *e;
|
||||
|
||||
|
||||
e = qe_malloc(QEEventQ);
|
||||
if (!e)
|
||||
return;
|
||||
|
|
@ -236,7 +236,7 @@ LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
/* NOTE: must store them here to avoid problems in main */
|
||||
win_ctx.w = hWnd;
|
||||
return 0;
|
||||
|
||||
|
||||
/* key handling */
|
||||
case WM_CHAR:
|
||||
if (!ignore_wchar_msg) {
|
||||
|
|
@ -276,7 +276,7 @@ LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
case 0x039: /* space */
|
||||
ignore_wchar_msg = 1;
|
||||
if (!ctrl)
|
||||
if (!ctrl)
|
||||
push_key(KEY_SPC);
|
||||
else
|
||||
push_key(KEY_CTRL('@'));
|
||||
|
|
@ -350,7 +350,7 @@ LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
case 0x58: /* F12 */
|
||||
push_key(KEY_F12);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_KEYUP:
|
||||
ignore_wchar_msg = 0;
|
||||
break;
|
||||
|
||||
|
||||
case WM_SYSKEYUP:
|
||||
ignore_wchar_msg = 0;
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
|
|
@ -384,7 +384,7 @@ LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
win_ctx.hdc = ps.hdc;
|
||||
SelectObject(win_ctx.hdc, win_ctx.font);
|
||||
do_refresh(NULL);
|
||||
|
||||
|
||||
EndPaint(win_ctx.w, &ps);
|
||||
win_ctx.hdc = saved_hdc;
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ static void win_close_font(QEditScreen *s, QEFont *font)
|
|||
qe_free(&font);
|
||||
}
|
||||
|
||||
static void win_text_metrics(QEditScreen *s, QEFont *font,
|
||||
static void win_text_metrics(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len)
|
||||
{
|
||||
|
|
|
|||
142
x11.c
142
x11.c
|
|
@ -97,7 +97,7 @@ static const char *default_x11_fonts[NB_FONT_FAMILIES] = {
|
|||
"times,unifont",
|
||||
"helvetica,unifont",
|
||||
};
|
||||
|
||||
|
||||
#ifdef CONFIG_DOUBLE_BUFFER
|
||||
static void update_reset(void)
|
||||
{
|
||||
|
|
@ -113,14 +113,14 @@ static inline int rect_dist(CSSRect *r1, CSSRect *r2)
|
|||
|
||||
if (r2->x2 < r1->x1)
|
||||
dx = r1->x1 - r2->x2;
|
||||
else if (r2->x1 > r1->x2)
|
||||
else if (r2->x1 > r1->x2)
|
||||
dx = r2->x1 - r1->x2;
|
||||
else
|
||||
dx = 0;
|
||||
|
||||
if (r2->y2 < r1->y1)
|
||||
dy = r1->y1 - r2->y2;
|
||||
else if (r2->y1 > r1->y2)
|
||||
else if (r2->y1 > r1->y2)
|
||||
dy = r2->y1 - r1->y2;
|
||||
else
|
||||
dy = 0;
|
||||
|
|
@ -216,7 +216,7 @@ static int term_init(QEditScreen *s, int w, int h)
|
|||
if (font_ptsize)
|
||||
qe_styles[0].font_size = font_ptsize;
|
||||
get_style(NULL, &default_style, 0);
|
||||
font = term_open_font(s, default_style.font_style,
|
||||
font = term_open_font(s, default_style.font_style,
|
||||
default_style.font_size);
|
||||
if (!font) {
|
||||
fprintf(stderr, "Could not open default font\n");
|
||||
|
|
@ -225,7 +225,7 @@ static int term_init(QEditScreen *s, int w, int h)
|
|||
font_ysize = font->ascent + font->descent;
|
||||
font_xsize = glyph_width(s, font, 'x');
|
||||
term_close_font(s, font);
|
||||
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
xsize = w;
|
||||
ysize = h;
|
||||
|
|
@ -294,7 +294,7 @@ static int term_init(QEditScreen *s, int w, int h)
|
|||
if (xev.type == MapNotify && xev.xmap.event == window)
|
||||
break;
|
||||
}
|
||||
event_mask = KeyPressMask | ButtonPressMask | ButtonReleaseMask |
|
||||
event_mask = KeyPressMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | ExposureMask | StructureNotifyMask;
|
||||
XSelectInput(display, window, event_mask);
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ static int term_init(QEditScreen *s, int w, int h)
|
|||
|
||||
gc = XCreateGC(display, window, 0, NULL);
|
||||
#ifdef CONFIG_XFT
|
||||
renderDraw = XftDrawCreate(display, window, attr.visual,
|
||||
renderDraw = XftDrawCreate(display, window, attr.visual,
|
||||
DefaultColormap(display, xscreen));
|
||||
#endif
|
||||
/* double buffer handling */
|
||||
|
|
@ -332,7 +332,7 @@ static int term_init(QEditScreen *s, int w, int h)
|
|||
#ifdef CONFIG_DOUBLE_BUFFER
|
||||
dbuffer = XCreatePixmap(display, window, xsize, ysize, attr.depth);
|
||||
/* erase pixmap */
|
||||
XFillRectangle(display, dbuffer, gc,
|
||||
XFillRectangle(display, dbuffer, gc,
|
||||
0, 0, xsize, ysize);
|
||||
update_reset();
|
||||
#else
|
||||
|
|
@ -382,15 +382,15 @@ static void xv_init(QEditScreen *s)
|
|||
|
||||
xv_port = 0; /* zero means no XV port found */
|
||||
if (XvQueryAdaptors(display,
|
||||
DefaultRootWindow(display),
|
||||
DefaultRootWindow(display),
|
||||
&xv_nb_adaptors, &xv_ai) != Success)
|
||||
return;
|
||||
|
||||
for (i = 0; i < (int)xv_nb_adaptors; i++) {
|
||||
if ((xv_ai[i].type & XvInputMask) &&
|
||||
if ((xv_ai[i].type & XvInputMask) &&
|
||||
(xv_ai[i].type & XvImageMask)) {
|
||||
for (xv_p = xv_ai[i].base_id;
|
||||
xv_p < (XvPortID)(xv_ai[i].base_id + xv_ai[i].num_ports);
|
||||
for (xv_p = xv_ai[i].base_id;
|
||||
xv_p < (XvPortID)(xv_ai[i].base_id + xv_ai[i].num_ports);
|
||||
xv_p++) {
|
||||
if (!XvGrabPort(display, xv_p, CurrentTime)) {
|
||||
xv_port = xv_p;
|
||||
|
|
@ -401,13 +401,13 @@ static void xv_init(QEditScreen *s)
|
|||
}
|
||||
return;
|
||||
found:
|
||||
|
||||
|
||||
xv_fo = XvListImageFormats(display, xv_port, &xv_nb_formats);
|
||||
for (i = 0; i < xv_nb_formats; i++) {
|
||||
XvImageFormatValues *fo = &xv_fo[i];
|
||||
#if 0
|
||||
printf("Xvideo image format: 0x%x (%c%c%c%c) %s\n",
|
||||
fo->id,
|
||||
printf("Xvideo image format: 0x%x (%c%c%c%c) %s\n",
|
||||
fo->id,
|
||||
(fo->id) & 0xff,
|
||||
(fo->id >> 8) & 0xff,
|
||||
(fo->id >> 16) & 0xff,
|
||||
|
|
@ -448,7 +448,7 @@ static void term_resize(QEditScreen *s, int w, int h)
|
|||
dbuffer = XCreatePixmap(display, window, w, h, attr.depth);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static unsigned long get_x11_color(QEColor color)
|
||||
{
|
||||
unsigned int r, g, b;
|
||||
|
|
@ -467,7 +467,7 @@ static unsigned long get_x11_color(QEColor color)
|
|||
return (r << 16) | (g << 8) | b;
|
||||
default:
|
||||
/* NOTE: the color is never freed */
|
||||
/* XXX: should do allocation ourself ? */
|
||||
/* XXX: should do allocation ourself ? */
|
||||
col.red = r << 8;
|
||||
col.green = g << 8;
|
||||
col.blue = b << 8;
|
||||
|
|
@ -476,7 +476,7 @@ static unsigned long get_x11_color(QEColor color)
|
|||
}
|
||||
}
|
||||
|
||||
static void xor_rectangle(__unused__ QEditScreen *s,
|
||||
static void xor_rectangle(__unused__ QEditScreen *s,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
int fg;
|
||||
|
|
@ -505,7 +505,7 @@ static void term_fill_rectangle(QEditScreen *s,
|
|||
xor_rectangle(s, x1, y1, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
a = (color >> 24) & 0xff;
|
||||
r = (color >> 16) & 0xff;
|
||||
g = (color >> 8) & 0xff;
|
||||
|
|
@ -548,7 +548,7 @@ static QEFont *term_open_font(QEditScreen *s, int style, int size)
|
|||
slant = XFT_SLANT_ROMAN;
|
||||
if (style & QE_STYLE_ITALIC)
|
||||
slant = XFT_SLANT_ITALIC;
|
||||
renderFont = XftFontOpen(display, xscreen,
|
||||
renderFont = XftFontOpen(display, xscreen,
|
||||
XFT_FAMILY, XftTypeString, family,
|
||||
XFT_SIZE, XftTypeInteger, size,
|
||||
XFT_WEIGHT, XftTypeInteger, weight,
|
||||
|
|
@ -593,7 +593,7 @@ static void term_draw_text(QEditScreen *s, QEFont *font,
|
|||
XftFont *renderFont = font->private;
|
||||
XftColor col;
|
||||
int r, g, b, a;
|
||||
|
||||
|
||||
a = (color >> 24) & 0xff;
|
||||
r = (color >> 16) & 0xff;
|
||||
g = (color >> 8) & 0xff;
|
||||
|
|
@ -604,8 +604,8 @@ static void term_draw_text(QEditScreen *s, QEFont *font,
|
|||
col.color.blue = b << 8;
|
||||
col.color.alpha = a << 8;
|
||||
col.pixel = get_x11_color(color);
|
||||
|
||||
XftDrawString32(renderDraw, &col, renderFont, x, y,
|
||||
|
||||
XftDrawString32(renderDraw, &col, renderFont, x, y,
|
||||
(XftChar32 *)str, len);
|
||||
}
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ static QEFont *term_open_font(__unused__ QEditScreen *s, int style, int size)
|
|||
font = qe_malloc(QEFont);
|
||||
if (!font)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* get font name */
|
||||
font_index = ((style & QE_FAMILY_MASK) >> QE_FAMILY_SHIFT) - 1;
|
||||
if ((unsigned)font_index >= NB_FONT_FAMILIES)
|
||||
|
|
@ -699,7 +699,7 @@ static QEFont *term_open_font(__unused__ QEditScreen *s, int style, int size)
|
|||
else
|
||||
strcpy(buf1, "*");
|
||||
snprintf(buf, sizeof(buf),
|
||||
"-*-%s-*-*-*-*-*-%s-*-*-*-*-*-*",
|
||||
"-*-%s-*-*-*-*-*-%s-*-*-*-*-*-*",
|
||||
family, buf1);
|
||||
list = XListFonts(display, buf, 256, &count);
|
||||
if (count > 0)
|
||||
|
|
@ -711,7 +711,7 @@ static QEFont *term_open_font(__unused__ QEditScreen *s, int style, int size)
|
|||
/* note: we do not want the X server to scale the font (usually
|
||||
ugly result), so we do not ask a given size */
|
||||
snprintf(buf, sizeof(buf),
|
||||
"-*-%s-*-*-*-*-*-%s-*-*-*-*-*-*",
|
||||
"-*-%s-*-*-*-*-*-%s-*-*-*-*-*-*",
|
||||
family, "*");
|
||||
list = XListFonts(display, buf, 256, &count);
|
||||
if (count == 0)
|
||||
|
|
@ -811,7 +811,7 @@ static XCharStruct *get_char_struct(QEFont *font, int cc)
|
|||
b2 -= xfont->min_char_or_byte2;
|
||||
if (b2 < 0)
|
||||
return NULL;
|
||||
cc = b1 * (xfont->max_char_or_byte2 -
|
||||
cc = b1 * (xfont->max_char_or_byte2 -
|
||||
xfont->min_char_or_byte2 + 1) + b2;
|
||||
}
|
||||
cs = xfont->per_char;
|
||||
|
|
@ -827,7 +827,7 @@ static XCharStruct *get_char_struct(QEFont *font, int cc)
|
|||
}
|
||||
}
|
||||
|
||||
static XCharStruct *handle_fallback(QEditScreen *s, QEFont **out_font,
|
||||
static XCharStruct *handle_fallback(QEditScreen *s, QEFont **out_font,
|
||||
QEFont *font, unsigned int cc)
|
||||
{
|
||||
XFontStruct *xfont;
|
||||
|
|
@ -838,7 +838,7 @@ static XCharStruct *handle_fallback(QEditScreen *s, QEFont **out_font,
|
|||
|
||||
/* fallback case */
|
||||
for (fallback_count = 1; fallback_count < 5; fallback_count++) {
|
||||
font1 = select_font(s, font->style |
|
||||
font1 = select_font(s, font->style |
|
||||
(fallback_count << QE_FAMILY_FALLBACK_SHIFT),
|
||||
font->size);
|
||||
if (!font1)
|
||||
|
|
@ -850,7 +850,7 @@ static XCharStruct *handle_fallback(QEditScreen *s, QEFont **out_font,
|
|||
}
|
||||
release_font(s, font1);
|
||||
}
|
||||
|
||||
|
||||
/* really no glyph : use default char in current font */
|
||||
xfont = font->private;
|
||||
cs = get_char_struct(font, xfont->default_char);
|
||||
|
|
@ -858,7 +858,7 @@ static XCharStruct *handle_fallback(QEditScreen *s, QEFont **out_font,
|
|||
return cs;
|
||||
}
|
||||
|
||||
static void term_text_metrics(QEditScreen *s, QEFont *font,
|
||||
static void term_text_metrics(QEditScreen *s, QEFont *font,
|
||||
QECharMetrics *metrics,
|
||||
const unsigned int *str, int len)
|
||||
{
|
||||
|
|
@ -906,7 +906,7 @@ static void term_draw_text(QEditScreen *s, QEFont *font,
|
|||
int i, l, x, x_start;
|
||||
unsigned int cc;
|
||||
unsigned long xcolor;
|
||||
|
||||
|
||||
xcolor = get_x11_color(color);
|
||||
XSetForeground(display, gc, xcolor);
|
||||
q = x11_str;
|
||||
|
|
@ -1032,13 +1032,13 @@ static void x11_full_screen(__unused__ QEditScreen *s, int full_screen)
|
|||
&last_window_x, &last_window_y, &win);
|
||||
last_window_width = attr1.width;
|
||||
last_window_height = attr1.height;
|
||||
XMoveResizeWindow(display, window,
|
||||
XMoveResizeWindow(display, window,
|
||||
0, 0, screen_width, screen_height);
|
||||
}
|
||||
} else if (!full_screen) {
|
||||
if (attr1.width == screen_width && attr1.height == screen_height) {
|
||||
XMoveResizeWindow(display, window,
|
||||
last_window_x, last_window_y,
|
||||
XMoveResizeWindow(display, window,
|
||||
last_window_x, last_window_y,
|
||||
last_window_width, last_window_height);
|
||||
}
|
||||
}
|
||||
|
|
@ -1083,13 +1083,13 @@ static void term_selection_request(__unused__ QEditScreen *s)
|
|||
/* XXX: add timeout too if the target application is not well
|
||||
educated */
|
||||
XIfEvent(display, &xev, test_event, NULL);
|
||||
|
||||
|
||||
w = xev.xselection.requestor;
|
||||
prop = xev.xselection.property;
|
||||
|
||||
|
||||
/* copy GUI selection a new yank buffer */
|
||||
b = new_yank_buffer();
|
||||
|
||||
|
||||
nread = 0;
|
||||
for (;;) {
|
||||
if ((XGetWindowProperty(display, w, prop,
|
||||
|
|
@ -1101,12 +1101,12 @@ static void term_selection_request(__unused__ QEditScreen *s)
|
|||
XFree(data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
eb_write(b, nread, data, nitems);
|
||||
|
||||
|
||||
nread += nitems;
|
||||
XFree(data);
|
||||
|
||||
|
||||
if (bytes_after == 0)
|
||||
break;
|
||||
}
|
||||
|
|
@ -1123,7 +1123,7 @@ static void selection_send(XSelectionRequestEvent *rq)
|
|||
|
||||
if (xa_targets == None)
|
||||
xa_targets = XInternAtom(display, "TARGETS", False);
|
||||
|
||||
|
||||
ev.xselection.type = SelectionNotify;
|
||||
ev.xselection.property = None;
|
||||
ev.xselection.display = rq->display;
|
||||
|
|
@ -1145,15 +1145,15 @@ static void selection_send(XSelectionRequestEvent *rq)
|
|||
countof(target_list));
|
||||
} else if (rq->target == XA_STRING) {
|
||||
/* get qemacs yank buffer */
|
||||
|
||||
|
||||
b = qs->yank_buffers[qs->yank_current];
|
||||
if (!b)
|
||||
if (!b)
|
||||
return;
|
||||
buf = qe_malloc_array(unsigned char, b->total_size);
|
||||
if (!buf)
|
||||
return;
|
||||
eb_read(b, 0, buf, b->total_size);
|
||||
|
||||
|
||||
XChangeProperty(display, rq->requestor, rq->property,
|
||||
XA_STRING, 8, PropModeReplace,
|
||||
buf, b->total_size);
|
||||
|
|
@ -1425,7 +1425,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
if (shm_use)
|
||||
if (shm_use)
|
||||
xb->type = BMP_XSHMIMAGE;
|
||||
else
|
||||
xb->type = BMP_XIMAGE;
|
||||
|
|
@ -1439,7 +1439,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
switch (xb->type) {
|
||||
default:
|
||||
case BMP_PIXMAP:
|
||||
xb->u.pixmap = XCreatePixmap(display, window,
|
||||
xb->u.pixmap = XCreatePixmap(display, window,
|
||||
b->width, b->height, attr.depth);
|
||||
if (!xb->u.pixmap)
|
||||
goto fail;
|
||||
|
|
@ -1447,7 +1447,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
case BMP_XIMAGE:
|
||||
{
|
||||
XImage *ximage;
|
||||
ximage = XCreateImage(display, None, attr.depth, ZPixmap, 0,
|
||||
ximage = XCreateImage(display, None, attr.depth, ZPixmap, 0,
|
||||
NULL, b->width, b->height, 8, 0);
|
||||
ximage->data = qe_malloc_array(char, b->height * ximage->bytes_per_line);
|
||||
xb->u.ximage = ximage;
|
||||
|
|
@ -1457,7 +1457,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
{
|
||||
XImage *ximage;
|
||||
XShmSegmentInfo *shm_info;
|
||||
|
||||
|
||||
/* XXX: error testing */
|
||||
shm_info = qe_malloc(XShmSegmentInfo);
|
||||
ximage = XShmCreateImage(display, None, attr.depth, ZPixmap, NULL,
|
||||
|
|
@ -1468,10 +1468,10 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
ximage->data = shmat(shm_info->shmid, 0, 0);
|
||||
shm_info->shmaddr = ximage->data;
|
||||
shm_info->readOnly = False;
|
||||
|
||||
|
||||
XShmAttach(display, shm_info);
|
||||
XSync(display, False);
|
||||
|
||||
|
||||
/* the shared memory will be automatically deleted */
|
||||
shmctl(shm_info->shmid, IPC_RMID, 0);
|
||||
xb->shm_info = shm_info;
|
||||
|
|
@ -1482,7 +1482,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
case BMP_XVIMAGE:
|
||||
{
|
||||
XvImage *xvimage;
|
||||
xvimage = XvCreateImage(display, xv_port, xv_format, 0,
|
||||
xvimage = XvCreateImage(display, xv_port, xv_format, 0,
|
||||
b->width, b->height);
|
||||
xvimage->data = qe_malloc_array(char, xvimage->data_size);
|
||||
xb->u.xvimage = xvimage;
|
||||
|
|
@ -1494,7 +1494,7 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
XShmSegmentInfo *shm_info;
|
||||
|
||||
shm_info = qe_malloc(XShmSegmentInfo);
|
||||
xvimage = XvShmCreateImage(display, xv_port, xv_format, 0,
|
||||
xvimage = XvShmCreateImage(display, xv_port, xv_format, 0,
|
||||
b->width, b->height, shm_info);
|
||||
shm_info->shmid = shmget(IPC_PRIVATE,
|
||||
xvimage->data_size,
|
||||
|
|
@ -1502,10 +1502,10 @@ static int x11_bmp_alloc(QEditScreen *s, QEBitmap *b)
|
|||
xvimage->data = shmat(shm_info->shmid, 0, 0);
|
||||
shm_info->shmaddr = xvimage->data;
|
||||
shm_info->readOnly = False;
|
||||
|
||||
|
||||
XShmAttach(display, shm_info);
|
||||
XSync(display, False);
|
||||
|
||||
|
||||
/* the shared memory will be automatically deleted */
|
||||
shmctl(shm_info->shmid, IPC_RMID, 0);
|
||||
xb->shm_info = shm_info;
|
||||
|
|
@ -1556,8 +1556,8 @@ static void x11_bmp_free(__unused__ QEditScreen *s, QEBitmap *b)
|
|||
qe_free(&b->priv_data);
|
||||
}
|
||||
|
||||
static void x11_bmp_draw(__unused__ QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
static void x11_bmp_draw(__unused__ QEditScreen *s, QEBitmap *b,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
__unused__ int offset_x, __unused__ int offset_y,
|
||||
__unused__ int flags)
|
||||
{
|
||||
|
|
@ -1568,18 +1568,18 @@ static void x11_bmp_draw(__unused__ QEditScreen *s, QEBitmap *b,
|
|||
|
||||
switch (xb->type) {
|
||||
case BMP_PIXMAP:
|
||||
XCopyArea(display, xb->u.pixmap, dbuffer, gc,
|
||||
XCopyArea(display, xb->u.pixmap, dbuffer, gc,
|
||||
0, 0, b->width, b->height, dst_x, dst_y);
|
||||
break;
|
||||
case BMP_XIMAGE:
|
||||
XPutImage(display, dbuffer, gc,
|
||||
xb->u.ximage, 0, 0, dst_x, dst_y,
|
||||
XPutImage(display, dbuffer, gc,
|
||||
xb->u.ximage, 0, 0, dst_x, dst_y,
|
||||
b->width, b->height);
|
||||
break;
|
||||
|
||||
case BMP_XSHMIMAGE:
|
||||
XShmPutImage(display, dbuffer, gc,
|
||||
xb->u.ximage, 0, 0, dst_x, dst_y,
|
||||
XShmPutImage(display, dbuffer, gc,
|
||||
xb->u.ximage, 0, 0, dst_x, dst_y,
|
||||
b->width, b->height, False);
|
||||
break;
|
||||
#ifdef CONFIG_XV
|
||||
|
|
@ -1610,7 +1610,7 @@ static void x11_bmp_lock(__unused__ QEditScreen *s, QEBitmap *b, QEPicture *pict
|
|||
case BMP_PIXMAP:
|
||||
{
|
||||
XImage *ximage;
|
||||
ximage = XCreateImage(display, None, attr.depth, ZPixmap, 0,
|
||||
ximage = XCreateImage(display, None, attr.depth, ZPixmap, 0,
|
||||
NULL, w1, h1, 8, 0);
|
||||
ximage->data = qe_malloc_array(char, h1 * ximage->bytes_per_line);
|
||||
pict->data[0] = (unsigned char *)ximage->data;
|
||||
|
|
@ -1623,7 +1623,7 @@ static void x11_bmp_lock(__unused__ QEditScreen *s, QEBitmap *b, QEPicture *pict
|
|||
case BMP_XIMAGE:
|
||||
case BMP_XSHMIMAGE:
|
||||
bpp = (xb->u.ximage->bits_per_pixel + 7) >> 3;
|
||||
pict->data[0] = (unsigned char *)xb->u.ximage->data +
|
||||
pict->data[0] = (unsigned char *)xb->u.ximage->data +
|
||||
y1 * xb->u.ximage->bytes_per_line + x1 * bpp;
|
||||
pict->linesize[0] = xb->u.ximage->bytes_per_line;
|
||||
break;
|
||||
|
|
@ -1644,7 +1644,7 @@ static void x11_bmp_lock(__unused__ QEditScreen *s, QEBitmap *b, QEPicture *pict
|
|||
j = 3 - i; /* don't know why they inverted Cb and Cr! */
|
||||
}
|
||||
pict->data[j] = (unsigned char *)xvimage->data +
|
||||
xvimage->offsets[i] +
|
||||
xvimage->offsets[i] +
|
||||
yy * xvimage->pitches[i] + xx;
|
||||
pict->linesize[j] = xvimage->pitches[i];
|
||||
}
|
||||
|
|
@ -1660,8 +1660,8 @@ static void x11_bmp_unlock(__unused__ QEditScreen *s, QEBitmap *b)
|
|||
int ret;
|
||||
switch (xb->type) {
|
||||
case BMP_PIXMAP:
|
||||
ret = XPutImage(display, xb->u.pixmap, gc_pixmap, xb->ximage_lock,
|
||||
0, 0, xb->x_lock, xb->y_lock,
|
||||
ret = XPutImage(display, xb->u.pixmap, gc_pixmap, xb->ximage_lock,
|
||||
0, 0, xb->x_lock, xb->y_lock,
|
||||
xb->ximage_lock->width, xb->ximage_lock->height);
|
||||
/* NOTE: also frees the ximage data */
|
||||
XDestroyImage(xb->ximage_lock);
|
||||
|
|
@ -1699,13 +1699,13 @@ static QEDisplay x11_dpy = {
|
|||
};
|
||||
|
||||
static CmdOptionDef cmd_options[] = {
|
||||
{ "no-windows", "nw", NULL, CMD_OPT_BOOL, "force tty terminal usage",
|
||||
{ "no-windows", "nw", NULL, CMD_OPT_BOOL, "force tty terminal usage",
|
||||
{ .int_ptr = &force_tty }},
|
||||
{ "display", "d", "display", CMD_OPT_STRING | CMD_OPT_ARG, "set X11 display",
|
||||
{ "display", "d", "display", CMD_OPT_STRING | CMD_OPT_ARG, "set X11 display",
|
||||
{ .string_ptr = &display_str }},
|
||||
{ "geometry", "g", "WxH", CMD_OPT_STRING | CMD_OPT_ARG, "set X11 display size",
|
||||
{ "geometry", "g", "WxH", CMD_OPT_STRING | CMD_OPT_ARG, "set X11 display size",
|
||||
{ .string_ptr = &geometry_str }},
|
||||
{ "font-size", "fs", "ptsize", CMD_OPT_INT | CMD_OPT_ARG, "set default font size",
|
||||
{ "font-size", "fs", "ptsize", CMD_OPT_INT | CMD_OPT_ARG, "set default font size",
|
||||
{ .int_ptr = &font_ptsize }},
|
||||
{ NULL, NULL, NULL, 0, NULL, { NULL }},
|
||||
};
|
||||
|
|
|
|||
10
xml.c
10
xml.c
|
|
@ -23,19 +23,19 @@
|
|||
/* colorization states */
|
||||
enum {
|
||||
XML_TAG = 1,
|
||||
XML_COMMENT,
|
||||
XML_COMMENT,
|
||||
XML_TAG_SCRIPT,
|
||||
XML_TAG_STYLE,
|
||||
XML_STYLE,
|
||||
XML_SCRIPT = 0x10, /* special mode for inside a script, ored with c mode */
|
||||
};
|
||||
|
||||
static void xml_colorize_line(unsigned int *buf, __unused__ int len,
|
||||
static void xml_colorize_line(unsigned int *buf, __unused__ int len,
|
||||
int *colorize_state_ptr, int state_only)
|
||||
{
|
||||
int c, state;
|
||||
unsigned int *p, *p_start, *p1;
|
||||
|
||||
|
||||
state = *colorize_state_ptr;
|
||||
p = buf;
|
||||
p_start = p;
|
||||
|
|
@ -111,7 +111,7 @@ static void xml_colorize_line(unsigned int *buf, __unused__ int len,
|
|||
state |= XML_SCRIPT;
|
||||
break;
|
||||
} else if (ustristart(p, "</SCRIPT", (const unsigned int **)&p1)) {
|
||||
while (*p1 != '\n' && *p1 != '>')
|
||||
while (*p1 != '\n' && *p1 != '>')
|
||||
p1++;
|
||||
if (*p1 == '>')
|
||||
p1++;
|
||||
|
|
@ -136,7 +136,7 @@ static void xml_colorize_line(unsigned int *buf, __unused__ int len,
|
|||
set_color(p_start, p, QE_STYLE_CSS);
|
||||
break;
|
||||
} else if (ustristart(p, "</STYLE", (const unsigned int **)&p1)) {
|
||||
while (*p1 != '\n' && *p1 != '>')
|
||||
while (*p1 != '\n' && *p1 != '>')
|
||||
p1++;
|
||||
if (*p1 == '>')
|
||||
p1++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue