Mercurial > hg > octave-lyh
changeset 9014:71fca0fc2436
save source file names for functions as comments in .texi files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Mar 2009 12:54:17 -0400 |
parents | 3b1908b58662 |
children | 06cebb6c5dde |
files | doc/ChangeLog doc/interpreter/munge-texi.cc scripts/ChangeLog scripts/gethelp.cc scripts/mkdoc src/ChangeLog src/Makefile.in src/mkbuiltins src/mkgendoc |
diffstat | 9 files changed, 73 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-03-25 John W. Eaton <jwe@octave.org> + + * interpreter/munge-texi.cc (process_texi_input_file): + Copy leading comment with file name info to output. + 2009-03-09 John W. Eaton <jwe@octave.org> * interpreter/Makefile.in (DISTFILES): Use doc-cache instead of
--- a/doc/interpreter/munge-texi.cc +++ b/doc/interpreter/munge-texi.cc @@ -245,7 +245,23 @@ { std::string doc_string = help_text[symbol_name]; + size_t len = doc_string.length (); + int j = 0; + + // If there is a leading comment with the file + // name, copy it to the output. + if (len > 1 + && doc_string[j] == '@' + && doc_string[j+1] == 'c') + { + j = 2; + while (doc_string[j++] != '\n') + /* find eol */; + + os << doc_string.substr (0, j); + } + while (doc_string[j] == ' ') j++;
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2009-03-25 John W. Eaton <jwe@octave.org> + + * mkdoc: Pass full file name to gethelp. + * gethelp.cc (main): Handle second argument. Write comment with + full file name to output. + 2009-03-24 Ben Abbott <bpabbott@mac.com> * plot/gnuplot_drawnow.m: When printing, pass scalar plot_stream
--- a/scripts/gethelp.cc +++ b/scripts/gethelp.cc @@ -135,20 +135,26 @@ main (int argc, char **argv) { std::string name; + std::string file_name; - if (argc != 2) + if (argc != 3) { - std::cerr << "usage: gethelp name\n"; + std::cerr << "usage: gethelp name file-name\n"; return 1; } else - name = argv[1]; + { + name = argv[1]; + file_name = argv[2]; + } std::string help_text = extract_help_text (); if (! help_text.empty ()) { - std::cout << "" << name << "\n" << help_text; + std::cout << "" << name << "\n" + << "@c " << file_name << "\n" + << help_text; if (help_text[help_text.length () - 1] != '\n') std::cout << "\n";
--- a/scripts/mkdoc +++ b/scripts/mkdoc @@ -42,15 +42,17 @@ EOF $FIND $d -name '*.m' | \ - $PERL -ne 'm{(.*)/(.*)\.m}; - for (qx{./gethelp $2 < $_}) { + $PERL -n -e 'chop; + $f = "$_"; + m{(.*)/(.*)\.m}; + for (qx{./gethelp $2 "$f" < "$f"}) { s/^\s+\@/\@/ unless $i_am_in_example; s/^\s+\@group/\@group/; s/^\s+\@end\s+group/\@end\s+group/; $i_am_in_example = 1 if /\s*\@example/; $i_am_in_example = 0 if /\s*\@end\s+example/; print; - }' + }' else echo "gethelp program seems to be missing!" 1>&2 exit 1
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2009-03-25 John W. Eaton <jwe@octave.org> + + * Makefile.in (%.df : %.cc): Write source file name to output, + wrapped in XDEFUN_FILE_NAME macro. + * mkbuiltins: Provide definition for XDEFUN_FILE_NAME. + * mkgendoc: Likeiwse. + (XDEFUN_DLD_INTERNAL, XDEFUNX_DLD_INTERNAL, XDEFUN_INTERNAL, + XDEFCONSTFUN_INTERNAL, XDEFUNX_INTERNAL, XDEFVAR_INTERNAL, + XDEFCONST_INTERNAL): Pass file_name to print_doc_string. + (print_doc_string): New arg, FILE_NAME. Print file name as + comment. + 2009-03-24 John W. Eaton <jwe@octave.org> * ov-class.cc (F__parent_classes__): New function.
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -40,6 +40,7 @@ %.df : %.cc @echo making $@ from $< @(echo "// DO NOT EDIT! Generated automatically by mkdefs." ; \ + echo " XDEFUN_FILE_NAME (\"$<\")" ; \ egrep '^(///*|/\*) *PKG_ADD:' $< ; \ $(CXXCPP) $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) -DMAKE_BUILTINS $< \ | $(srcdir)/mkdefs) > $@-t
--- a/src/mkbuiltins +++ b/src/mkbuiltins @@ -65,6 +65,8 @@ #endif +#define XDEFUN_FILE_NAME(name) + #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ extern DECLARE_FUN (name, args_name, nargout_name); \ install_builtin_function (F ## name, #name, doc); \
--- a/src/mkgendoc +++ b/src/mkgendoc @@ -43,42 +43,47 @@ #include <iostream> #include <string> +#define XDEFUN_FILE_NAME(name) \ + std::string file_name = name; + #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) \ - print_doc_string (#name, doc); + print_doc_string (#name, file_name, doc); #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) \ - print_doc_string (name, doc); + print_doc_string (name, file_name, doc); #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ - print_doc_string (#name, doc); + print_doc_string (#name, file_name, doc); #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \ - print_doc_string (#name, doc); + print_doc_string (#name, file_name, doc); #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \ - print_doc_string (name, doc); + print_doc_string (name, file_name, doc); #define XDEFALIAS_INTERNAL(alias, name) #define XDEFVAR_INTERNAL(name, sname, defn, protect, chg_fcn, doc) \ - print_doc_string (#name, doc); + print_doc_string (#name, file_name, doc); #define XDEFCONST_INTERNAL(name, defn, doc) \ - print_doc_string (#name, doc); + print_doc_string (#name, file_name, doc); static void -print_doc_string (const std::string& name, const std::string& doc) +print_doc_string (const std::string& name, const std::string& file_name, + const std::string& doc) { std::cout << ""; size_t len = name.length (); if (name[0] == '"' && name[len-1] == '"') - std::cout << name.substr (1, len-2); + std::cout << name.substr (1, len-2) << "\n"; else - std::cout << name; + std::cout << name << "\n"; - std::cout << "\n" << doc << "\n"; + std::cout << "@c " << file_name << "\n" + << doc << "\n"; } EOF