summaryrefslogtreecommitdiffstats
path: root/src/core/ansiesc.c
diff options
context:
space:
mode:
authorMichael Brown2013-11-25 15:01:40 +0100
committerMichael Brown2013-11-27 12:27:50 +0100
commit02a63c6dec835943bf9bf64fae72d391c696a639 (patch)
tree21cd9a0967675db705cfe66168fea950b7f4d03e /src/core/ansiesc.c
parent[main] Defer "initialising devices" message until initialising devices (diff)
downloadipxe-02a63c6dec835943bf9bf64fae72d391c696a639.tar.gz
ipxe-02a63c6dec835943bf9bf64fae72d391c696a639.tar.xz
ipxe-02a63c6dec835943bf9bf64fae72d391c696a639.zip
[console] Pass escape sequence context to ANSI escape sequence handlers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/ansiesc.c')
-rw-r--r--src/core/ansiesc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/ansiesc.c b/src/core/ansiesc.c
index 32e9d7c9..68e7061b 100644
--- a/src/core/ansiesc.c
+++ b/src/core/ansiesc.c
@@ -32,19 +32,20 @@ FILE_LICENCE ( GPL2_OR_LATER );
/**
* Call ANSI escape sequence handler
*
- * @v handlers List of escape sequence handlers
+ * @v ctx ANSI escape sequence context
* @v function Control function identifier
* @v count Parameter count
* @v params Parameter list
*/
-static void ansiesc_call_handler ( struct ansiesc_handler *handlers,
+static void ansiesc_call_handler ( struct ansiesc_context *ctx,
unsigned int function, int count,
int params[] ) {
+ struct ansiesc_handler *handlers = ctx->handlers;
struct ansiesc_handler *handler;
for ( handler = handlers ; handler->function ; handler++ ) {
if ( handler->function == function ) {
- handler->handle ( count, params );
+ handler->handle ( ctx, count, params );
break;
}
}
@@ -67,6 +68,7 @@ static void ansiesc_call_handler ( struct ansiesc_handler *handlers,
* sequences we are prepared to accept as valid.
*/
int ansiesc_process ( struct ansiesc_context *ctx, int c ) {
+
if ( ctx->count == 0 ) {
if ( c == ESC ) {
/* First byte of CSI : begin escape sequence */
@@ -109,7 +111,7 @@ int ansiesc_process ( struct ansiesc_context *ctx, int c ) {
ctx->count = 0;
ctx->function <<= 8;
ctx->function |= c;
- ansiesc_call_handler ( ctx->handlers, ctx->function,
+ ansiesc_call_handler ( ctx, ctx->function,
count, ctx->params );
}
return -1;