help-octave
[Top][All Lists]
Advanced

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

Re: demo peculiarity


From: Dmitri A. Sergatskov
Subject: Re: demo peculiarity
Date: Mon, 4 Jun 2007 22:39:13 -0500

On 6/4/07, Paul Kienzle <address@hidden> wrote:

On Jun 4, 2007, at 1:09 PM, Dmitri A. Sergatskov wrote:

> I found some peculiar behavior for "demo". I am not sure if this is a
> bug
> or a feature.
>
> ... example of demo picking up the wrong function ...
>
> Any comments?

I can't reproduce the problem on 2.1.71 OS X.

I assume you did add ./testdir to your path...



Here's the logic from test.m for finding the file containing the demo:

   ## locate the file to test
   __file = file_in_loadpath (__name, "all");
   if (isempty (__file))
     __file = file_in_loadpath (strcat (__name, ".m"), "all");
   endif
   if (isempty (__file))
     __file = file_in_loadpath (strcat (__name, ".cc"), "all");
   endif
   if (iscell (__file))
       ## If repeats, return first in path.
     if (isempty (__file))
       __file = "";
     else
       __file = __file{1};
     endif
   endif

Please try file_in_loadpath on your system to see if it is returning
the expected value.

octave:4> file_in_loadpath ("testx.m", "all")
ans =

{
 [1,1] = ./testx.m
 [2,1] = ./testdir/testx.m
}

octave:5> file_in_loadpath ("testx.m", "all"){1}
ans = ./testx.m
octave:6> demo testx
testx example 1:
 testx("Ha-ha test2")

testx: Ha-ha test2
octave:7> type testx
testx is the user-defined function defined from: /home/dima/octave/testx.m

function testx(str)
       disp(["testx: ", str])
endfunction

%!demo
%! testx("test1")


- Paul


Sincerely,

Dmitri.
--


reply via email to

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