Hallo,
I am forced to use some legacy code written for Matlab and I am not
allowed to make changes in the available code. Here below is a
stripped down piece of code, which parses and works in Matlab
(R2008a), fails in Octave 3.2.4.
------------------------------
function this = a()
this.do = @do;
function this = do(this, in)
this = this+in;
end
end
-----------------------------
For this code I get the following error... looks like twice, but is
probably "stack trace"
======================================
>> a
error: function handles may not refer to keywords
parse error near line 3 of file a.m
syntax error
>>> this.do = @do;
^
error: function handles may not refer to keywords
parse error near line 3 of file a.m
syntax error
>>> this.do = @do;
^
error: `a' undefined near line 2 column 1
========================================
The problem is using of keyword 'do' as function name. As long as it
is unambiguous, and in the example above IT IS, the keyword was
accepted as function name and allowed in the reference to be assigned.
I have managed to get rid of the "function handles may not refer to
keywords" by removing the check for keyword at
src/lex.cc:5752 and src/lex.l:3127
It took me only as far as
==========================
>> a
parse error near line 5 of file a.m
syntax error
>>> function this = do(this, in)
^
parse error near line 5 of file a.m
syntax error
>>> function this = do(this, in)
^
error: `a' undefined near line 3 column 1
====================================
Is someone able to fix the 'incompatibility' issue or at least point
me to the right piece of code which would have to be modified?
I am not familiar with internals of octave, but I know C/C++ to find
my way around. What should I know before I start?
Thanks,
Paul
PS: I know, that renaming of that function is easier, than fixing the
incompatibility, but...
--
Don't take life too seriously; you will never get out of it alive.
-- Elbert Hubbard
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev