[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs qe.h qe.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs qe.h qe.c |
Date: |
Sun, 06 Mar 2016 17:59:22 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 16/03/06 17:59:22
Modified files:
. : qe.h qe.c
Log message:
basic: improved timing feature
- accept non breaking space in qe_isspace() and qe_isblank()
- added cmd_start_time for timings
- added cache qs->diag_shadow for diag/timing messages
- use global state for cmd_start_time to display the innermost timings
- display timings at the bottom right with put_status(s, "|diag");
- prevent qe_register_cmd_line_options from registering the same table
twice
- added dummy option `-nw` so non graphics qemacs does complain
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.211&r2=1.212
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.218&r2=1.219
Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -b -r1.211 -r1.212
--- qe.h 16 Sep 2015 22:18:24 -0000 1.211
+++ qe.h 6 Mar 2016 17:59:22 -0000 1.212
@@ -229,10 +229,10 @@
}
static inline int qe_isspace(int c) {
/* CG: what about \v and \f */
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == 160);
}
static inline int qe_isblank(int c) {
- return (c == ' ' || c == '\t');
+ return (c == ' ' || c == '\t' || c == 160);
}
static inline int qe_isdigit(int c) {
return qe_inrange(c, '0', '9');
@@ -1431,6 +1431,7 @@
/* XXX: move these to ec */
CmdFunc last_cmd_func; /* last executed command function call */
CmdFunc this_cmd_func; /* current executing command */
+ int cmd_start_time;
/* keyboard macros */
int defining_macro;
int executing_macro;
@@ -1447,6 +1448,7 @@
char *tty_charset;
char res_path[1024]; /* exported as QEPATH */
char status_shadow[MAX_SCREEN_WIDTH];
+ char diag_shadow[MAX_SCREEN_WIDTH];
QErrorContext ec;
char system_fonts[NB_FONT_FAMILIES][256];
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -b -r1.218 -r1.219
--- qe.c 14 Oct 2015 09:31:20 -0000 1.218
+++ qe.c 6 Mar 2016 17:59:22 -0000 1.219
@@ -4284,7 +4284,7 @@
char history[32];
unsigned char arg_type;
int ret, rep_count, get_arg, type, use_argval, use_key;
- int start_time, elapsed_time;
+ int elapsed_time;
for (;;) {
ret = parse_arg(&es->ptype, &arg_type,
@@ -4376,7 +4376,7 @@
qs->this_cmd_func = d->action.func;
- start_time = get_clock_ms();
+ qs->cmd_start_time = get_clock_ms();
do {
/* special case for hex mode */
@@ -4399,9 +4399,10 @@
/* CG: Should follow qs->active_window ? */
} while (--rep_count > 0);
- elapsed_time = get_clock_ms() - start_time;
+ elapsed_time = get_clock_ms() - qs->cmd_start_time;
+ qs->cmd_start_time += elapsed_time;
if (elapsed_time >= 100)
- put_status(s, "%s: %dms", d->name, elapsed_time);
+ put_status(s, "|%s: %dms", d->name, elapsed_time);
qs->last_cmd_func = qs->this_cmd_func;
fail:
@@ -4548,7 +4549,7 @@
elapsed_time = get_clock_ms() - start_time;
if (elapsed_time >= 100)
- put_status(s, "edit_display: %dms", elapsed_time);
+ put_status(s, "|edit_display: %dms", elapsed_time);
qs->complete_refresh = 0;
}
@@ -5052,29 +5053,50 @@
char buf[MAX_SCREEN_WIDTH];
const char *p;
va_list ap;
+ int silent = 0;
+ int diag = 0;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
- p = buf;
- if (*p == '~')
- p++;
+ for (p = buf;; p++) {
+ if (*p == '|') {
+ diag = 1;
+ } else
+ if (*p == '~') {
+ silent = 1;
+ } else {
+ break;
+ }
+ }
if (!qs->screen->dpy.dpy_probe) {
eb_format_message(qs, "*errors*", p);
} else {
+ if (diag) {
+ if (!strequal(p, qs->diag_shadow)) {
+ int w = strlen(p) + 1; /* @@@ should right align */
+ print_at_byte(qs->screen,
+ qs->screen->width - w,
+ qs->screen->height - qs->status_height,
+ qs->screen->width - w, qs->status_height,
+ p, QE_STYLE_STATUS);
+ pstrcpy(qs->diag_shadow, sizeof(qs->diag_shadow), p);
+ }
+ } else {
if (!strequal(p, qs->status_shadow)) {
print_at_byte(qs->screen,
0, qs->screen->height - qs->status_height,
qs->screen->width, qs->status_height,
p, QE_STYLE_STATUS);
pstrcpy(qs->status_shadow, sizeof(qs->status_shadow), p);
+ }
+ }
skip_spaces(&p);
- if (*p && *buf != '~')
+ if (!silent)
eb_format_message(qs, "*messages*", buf);
}
- }
}
#if 0
@@ -7670,6 +7692,8 @@
pp = &first_cmd_options;
while (*pp != NULL) {
p = *pp;
+ if (p == table)
+ return; /* already registered */
while (p->name != NULL)
p++;
pp = &p->u.next;
@@ -7725,10 +7749,20 @@
exit(1);
}
+static int force_tty;
+
+static CmdOptionDef null_cmd_options[] = {
+ { "no-windows", "nw", NULL, CMD_OPT_BOOL, "force tty terminal usage",
+ { .int_ptr = &force_tty }},
+ { NULL, NULL, NULL, 0, NULL, { NULL }},
+};
+
static int parse_command_line(int argc, char **argv)
{
int _optind;
+ qe_register_cmd_line_options(null_cmd_options);
+
_optind = 1;
for (;;) {
const char *r, *r1, *r2, *_optarg;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs qe.h qe.c,
Charlie Gordon <=