gnucap-devel
[Top][All Lists]
Advanced

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

Re: [Gnucap-devel] [Child Process unable to receive input from a file(sc


From: Rishabh Yadav
Subject: Re: [Gnucap-devel] [Child Process unable to receive input from a file(script)]
Date: Fri, 27 Jun 2014 00:52:23 +0200

Hi,
So,I caught the "possible" culprit responsible for causing all this
unexpected behaviour
I used get_line() function defined in ap_construct.cc to prompt for input
in my c_if.cc file.I read the source code of get_line function and what I
analyzed is.
The input by get_line() is received in two ways:
1.from file
2.within the interpreter
and out of these two ways one is selected by calling is_file() function
which returns bool value.
is_file() makes sense but still I'd like to tell that is_file() is a
function defined in "ap.h" which returns true if input is to be taken from
a file otherwise false.
Back to c_if.cc
So,in case a script of nested conditional commands in a file is executed
then is_file() is true for outermost level if/elif/else command.But when
this if/elif/else command calls a nested command then it does so via
CMD::command() method and there is_file() returns false and hence get_line
waits for input from user within the interpreter.
I strongly believe we should incorporate this change in ap.h as I was told
by the Felix that he also faced the similar problem.
Let me know your suggestions and possible changes we can make to fix this.

Rishabh Yadav
Junior Undergraduate
Department of Electronics Engineering
IIT (BHU), Varanasi
Varanasi-221005
India


On Thu, Jun 26, 2014 at 2:29 AM, Rishabh Yadav <
address@hidden> wrote:

> Hi,
> I wrote a conditional plugin[1] and it works fine for "nested" conditional
> statements when the commands are entered in the interpreter one by one but
> creates problems when the same commands are read from a file.Mind it this
> only happens in case of "nested" conditional statements.
>
> You can check c_if.9 [2](comment out "load ./alias.so" in the file) which
> is a script for testing nested conditionals.If you are running it please
> compile c_if.cc,interp.h and c_echo.cc[3] to get the so files required to
> run the script.
>
> So after using untested() and tracing the flow of execution of plugin,I
> figured out the problem is that when a new "NESTED IF/ELIF/ELSE command" is
> launched it doesn't get the next instructions it is supposed to receive
> from the file and keeps on waiting for the next input from the file.It
> doesn't receive the input because this "if" command is called by another
> "if" command using CMD::command() method,line 99 c_if.cc
> The question is how can the child process receive the input from a file in
> gnucap?
> Any idea how can I solve the problem in gnucap's way.I know other
> techniques but if there is way to solve it in gnucap then it is better.
>
> [1]:
> http://git.savannah.gnu.org/cgit/gnucap.git/tree/c_if.cc?h=WIP&id=b73c04c8ed1fec7333926b42e149221a0f3f75a6
>
> [2]:http://git.savannah.gnu.org/cgit/gnucap.git/tree/tests/if/c_if.9?h=WIP
>
> [3]:
> http://git.savannah.gnu.org/cgit/gnucap.git/tree/?h=WIP&id=b73c04c8ed1fec7333926b42e149221a0f3f75a6
>
> Thanks,
> Rishabh Yadav
> Junior Undergraduate
> Department of Electronics Engineering
> IIT (BHU), Varanasi
> Varanasi-221005
> India
>


reply via email to

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