help-octave
[Top][All Lists]
Advanced

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

Re: Best replacement for curr_sym_tab in octave 3.2


From: Joshua Redstone
Subject: Re: Best replacement for curr_sym_tab in octave 3.2
Date: Wed, 6 Jan 2010 10:30:10 -0800

Hi John,
Looking at the code more, I think the entire purpose is to assign a variable at the top level a value.
I think in 3.2, I can just use symbol_table::varref(name, symbol_table::top_level()).
Is there a backwards compatible way of doing this?
I was thinking of using mkmf to try to detect whether symbol_table was present in symtab.h, but, at least the ruby mkmf package
testing for presence of symtab.h by trying to compile a program consisting of a single statement "#include <symtab.h>",
and it produces gobs of errors - looks like maybe symtab.h does not include everything it depends on?
Any suggestions?
Thanks,
Josh


On Sun, Jan 3, 2010 at 10:21 PM, John W. Eaton <address@hidden> wrote:
On  2-Jan-2010, Joshua Redstone wrote:

| It looks like the following may work:
|     symbol_table::set_scope(symbol_table::top_scope());
| at least, it compiles... :)
| Josh
|
| On Sat, Jan 2, 2010 at 1:50 PM, Joshua Redstone <address@hidden> wrote:
|
| > Hi,
| > The octave-ruby gem currently does not compile with octave 3.2.2.
| > It looks like the compilation errors are cause by the first line below:
| >
| > ....
| > curr_sym_tab = top_level_sym_tab;
| > reset_error_handler();
| > octave_value_list val = feval(std::string(RSTRING(function_name)->ptr),
| > argList, 1);
| > .....

Are you trying to do the equivalent of

 evalin ("base", "function_name")

?  If so, then I don't see the point of switching to the top
level symbol table unless "function_name" refers to a script file.

If you are calling a script and you want it to be evaluated in the
base workspace, then maybe it would be better to just use Fevalin
directly:

 extern octave_value_list Fevalin (const octave_value_list&, int);
 ...
 octave_value_list args (2);
 args(0) = "base";
 args(1) = std::string (RSTRING(function_name)->ptr);
 octave_value_list val = Fevalin (args, 1);

jwe


reply via email to

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