[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] How to get stdout into gforth

From: Dennis Ruffer
Subject: Re: [gforth] How to get stdout into gforth
Date: Fri, 26 Jan 2018 12:52:42 -0800

Thanks everyone for the suggestions. While OPEN-PIPE sounds like the best place for me to investigate, it turns out that the Makefile logic I was trying to convert didn’t actually need to pull the pwd output into gforth. I translated:


echo $(1): file://$$(cd $(dir $@); pwd)/$(notdir $@)


from Makefile to gforth as:


COMBINED-STRING print_coverage_out_dir +," cd " coverage_out +, +," ; pwd"

CR ( a n ) TYPE ." : file://" print_coverage_out_dir COUNT SYSTEM $? THROW

( target ) COUNT coverage_out COUNT /STRING TYPE


And I got:


CTS Tests API-NDK Coverage Report: file:///home/druffer/master/out/host/linux-x86/cts-api-coverage


Identical to the original, so it is sufficient, for now. I have some other work where OPEN-PIPE might be useful, but I’ve got enough for the immediate issue to move onto the next problems.


Thanks again!




From: Anton Ertl
Sent: Friday, January 26, 2018 1:00 AM
To: gforth
Cc: Dennis Ruffer
Subject: Re: [gforth] How to get stdout into gforth


On Thu, Jan 25, 2018 at 02:49:02PM -0800, Dennis Ruffer wrote:

> Say I want to do something like this:


> s" cd .. ; pwd" system /home/druffer


> How do I get the output of pwd back into gforth?


You would use OPEN-PIPE instead of SYSTEM, but I don't have an example.


> I see infile-execute, but I don’t see an examples for me to try.


INFILE-EXECUTE is for making any file temporarily the standard input

(so that KEY reads from this file).  But for your problem, you need to

get the output of pwd into gforth.  A pipe does that.


> Is that the right path, or is there another?


You could use the C interface to call chdir(), getcwd(), and then

somehow chdir() back.


- anton


reply via email to

[Prev in Thread] Current Thread [Next in Thread]