octave-maintainers
[Top][All Lists]
Advanced

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

Re: Mex Extensions


From: David Bateman
Subject: Re: Mex Extensions
Date: Wed, 10 Jan 2007 11:55:45 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On 10-Jan-2007, David Bateman wrote:
>
> | To address this we might modify defun.cc(install_mex_function) to also
> | call parse.y(get_help_from_file) and associate the help string from the
> | m-file with the symbol record of the mex-function. The construct for
> | octave_mex_function would also then need modifying to accept the help
> | string.. Consider the attached patch..
>
> If we do this, then what happens if the .m file changes but the .mex
> has not?  I think you would get the old doc string (the one associated
> with the function loaded from the .mex file).  This could be somewhat
> confusing, so maybe we should just change the function that reports the
> name of the file to also look for .mex or .oct files and display that
> name if the corresponding .m file only contains comments?
>
> jwe
>
>   
Then in that case I think I'd modify help.cc(help_from_file) to be
something like

static bool
help_from_file (std::ostream& os, const std::string& nm, bool& symbol_found)
{
  bool retval = false;

  std::string file;

  std::string header;

  if (symbol_found)
    {
      symbol_record *sym_rec = lookup_by_name (nm, 0);

      if (sym_rec && sym_rec->is_defined ())
        {
      if (sym_rec->is_mex__function())
        header = sym_rec->which();
      else
        {
          symbol_found = false;
          return retval;
        }
    }
      else
    symbol_found = false;
    }

  if (! symbol_found)
    header = nm + " is the file " + file + "\n\n";

  std::string h = get_help_from_file (nm, symbol_found, file);

  if (h.length () > 0)
    {
      os << header;
      display_help_text (os, h);
      os << "\n";
      retval = true;
    }

  return retval;
}

If no help is found in an oct-file it shouldn't go looking for it in an
m-file...

Cheers
David

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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