[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #42432] Error with octave when using from Perl
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #42432] Error with octave when using from Perl via Inline::Octave |
Date: |
Mon, 26 May 2014 17:53:18 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0 |
URL:
<http://savannah.gnu.org/bugs/?42432>
Summary: Error with octave when using from Perl via
Inline::Octave
Project: GNU Octave
Submitted by: None
Submitted on: Mon 26 May 2014 05:53:17 PM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Other
Status: None
Assigned to: None
Originator Name: Andreas Krause
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 3.8.1
Operating System: GNU/Linux
_______________________________________________________
Details:
I'm currently trying to get up and running the octave interface for perl
again
http://search.cpan.org/~aadler/Inline-Octave-0.31/Octave.pm
with the current octave 3.8.1. Until the previous version 3.6.4 all worked
fine. The sample program
#!/usr/bin/perl
use Inline Octave => DATA;
$f = myfunc(3);
print "jnk1=",$f->disp(),"\n";
__DATA__
__Octave__
function x=myfunc(u)
x=u+1
endfunction
gave with 3.6.4 the correct output
jnk1= 4
When using octave 3.8.1, I get the following error:
sample.pm
Warning: function name 'myfunc' does not agree with function file name '';
(in octave code) at ./sample.pm line 0.
Undefined subroutine &main::myfunc called at ./sample.pm line 5.
Debugging, I found octave-3.8.1/libinterp/parse-tree/oct-parse.in.yy line
2819ff
octave_user_function *
octave_base_parser::frob_function (const std::string& fname,
octave_user_function *fcn)
{
std::string id_name = fname;
// If input is coming from a file, issue a warning if the name of
// the file does not match the name of the function stated in the
// file. Matlab doesn't provide a diagnostic (it ignores the stated
// name).
-> if (! autoloading && lexer.reading_fcn_file
-> && curr_fcn_depth == 1 && ! parsing_subfunctions)
{
// FIXME -- should lexer.fcn_file_name already be
// preprocessed when we get here? It seems to only be a
// problem with relative file names.
std::string nm = lexer.fcn_file_name;
size_t pos = nm.find_last_of (file_ops::dir_sep_chars ());
if (pos != std::string::npos)
nm = lexer.fcn_file_name.substr (pos+1);
if (nm != id_name)
{
warning_with_id
("Octave:function-name-clash",
"function name '%s' does not agree with function file name
'%s'",
id_name.c_str (), lexer.fcn_file_full_name.c_str ());
id_name = nm;
}
}
with the if-condition lexer.reading_fcn_file as true -> warning. The
"Undefined subroutine" error above seems like a follow-up error as id_name is
overwritten with the empty variable nm.
The corresponding if-condition in octave-3.6.4/src/oct-parse.yy line 2826ff
looks like
if (! autoloading && reading_fcn_file
&& (current_function_depth == 1
&& ! (parsing_subfunctions || lexer_flags.parsing_class_method)))
but with reading_fcn_file as false -> no warning. The reason for the different
value of this flag might be an additional if-clause in
octave-3.8.1/libinterp/parse-tree/lex.ll line 2411ff
case function_kw:
decrement_promptflag ();
defining_func++;
parsed_function_name.push (false);
-> if (! force_script && token_count == 0 && input_from_file ())
-> {
-> reading_fcn_file = true;
-> reading_script_file = false;
-> }
if (! (reading_fcn_file || reading_script_file
|| reading_classdef_file))
input_line_number = 1;
break;
which sets reading_fcn_file to true but is missing in 3.6.4. But this is too
deep in the octave internals for me to be sure.
Inline::Octave starts an octave instance and communicates with it via
use IPC::Open3;
use IO::File;
So can anybody help me with this issue? An empty function file name seems to
be strange.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?42432>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #42432] Error with octave when using from Perl via Inline::Octave,
anonymous <=