octave-maintainers
[Top][All Lists]
Advanced

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

Re: Contributing code


From: Carnë Draug
Subject: Re: Contributing code
Date: Fri, 14 Dec 2012 13:44:35 +0000

On 14 December 2012 11:36, Roberto Metere <address@hidden> wrote:
> Dear Octave maintainers,
>     I would like to contribute octave-forge repository by adding a missing
> function "strel" to the package image, which I have implemented for the most
> used arguments. Some cases don't work yet (exiting with a "not yet
> implemented" message), but I surely will keep on work.
>
> My SourceForge name is trinitrina
> I have attached my contribution.
>
> I may imagine you have some rules for coding, like no tabs, custom comments,
> etc.
> Obviously I want to change my code to satisfy those rules, may someone help
> me to begin?

Hey

that's great. I wanted this function in the package for quite some
time. My impression is that strel should returns a strel object. Your
code just returns the matrix of the SE. We don't have classdef but it
seems to me that strel could be implemented just fine with the old
style of objects. See
http://www.gnu.org/software/octave/doc/interpreter/Object-Oriented-Programming.html

Other than that, I didn't had a real look at the actual code, just at
how it looks like and about guidelines, here's some:

1) help text in texinfo. See http://wiki.octave.org/Help_text
2) 2 spaces instead of tabs
3) add a closing endfunction, and indent the whole function block
4) no need for [ ] around strings. The brackets are not necessary in
"error (['error message'])"
5) all your usage lines can be replaced "if (.....) print_usage(); endif
6) don't be afraid of whitespace. General rule is space before
parentheses if it's a function call, no space if it's indexing a
variable.
7) use double quotes
8) use specific end block (endif, endfor, endswitch, etc)

It may be better to submit to the feature request tracker at
https://sourceforge.net/p/octave/feature-requests/ Things like this,
tend to get lost too easily in the mailing list.

Take a look at the following functions for an idea on things usually
are in the image package:

https://sourceforge.net/p/octave/code/11485/tree/trunk/octave-forge/main/image/inst/imnoise.m
https://sourceforge.net/p/octave/code/11485/tree/trunk/octave-forge/main/image/inst/cmunique.m

Carnë


reply via email to

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