Difference between revisions of "Developer FAQ"

From Octave
Jump to navigation Jump to search
(finding source: no need for regular expression, and shouldn't have ^)
(Add Category:Development some extensions.)
 
Line 1: Line 1:
1. ''How can I find which file implements a given command?''
+
== ''How can I find which file implements a given command?'' ==
  
From within Octave, use 'which':
+
From within Octave, use <code>which</code>:
octave:1> which addpath
+
<syntaxhighlight lang="Octave">
'addpath' is a built-in function from the file libinterp/corefcn/load-path.cc
+
>> which help
While editing the file, the function definition can be found by searching for something like
+
</syntaxhighlight>
(addpath,
+
 
 +
  'help' is a function from the file /some/path/m/help/help.m
 +
 
 +
If the desired function is a m-file, one can simply edit it inside the GUI, just type:
 +
<syntaxhighlight lang="Octave">
 +
>> edit help
 +
</syntaxhighlight>
 +
 
 +
Some functions are already compiled (a.k.a. ''built-in functions''), for example:
 +
 
 +
<syntaxhighlight lang="Octave">
 +
>> which addpath
 +
</syntaxhighlight>
 +
 
 +
  'addpath' is a built-in function from the file libinterp/corefcn/load-path.cc
 +
 
 +
This function is to be found in Octave's source code, in this case at [https://hg.savannah.gnu.org/hgweb/octave/file/b33d4fbce33e/libinterp/corefcn/load-path.cc#l2355].
 +
 
 +
If the source code is cloned to a local machine, you can edit the repective file and search for something like "<code> (addpath,</code>".
 +
 
 +
[[Category:Development]]

Latest revision as of 09:39, 3 October 2018

How can I find which file implements a given command?[edit]

From within Octave, use which:

>> which help
 'help' is a function from the file /some/path/m/help/help.m

If the desired function is a m-file, one can simply edit it inside the GUI, just type:

>> edit help

Some functions are already compiled (a.k.a. built-in functions), for example:

>> which addpath
 'addpath' is a built-in function from the file libinterp/corefcn/load-path.cc

This function is to be found in Octave's source code, in this case at [1].

If the source code is cloned to a local machine, you can edit the repective file and search for something like " (addpath,".