in reply to Re: Manipulating STDIN
in thread Manipulating STDIN
Yeah I'm sorry about that. Had to take it down. Don't want to get plagiarised.
Anyway to the other replies, the reason I want to unshift to STDIN is because when my forth interpreter reads the "call" function, I want to unshift the commands stored in the variable onto STDIN. I'll elaborate. When curly braces are encountered, everything in it until the closing brace is added to a string. This string is then stored into a variable declared earlier. Like:
pop3 { pop pop pop } store
the string "pop pop pop" is stored into pop3 (via hash tables)
then, when i do pop3 call, I want to unshift "pop pop pop" onto STDIN to be read.
I've already implemented this differently by reading it everything from STDIN until EOF into a list, then handling each element of the list as though it is read from STDIN. Thus, I can unshift "pop pop pop" onto the list.
Is there any other way to do this more elegantly?