Mercurial > hg > octave-nkf
changeset 5534:e107161b8ca3
[project @ 2005-11-11 17:44:05 by jwe]
author | jwe |
---|---|
date | Fri, 11 Nov 2005 17:45:51 +0000 |
parents | 667ad2becb63 |
children | 6a82af824269 |
files | src/ChangeLog src/DLD-FUNCTIONS/sparse.cc src/DLD-FUNCTIONS/spchol.cc src/DLD-FUNCTIONS/spdet.cc src/DLD-FUNCTIONS/spkron.cc src/DLD-FUNCTIONS/splu.cc src/Makefile.in src/mk-oct-links src/mk-pkg-add src/variables.cc |
diffstat | 10 files changed, 139 insertions(+), 110 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2005-11-11 John W. Eaton <jwe@octave.org> + + * variables.cc (symbol_out_of_date): Check for autoloads here too. + + * Makefile.in (PKG_ADD): Depend on $(DLD_DEF_FILES), not $(DLD_SRC). + (%.df : %.cc): Also insert PKG_ADD commands in .df files. + (install-oct): Generate PKG_ADD file for install directory here. + Don't depend on PKG-ADD. No need to make .oct file links. + (clean): No need to delete links. + (stamp-oct-links): Delete target. + (distclean): No need to remove stamp-oct-links. + (all): Depend on $(OCT_FILES), not stamp-oct-links. + + * mk-pkg-add: New file. + * Makefile.in (DISTFILES): Add it to the list. + + * mk-oct-links: Delete. + * Makefile.in (DISTFILES): Remove it from the list. + 2005-11-10 John W. Eaton <jwe@octave.org> * ov-str-mat.h (octave_char_matrix_str::permute,
--- a/src/DLD-FUNCTIONS/sparse.cc +++ b/src/DLD-FUNCTIONS/sparse.cc @@ -633,9 +633,9 @@ return retval; } -// PKG_ADD: dispatch ("find", "spfind", "sparse matrix") -// PKG_ADD: dispatch ("find", "spfind", "sparse complex matrix") -// PKG_ADD: dispatch ("find", "spfind", "sparse bool matrix") +// PKG_ADD: dispatch ("find", "spfind", "sparse matrix"); +// PKG_ADD: dispatch ("find", "spfind", "sparse complex matrix"); +// PKG_ADD: dispatch ("find", "spfind", "sparse bool matrix"); DEFUN_DLD (spfind, args, nargout , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[...] =} spfind (...)\n\
--- a/src/DLD-FUNCTIONS/spchol.cc +++ b/src/DLD-FUNCTIONS/spchol.cc @@ -116,9 +116,9 @@ return retval; } -// PKG_ADD: dispatch ("chol", "spchol", "sparse matrix") -// PKG_ADD: dispatch ("chol", "spchol", "sparse complex matrix") -// PKG_ADD: dispatch ("chol", "spchol", "sparse bool matrix") +// PKG_ADD: dispatch ("chol", "spchol", "sparse matrix"); +// PKG_ADD: dispatch ("chol", "spchol", "sparse complex matrix"); +// PKG_ADD: dispatch ("chol", "spchol", "sparse bool matrix"); DEFUN_DLD (spchol, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{r} =} spchol (@var{a})\n\ @@ -164,9 +164,9 @@ return sparse_chol (args, nargout, "spchol", false); } -// PKG_ADD: dispatch ("lchol", "splchol", "sparse matrix") -// PKG_ADD: dispatch ("lchol", "splchol", "sparse complex matrix") -// PKG_ADD: dispatch ("lchol", "splchol", "sparse bool matrix") +// PKG_ADD: dispatch ("lchol", "splchol", "sparse matrix"); +// PKG_ADD: dispatch ("lchol", "splchol", "sparse complex matrix"); +// PKG_ADD: dispatch ("lchol", "splchol", "sparse bool matrix"); DEFUN_DLD (splchol, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{l} =} splchol (@var{a})\n\ @@ -214,9 +214,9 @@ return sparse_chol (args, nargout, "splchol", true); } -// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse matrix") -// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse complex matrix") -// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse bool matrix") +// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse matrix"); +// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse complex matrix"); +// PKG_ADD: dispatch ("cholinv", "spcholinv", "sparse bool matrix"); DEFUN_DLD (spcholinv, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} spcholinv (@var{a})\n\ @@ -278,9 +278,9 @@ return retval; } -// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse matrix") -// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse complex matrix") -// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse bool matrix") +// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse matrix"); +// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse complex matrix"); +// PKG_ADD: dispatch ("chol2inv", "spchol2inv", "sparse bool matrix"); DEFUN_DLD (spchol2inv, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} spchol2inv (@var{u})\n\
--- a/src/DLD-FUNCTIONS/spdet.cc +++ b/src/DLD-FUNCTIONS/spdet.cc @@ -36,9 +36,9 @@ #include "ov-re-sparse.h" #include "ov-cx-sparse.h" -// PKG_ADD: dispatch ("det", "spdet", "sparse matrix") -// PKG_ADD: dispatch ("det", "spdet", "sparse complex matrix") -// PKG_ADD: dispatch ("det", "spdet", "sparse bool matrix") +// PKG_ADD: dispatch ("det", "spdet", "sparse matrix"); +// PKG_ADD: dispatch ("det", "spdet", "sparse complex matrix"); +// PKG_ADD: dispatch ("det", "spdet", "sparse bool matrix"); DEFUN_DLD (spdet, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{d}, @var{rcond}] = } spdet (@var{a})\n\
--- a/src/DLD-FUNCTIONS/spkron.cc +++ b/src/DLD-FUNCTIONS/spkron.cc @@ -79,9 +79,9 @@ template void kron (const Sparse<Complex>&, const Sparse<Complex>&, Sparse<Complex>&); -// PKG_ADD: dispatch ("kron", "spkron", "sparse matrix") -// PKG_ADD: dispatch ("kron", "spkron", "sparse complex matrix") -// PKG_ADD: dispatch ("kron", "spkron", "sparse bool matrix") +// PKG_ADD: dispatch ("kron", "spkron", "sparse matrix"); +// PKG_ADD: dispatch ("kron", "spkron", "sparse complex matrix"); +// PKG_ADD: dispatch ("kron", "spkron", "sparse bool matrix"); DEFUN_DLD (spkron, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Function File} {} spkron (@var{a}, @var{b})\n\ Form the kronecker product of two sparse matrices. This is defined\n\
--- a/src/DLD-FUNCTIONS/splu.cc +++ b/src/DLD-FUNCTIONS/splu.cc @@ -35,9 +35,9 @@ #include "ov-re-sparse.h" #include "ov-cx-sparse.h" -// PKG_ADD: dispatch ("lu", "splu", "sparse matrix") -// PKG_ADD: dispatch ("lu", "splu", "sparse complex matrix") -// PKG_ADD: dispatch ("lu", "splu", "sparse bool matrix") +// PKG_ADD: dispatch ("lu", "splu", "sparse matrix"); +// PKG_ADD: dispatch ("lu", "splu", "sparse complex matrix"); +// PKG_ADD: dispatch ("lu", "splu", "sparse bool matrix"); DEFUN_DLD (splu, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{l}, @var{u}] =} splu (@var{a})\n\ @@ -389,12 +389,12 @@ return retval; } -// PKG_ADD: dispatch ("inv", "spinv", "sparse matrix") -// PKG_ADD: dispatch ("inv", "spinv", "sparse complex matrix") -// PKG_ADD: dispatch ("inv", "spinv", "sparse bool matrix") -// PKG_ADD: dispatch ("inverse", "spinv", "sparse matrix") -// PKG_ADD: dispatch ("inverse", "spinv", "sparse complex matrix") -// PKG_ADD: dispatch ("inverse", "spinv", "sparse bool matrix") +// PKG_ADD: dispatch ("inv", "spinv", "sparse matrix"); +// PKG_ADD: dispatch ("inv", "spinv", "sparse complex matrix"); +// PKG_ADD: dispatch ("inv", "spinv", "sparse bool matrix"); +// PKG_ADD: dispatch ("inverse", "spinv", "sparse matrix"); +// PKG_ADD: dispatch ("inverse", "spinv", "sparse complex matrix"); +// PKG_ADD: dispatch ("inverse", "spinv", "sparse bool matrix"); DEFUN_DLD (spinv, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{x}, @var{rcond}] = } spinv (@var{a}, @var{Q})\n\
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -23,8 +23,9 @@ %.df : %.cc @echo making $@ from $< - @$(CXXCPP) $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) -DMAKE_BUILTINS $< \ - | $(srcdir)/mkdefs > $@-t + @(egrep '^(///*|/\*) *PKG_ADD:' $< ; \ + $(CXXCPP) $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) -DMAKE_BUILTINS $< \ + | $(srcdir)/mkdefs) > $@-t @mv $@-t $@ # How to make a .oct file from a .o file: @@ -253,12 +254,12 @@ $(COLAMD_LIBS) $(CCOLAMD_LIBS) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS) DISTFILES = Makefile.in ChangeLog mkdefs mkops mkgendoc \ - DOCSTRINGS mkbuiltins mk-errno-list mk-oct-links \ + DOCSTRINGS mkbuiltins mk-errno-list mk-pkg-add \ defaults.h.in oct-conf.h.in oct-errno.cc.in octave.gperf oct-gperf.h \ octave.cc parse.cc lex.cc y.tab.h gplot.cc \ $(INCLUDES) $(DIST_SRC) $(OPT_HANDLERS) $(EXTRAS) -all: octave$(EXEEXT) stamp-oct-links PKG_ADD DOCSTRINGS +all: octave$(EXEEXT) $(OCT_FILES) PKG_ADD DOCSTRINGS .PHONY: all objects: $(OBJECTS) @@ -301,12 +302,6 @@ rm -f $@ $(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^ $(OCTINTERP_LINK_DEPS) -stamp-oct-links: $(OCT_FILES) - if [ -n "$(OCT_FILES)" ]; then \ - $(srcdir)/mk-oct-links . $(DLD_DEF_FILES); \ - fi - touch stamp-oct-links - stamp-prereq: defaults.h oct-conf.h oct-gperf.h parse.cc lex.cc gplot.cc $(OPT_HANDLERS) touch stamp-prereq @@ -347,10 +342,8 @@ @$(srcdir)/mkbuiltins def-files var-files > $@-t @$(top_srcdir)/move-if-change $@-t $@ -PKG_ADD: $(DLD_SRC) - $(SED) -n -e 's,^//* *PKG_ADD: *,,p' \ - -e 's,^/\* *PKG_ADD: *\(.*\) \*/$$,\1,p' \ - $(addprefix $(srcdir)/, $(DLD_SRC)) > PKG_ADD-t +PKG_ADD: $(DLD_DEF_FILES) + $(srcdir)/mk-pkg-add --prefix $(shell pwd) $(DLD_DEF_FILES) > PKG_ADD-t mv PKG_ADD-t PKG_ADD DOCSTRINGS: gendoc$(BUILD_EXEEXT) @@ -403,15 +396,14 @@ cd $(DESTDIR)$(bindir) ; $(LN_S) octave-$(version)$(EXEEXT) octave$(EXEEXT) .PHONY: install-bin -install-oct: PKG_ADD +install-oct: $(top_srcdir)/mkinstalldirs $(DESTDIR)$(octfiledir) - $(INSTALL_DATA) PKG_ADD $(DESTDIR)$(octfiledir)/PKG_ADD if [ -n "$(OCT_FILES)" ]; then \ xfiles="$(OCT_FILES)"; \ for f in $$xfiles; do \ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(octfiledir)/$$f; \ done; \ - $(srcdir)/mk-oct-links $(DESTDIR)$(octfiledir) $(DLD_DEF_FILES); \ + $(srcdir)/mk-pkg-add --prefix $(octfiledir) $(DLD_DEF_FILES) > $(DESTDIR)$(octfiledir)/PKG_ADD fi .PHONY: install-oct @@ -474,9 +466,6 @@ etags $(SOURCES) $(DLD_SRC) clean: - if [ -n "$(OCT_FILES)" ]; then \ - $(srcdir)/mk-oct-links --delete . $(DLD_DEF_FILES); \ - fi rm -f liboctinterp.$(LIBEXT) rm -f liboctinterp.$(SHLEXT_VER) liboctinterp.$(SHLEXT) rm -f $(OBJECTS) $(MAKEDEPS) $(DOC_FILES) $(OCT_FILES) @@ -491,7 +480,7 @@ distclean: clean rm -f Makefile octave$(EXEEXT) .fname so_locations oct-errno.cc - rm -f stamp-prereq stamp-liboctave-prereq stamp-oct-links + rm -f stamp-prereq stamp-liboctave-prereq rm -f doc-files gendoc.cc DOCSTRINGS .PHONY: distclean
deleted file mode 100755 --- a/src/mk-oct-links +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -e - -# Create additional links to .oct files that define more than one -# function. - -# If the first arg is --print, only print the links we need to make. - -# The first non-option arg is taken as the directory where the .oct -# files are installed. The remaining arguments should be the list of -# .df files corresponding to the source files that were used to -# create the .oct files. - -SED=${SED:-'sed'} - -print_only=false -delete_links=false -if [ $1 = "--print" -o $1 = "-p" ]; then - print_only=true - shift -elif [ $1 = "--delete" ]; then - delete_links=true - shift -fi - -links_dir=$1 -shift - -for f in "$@"; do - if [ -f $f ]; then - base=`basename $f | $SED 's/\.df$//'` - fcns=`grep '^ *XDEFUN_DLD_INTERNAL' $f |\ - $SED -e 's/XDEFUN_DLD_INTERNAL *( *//' -e 's/ *,.*$//' |\ - sort -u` - if [ -n "$fcns" ]; then - for n in $fcns; do - if [ "$n" = "$base" ]; then - true - else - if $print_only; then - echo $base.oct $n.oct - elif $delete_links; then - rm -f $links_dir/$n.oct - else - echo "creating link $n.oct -> $base.oct" - ( cd $links_dir; rm -f $n.oct; ln $base.oct $n.oct ) - fi - fi - done - fi - fi -done - -exit $?
new file mode 100755 --- /dev/null +++ b/src/mk-pkg-add @@ -0,0 +1,53 @@ +#! /bin/sh -e + +# Create additional links to .oct files that define more than one +# function. + +# If the first arg is --print, only print the links we need to make. + +# The first non-option arg is taken as the directory where the .oct +# files are installed. The remaining arguments should be the list of +# .df files corresponding to the source files that were used to +# create the .oct files. + +SED=${SED:-'sed'} + +if [ $1 = "--prefix" ]; then + shift + prefix="$1" + shift +fi + +for f in "$@"; do + if [ -f $f ]; then + + ## Compute and print the autoloads. + + base=`basename $f | $SED 's/\.df$//'` + fcns=`grep '^ *XDEFUN_DLD_INTERNAL' $f |\ + $SED -e 's/XDEFUN_DLD_INTERNAL *( *//' -e 's/ *,.*$//' |\ + sort -u` + if [ -n "$fcns" ]; then + for n in $fcns; do + if [ "$n" = "$base" ]; then + true + else + if [ -n "$prefix" ]; then + echo "autoload (\"$n\", \"$prefix/$base.oct\");" + else + echo "autoload (\"$n\", \"$base.oct\");" + fi + fi + done + fi + + ## Process PKG_ADD directives after autoloads so that all + ## necessary functions can be found before they are used. + + $SED -n -e 's,^//* *PKG_ADD: *,,p' \ + -e 's,^/\* *PKG_ADD: *\(.*\) *\*/ *$,\1,p' $f + + fi +done + +exit $?
--- a/src/variables.cc +++ b/src/variables.cc @@ -1030,14 +1030,35 @@ std::string nm = fcn->name (); + // XXX FIXME XXX -- the following code is repeated + // in load_fcn_from_file in parse.y. + string_vector names (2); - names[0] = nm + ".oct"; - names[1] = nm + ".m"; - - std::string file = octave_env::make_absolute - (Vload_path_dir_path.find_first_of (names), - octave_env::getcwd ()); + int nm_len = nm.length (); + + std::string file; + + if (octave_env::absolute_pathname (nm) + && ((nm_len > 4 && nm.substr (nm_len-4) == ".oct") + || (nm_len > 2 && nm.substr (nm_len-4) == ".m"))) + { + file = nm; + } + else + { + file = lookup_autoload (nm); + + if (file.empty ()) + { + names[0] = nm + ".oct"; + names[1] = nm + ".m"; + + file = octave_env::make_absolute + (Vload_path_dir_path.find_first_of (names), + octave_env::getcwd ()); + } + } if (same_file (file, ff)) {