From patchwork Wed Oct 18 08:32:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 827498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yH50P5ZVdz9t3h for ; Wed, 18 Oct 2017 19:32:37 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yH50P3vD9zDrGD for ; Wed, 18 Oct 2017 19:32:37 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lvivier@redhat.com; receiver=) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yH50M1L9xzDrG1 for ; Wed, 18 Oct 2017 19:32:35 +1100 (AEDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58AF05F739 for ; Wed, 18 Oct 2017 08:32:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 58AF05F739 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lvivier@redhat.com Received: from thinkpad.redhat.com (ovpn-117-68.ams2.redhat.com [10.36.117.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC0347C665 for ; Wed, 18 Oct 2017 08:32:32 +0000 (UTC) From: Laurent Vivier To: slof@lists.ozlabs.org Date: Wed, 18 Oct 2017 10:32:30 +0200 Message-Id: <20171018083230.24435-2-lvivier@redhat.com> In-Reply-To: <20171018083230.24435-1-lvivier@redhat.com> References: <20171018083230.24435-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 18 Oct 2017 08:32:33 +0000 (UTC) Subject: [SLOF] [PATCH v2 1/1] Fix output word X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" We can select the console output, but it does not really work Implement term-io-emit, as we have term-io-key to really send characters to the output selected by stdout. Signed-off-by: Laurent Vivier --- slof/fs/term-io.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/slof/fs/term-io.fs b/slof/fs/term-io.fs index 52ce12a..f801f8b 100644 --- a/slof/fs/term-io.fs +++ b/slof/fs/term-io.fs @@ -22,6 +22,9 @@ THEN ; +0 VALUE stdout_ihandle +0 VALUE write_xt + : output ( dev-str dev-len -- ) open-dev ?dup IF \ Close old stdout: @@ -29,7 +32,10 @@ decode-int nip nip ?dup IF close-dev THEN THEN \ Now set the new stdout: + dup to stdout_ihandle encode-int s" stdout" set-chosen + s" write" stdout_ihandle ihandle>phandle find-method + 0= IF 0 THEN to write_xt THEN ; @@ -40,6 +46,15 @@ 1 BUFFER: (term-io-char-buf) +: term-io-emit ( char -- ) + write_xt 0= IF [ ' emit behavior compile, ] EXIT THEN + (term-io-char-buf) c! + (term-io-char-buf) 1 write_xt stdout_ihandle call-package + drop +; + +' term-io-emit to emit + : term-io-key ( -- char ) s" stdin" get-chosen IF decode-int nip nip dup 0= IF 0 EXIT THEN