From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahithi Yarlagadda Subject: Re: Status of Submitted Patches Date: Sat, 12 May 2018 02:46:38 +0530 Message-ID: References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <871sfxev9w.fsf@elephly.net> <7626275c-3eee-bb05-ab9d-4c88ec6f0329@swecha.net> <87r2nvjte6.fsf@elephly.net> <5ab51417-b635-9725-9f48-3bc3f9b61fdf@swecha.net> <87tvsko2wd.fsf@elephly.net> <7290013c-990d-3f7d-d8db-38e090ed766a@swecha.net> <87zi28kt82.fsf@elephly.net> <8573e97d-d107-cde6-cd17-35f4ef6d2de3@swecha.net> <87k1takumm.fsf@elephly.net> <87o9hycwl6.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHFPt-0000m3-Nb for guix-devel@gnu.org; Fri, 11 May 2018 17:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHFPq-0004Ws-Jj for guix-devel@gnu.org; Fri, 11 May 2018 17:17:29 -0400 In-Reply-To: <87o9hycwl6.fsf@elephly.net> Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org Hi On Wednesday 02 May 2018 01:34 PM, Ricardo Wurmus wrote: > Hi Sahithi, > > I’ve previously sent the message below. Have you been able to take a > look at this yet? > > -- > Ricardo > >>> I have gone through the code under guix/store/ and the outputs are sent >>> to a specified scheme variable "current-build-output-port" >> Yes, the “(guix store)” module implements this. >> “current-build-output-port” is a parameter, which is a dynamically bound >> variable (i.e. its value can be changed by the caller) and it defaults >> to the “current-error-port”. I Understood this. >> According to the Guile manual >> >> Ports are the way that Guile performs input and output. Guile can >> read in characters or bytes from an “input port”, or write them out >> to an “output port”. >> >> Ports allow the programmer to ignore the details of input/output sources >> and sinks and concentrate on shuffling characters or bytes around. We >> don’t need to know if the port is connected to a terminal or a file or a >> network socket. >> >> A programmer can implement custom ports with “make-soft-port” and a >> vector of up to five procedures that provide implementations of certain >> operations (such as writing a string to the port). A silly example >> would be a custom port that reads characters from standard input and >> turns them to upper-case characters before passing them to whoever reads >> from the custom port. (use-modules (ice-9 binary-ports)) (define stdout (current-output-port)) (define stdin (current-input-port)) (display stdin) (newline) (display stdout) (newline) (write (char-upcase(read-char(current-input-port)))) >> With what you know about terminal escape codes and the port facility >> that is used in “(guix store)”, can you describe an approach to add >> colours to some text fragments before they are printed? There are at >> least two ways this can be done; one of the two options is more >> complicated but might result in a clearer and more modular >> implementation. For this i tried using (use-modules (ice-9 binary-ports)) (use-modules (ice-9 colorized))  (activate-colorized) (define stdout (current-output-port)) (define stdin (current-input-port)) (display stdin) (newline) (display stdout) (newline) (define a (char-upcase(read-char (current-input-port)))) (display a)    (newline) (display "\x1b[31ma\x1b[0m") (newline) (define b (colorize-string a '(GREEN))) (display b) Resulted: 4058: 2 [#] In /home/sripathroy/Documents/GNUGuix/experiments/sam.scm:   17: 1 [#] In unknown file:    ?: 0 [string-append "\x1b[32m" #\S "\x1b[0m"] ERROR: In procedure string-append: ERROR: In procedure string-append: Wrong type (expecting string): #\S I found that the output is stored as #\. How should i convert to valid format. > > -- Regards Sahithi