changeset 2907:8bb31a2b480b

[project @ 1997-04-30 05:01:46 by jwe]
author jwe
date Wed, 30 Apr 1997 05:06:03 +0000
parents a96be04e1c9f
children 5e7e0cc5e987
files src/Makefile.in src/defaults.h.in src/dirfns.h src/error.h src/file-io.h src/help.h src/input.h src/lex.h src/load-save.h src/mkbuiltins src/oct-usr-fcn.h src/pager.h src/parse.h src/pr-output.cc src/pr-output.h src/pt-mat.h src/pt-misc.h src/pt-plot.h src/toplev.h src/variables.cc src/variables.h
diffstat 21 files changed, 113 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,12 +39,14 @@
   endif
 endif
 
-DLD_SRC := balance.cc chol.cc colloc.cc dassl.cc det.cc eig.cc \
-	   expm.cc fft.cc fft2.cc filter.cc find.cc fsolve.cc \
-	   fsqp.cc getgrent.cc getpwent.cc getrusage.cc givens.cc \
-	   hess.cc ifft.cc ifft2.cc inv.cc log.cc lpsolve.cc lsode.cc \
-	   lu.cc minmax.cc npsol.cc pinv.cc qpsol.cc qr.cc quad.cc \
-	   qzval.cc rand.cc schur.cc sort.cc svd.cc syl.cc time.cc 
+DLD_SRC := 
+
+#balance.cc chol.cc colloc.cc dassl.cc det.cc eig.cc \
+#	   expm.cc fft.cc fft2.cc filter.cc find.cc fsolve.cc \
+#	   fsqp.cc getgrent.cc getpwent.cc getrusage.cc givens.cc \
+#	   hess.cc ifft.cc ifft2.cc inv.cc log.cc lpsolve.cc lsode.cc \
+#	   lu.cc minmax.cc npsol.cc pinv.cc qpsol.cc qr.cc quad.cc \
+#	   qzval.cc rand.cc schur.cc sort.cc svd.cc syl.cc time.cc 
 
 DLD_OBJ := $(patsubst %.cc, %.o, $(DLD_SRC))
 
@@ -62,7 +64,7 @@
   DLD_STATIC_OBJ := $(DLD_OBJ)
 endif
 
-INCLUDES := builtins.h data.h defun.h defun-dld.h \
+INCLUDES := builtins.h defun.h defun-dld.h \
 	defun-int.h dirfns.h dynamic-ld.h error.h file-io.h \
 	fn-cache.h gripes.h help.h input.h lex.h load-save.h \
 	mappers.h oct.h oct-fstrm.h oct-hist.h oct-iostrm.h \
@@ -72,17 +74,18 @@
 	pt-const.h pt-exp-base.h pt-exp.h pt-id.h pt-indir.h \
 	pt-mat.h pt-misc.h pt-mvr-base.h pt-mvr.h \
 	pt-plot.h pt-pr-code.h pt-walk.h sighandlers.h symtab.h \
-	syscalls.h sysdep.h systime.h syswait.h token.h toplev.h \
+	sysdep.h systime.h syswait.h token.h toplev.h \
 	unwind-prot.h utils.h variables.h version.h xdiv.h xpow.h \
 	BaseSLList.h Map.h SLList.h SLStack.h Stack.h ov-re-mat.h \
 	ov-cx-mat.h ov-ch-mat.h ov-list.h ov-struct.h ov-scalar.h \
 	ov-range.h ov-complex.h ov-va-args.h ov-colon.h ov-base.h \
-	ov-str-mat.h ov-bool-mat.h ov-bool.h ov.h ov-typeinfo.h ops.h \
-	op-b-b.h op-bm-bm.h op-cm-cm.h op-cm-cs.h op-cm-m.h op-cm-s.h \
-	op-cs-cm.h op-cs-cs.h op-cs-m.h op-cs-s.h op-m-cm.h op-m-cs.h \
-	op-m-m.h op-m-s.h op-s-cm.h op-s-cs.h op-s-m.h op-s-s.h \
-	op-str-str.h oct-sym.h oct-fcn.h oct-builtin.h oct-mapper.h \
-	oct-usr-fcn.h
+	ov-str-mat.h ov-bool-mat.h ov-bool.h ov-file.h ov.h \
+	ov-typeinfo.h ops.h op-b-b.h op-bm-bm.h op-cm-cm.h \
+	op-cm-cs.h op-cm-m.h op-cm-s.h op-cs-cm.h op-cs-cs.h \
+	op-cs-m.h op-cs-s.h op-m-cm.h op-m-cs.h op-m-m.h \
+	op-m-s.h op-s-cm.h op-s-cs.h op-s-m.h op-s-s.h \
+	op-str-str.h oct-sym.h oct-fcn.h oct-builtin.h \
+	oct-mapper.h oct-usr-fcn.h
 
 TI_SRC := Array-oc.cc Array-os.cc Array-tc.cc Map-fnc.cc Map-tc.cc \
 	SLList-expr.cc SLList-misc.cc SLList-plot.cc SLList-tc.cc \
@@ -113,12 +116,13 @@
 	utils.cc variables.cc xdiv.cc xpow.cc ov-base.cc ov-ch-mat.cc \
 	ov-list.cc ov-re-mat.cc ov-cx-mat.cc ov-range.cc ov-scalar.cc \
 	ov-complex.cc ov-str-mat.cc ov-struct.cc ov-va-args.cc \
-	ov-colon.cc ov-bool-mat.cc ov-bool.cc ov.cc ov-typeinfo.cc \
-	ops.cc op-b-b.cc op-bm-bm.cc op-cm-cm.cc op-cm-cs.cc \
-	op-cm-m.cc op-cm-s.cc op-cs-cm.cc op-cs-cs.cc op-cs-m.cc \
-	op-cs-s.cc op-m-cm.cc op-m-cs.cc op-m-m.cc op-m-s.cc \
-	op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc op-str-str.cc \
-	oct-fcn.cc oct-builtin.cc oct-mapper.cc oct-usr-fcn.cc
+	ov-colon.cc ov-bool-mat.cc ov-bool.cc ov-file.cc ov.cc \
+	ov-typeinfo.cc ops.cc op-b-b.cc op-bm-bm.cc op-cm-cm.cc \
+	op-cm-cs.cc op-cm-m.cc op-cm-s.cc op-cs-cm.cc op-cs-cs.cc \
+	op-cs-m.cc op-cs-s.cc op-m-cm.cc op-m-cs.cc op-m-m.cc \
+	op-m-s.cc op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc \
+	op-str-str.cc oct-fcn.cc oct-builtin.cc oct-mapper.cc \
+	oct-usr-fcn.cc
 
 OBJECTS_4 := $(SOURCES)
 OBJECTS_3 := $(patsubst %.l, %.o, $(OBJECTS_4))
@@ -136,18 +140,25 @@
 
 # Ugh.
 
-DEP_SOURCES_3 := $(SOURCES) $(DLD_SRC) $(TI_SRC) builtins.cc octave.cc
-DEP_SOURCES_2 := $(patsubst %.l, %.cc, $(DEP_SOURCES_3))
-DEP_SOURCES_1 := $(patsubst %.y, %.cc, $(DEP_SOURCES_2))
-DEP_SOURCES := $(patsubst %.c, %.d, $(DEP_SOURCES_1))
-MAKEDEPS := $(patsubst %.cc, %.d, $(DEP_SOURCES))
+DEP_4 := $(SOURCES) $(DLD_SRC) $(TI_SRC) builtins.cc octave.cc
+DEP_3 := $(patsubst %.l, %.cc, $(DEP_4))
+DEP_2 := $(patsubst %.y, %.cc, $(DEP_3))
+DEP_1 := $(patsubst %.c, %.d, $(DEP_2))
+MAKEDEPS := $(patsubst %.cc, %.d, $(DEP_1))
 
-DEF_FILES_5 := $(SOURCES) $(DLD_SRC) $(TI_SRC)
-DEF_FILES_4 := $(addprefix $(srcdir)/, $(DEF_FILES_5))
-DEF_FILES_3 := $(notdir $(shell grep -l "^DEFUN" $(DEF_FILES_4)))
-DEF_FILES_2 := $(patsubst %.y, %.df, $(DEF_FILES_3))
-DEF_FILES_1 := $(patsubst %.l, %.df, $(DEF_FILES_2))
-DEF_FILES := $(patsubst %.cc, %.df, $(DEF_FILES_1))
+DEF_5 := $(SOURCES) $(DLD_SRC) $(TI_SRC)
+DEF_4 := $(addprefix $(srcdir)/, $(DEF_5))
+DEF_3 := $(notdir $(shell grep -l "^DEFUN" $(DEF_4)))
+DEF_2 := $(patsubst %.y, %.df, $(DEF_3))
+DEF_1 := $(patsubst %.l, %.df, $(DEF_2))
+DEF_FILES := $(patsubst %.cc, %.df, $(DEF_1))
+
+VAR_5 := $(SOURCES) $(DLD_SRC) $(TI_SRC)
+VAR_4 := $(addprefix $(srcdir)/, $(VAR_5))
+VAR_3 := $(notdir $(shell egrep -l "^[\t ]*DEF(VAR|CONST)" $(VAR_4)))
+VAR_2 := $(patsubst %.y, %, $(VAR_3))
+VAR_1 := $(patsubst %.l, %, $(VAR_2))
+VAR_FILES := $(patsubst %.cc, %, $(VAR_1))
 
 OCTAVE_LFLAGS = -L../liboctave -L../libcruft -L../readline \
 	-L../kpathsea -L../glob -L../dlfcn -L. $(RLD_FLAG)
@@ -234,8 +245,12 @@
 	touch stamp-tinst
 
 builtins.cc: $(DEF_FILES) mkbuiltins
-	@echo making $@ from $(DEF_FILES)
-	@$(srcdir)/mkbuiltins $(DEF_FILES) > $@.t
+	@echo making $@
+	@echo DEF_FILES = $(DEF_FILES)
+	@echo VAR_FILES = $(VAR_FILES)
+	@echo $(DEF_FILES) > def-files
+	@echo $(VAR_FILES) > var-files
+	@$(srcdir)/mkbuiltins def-files var-files > $@.t
 	@$(top_srcdir)/move-if-change $@.t $@
 
 $(DEF_FILES): mkdefs defun-int.h defun-dld.h defun.h defaults.h oct-conf.h
@@ -324,7 +339,8 @@
 	etags $(SOURCES) $(DLD_SRC) $(TI_SRC)
 
 clean:
-	rm -f *.a *.o *.d *.df *.oct pic/*.o builtins.cc defaults.h oct-conf.h
+	rm -f *.a *.o *.d *.df *.oct pic/*.o
+	rm -f builtins.cc defaults.h oct-conf.h def-files var-files
 	if $(SHARED_LIBS); then rm -f *.$(SHLEXT); fi
 .PHONY: clean
 
--- a/src/defaults.h.in
+++ b/src/defaults.h.in
@@ -135,8 +135,6 @@
 
 extern void install_defaults (void);
 
-extern void symbols_of_defaults (void);
-
 #endif
 
 /*
--- a/src/dirfns.h
+++ b/src/dirfns.h
@@ -34,8 +34,6 @@
 
 extern string Vcurrent_directory;
 
-extern void symbols_of_dirfns (void);
-
 #endif
 
 /*
--- a/src/error.h
+++ b/src/error.h
@@ -47,8 +47,6 @@
 // The message buffer
 extern ostrstream *error_message_buffer;
 
-extern void symbols_of_error (void);
-
 #endif
 
 /*
--- a/src/file-io.h
+++ b/src/file-io.h
@@ -29,8 +29,6 @@
 
 extern void close_files (void);
 
-extern void symbols_of_file_io (void);
-
 #endif
 
 /*
--- a/src/help.h
+++ b/src/help.h
@@ -55,8 +55,6 @@
 // (--info-program program)
 extern string Vinfo_prog;
 
-extern void symbols_of_help (void);
-
 #endif
 
 /*
--- a/src/input.h
+++ b/src/input.h
@@ -74,8 +74,6 @@
 
 extern string Vps4;
 
-extern void symbols_of_input (void);
-
 #endif
 
 /*
--- a/src/lex.h
+++ b/src/lex.h
@@ -193,8 +193,6 @@
 // Flags that need to be shared between the lexer and parser.
 extern lexical_feedback lexer_flags;
 
-extern void symbols_of_lex (void);
-
 #endif
 
 /*
--- a/src/load-save.h
+++ b/src/load-save.h
@@ -40,8 +40,6 @@
 
 extern void save_user_variables (void);
 
-extern void symbols_of_load_save (void);
-
 #endif
 
 /*
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -1,5 +1,23 @@
 #!/bin/sh
 
+if test $# -ne 2; then
+  echo "usage: mkbuiltins f1 f2" 1>&2
+  exit 1
+fi
+
+DEF_FILES=`cat $1`
+VAR_FILES=`cat $2`
+
+if test -z "$DEF_FILES"; then
+  echo "mkbuiltins: DEF_FILES is empty!" 1>&2
+  exit 1
+fi
+
+if test -z "$VAR_FILES"; then
+  echo "mkbuiltins: VAR_FILES is empty!" 1>&2
+  exit 1
+fi
+
 cat << \EOF
 // DO NOT EDIT!  Generated automatically by mkbuiltins.
 
@@ -15,23 +33,43 @@
 
 EOF
 
-for file in "$@"; do
-  fcn=`echo $file | sed -e 's/\.df//' -e 's/-/_/g'`
+for file in $DEF_FILES; do
+  fcn=`echo $file | sed 's/\.df//; s/-/_/g'`
   echo "static void"
   echo "install_${fcn}_fcns (void)"
   echo "{"
   cat $file
   echo "}"
+  echo ""
+done
+
+for file in $VAR_FILES; do
+  file=`echo $file | sed 's/-/_/g'`
+  echo "extern void symbols_of_${file} (void);"
 done
 
 cat << \EOF
+
+static void
+install_builtin_variables (void)
+{
+EOF
+
+for file in $VAR_FILES; do
+  file=`echo $file | sed 's/-/_/g'`
+  echo "  symbols_of_${file} ();"
+done
+
+cat << \EOF
+}
+
 static void
 install_builtin_functions (void)
 {
 EOF
 
-for file in "$@"; do
-  fcn=`echo $file | sed -e 's/\.df//' -e 's/-/_/g'`
+for file in $DEF_FILES; do
+  fcn=`echo $file | sed 's/\.df//; s/-/_/g'`
   echo "  install_${fcn}_fcns ();"
 done
 
--- a/src/oct-usr-fcn.h
+++ b/src/oct-usr-fcn.h
@@ -182,8 +182,6 @@
   void bind_nargin_and_nargout (int nargin, int nargout);
 };
 
-extern void symbols_of_oct_usr_fcn (void);
-
 #endif
 
 /*
--- a/src/pager.h
+++ b/src/pager.h
@@ -114,8 +114,6 @@
 
 extern void flush_octave_stdout (void);
 
-extern void symbols_of_pager (void);
-
 #endif
 
 /*
--- a/src/parse.h
+++ b/src/parse.h
@@ -51,8 +51,6 @@
 // Buffer for help text snagged from function files.
 extern string help_buf;
 
-extern void symbols_of_parse (void);
-
 #endif
 
 /*
--- a/src/pr-output.cc
+++ b/src/pr-output.cc
@@ -1132,7 +1132,9 @@
 	      else
 		os << "+";
 	    }
-	  os << "\n";
+
+	  if (i < nr - 1)
+	    os << "\n";
 	}
     }
   else
@@ -1230,7 +1232,8 @@
 		      pr_float (os, m (i, j), fw);
 		    }
 
-		  os << "\n";
+		  if (i < nr - 1)
+		    os << "\n";
 		}
 	    }
 	}
@@ -1281,7 +1284,9 @@
 	      else
 		os << "+";
 	    }
-	  os << "\n";
+
+	  if (i < nr - 1)
+	    os << "\n";
 	}
     }
   else
@@ -1379,7 +1384,9 @@
 
 		      pr_complex (os, cm (i, j));
 		    }
-		  os << "\n";
+
+		  if (i < nr - 1) 
+		    os << "\n";
 		}
 	    }
 	}
@@ -1475,9 +1482,10 @@
 		  pr_float (os, val, fw);
 		}
 
-	      os << "\n";
+	      col += inc;
 
-	      col += inc;
+	      if (col < num_elem)
+		os << "\n";
 	    }
 	}
     }
@@ -1495,9 +1503,7 @@
       if (pr_as_read_syntax && nstr > 1)
 	os << "[ ";
 
-      if (nstr == 0)
-	os << "\n";
-      else
+      if (nstr != 0)
 	{
 	  for (int i = 0; i < nstr; i++)
 	    {
@@ -1511,7 +1517,12 @@
 		    os << "; ";
 		}
 	      else
-		os << row << "\n";
+		{
+		  os << row;
+
+		  if (i < nstr - 1)
+		    os << "\n";
+		}
 	    }
 	}
 
--- a/src/pr-output.h
+++ b/src/pr-output.h
@@ -55,8 +55,6 @@
 				   bool pr_as_string = false,
 				   int extra_indent = 0);
 
-extern void symbols_of_pr_output (void);
-
 #endif
 
 /*
--- a/src/pt-mat.h
+++ b/src/pt-mat.h
@@ -82,8 +82,6 @@
   void accept (tree_walker& tw);
 };
 
-extern void symbols_of_pt_mat (void);
-
 #endif
 
 /*
--- a/src/pt-misc.h
+++ b/src/pt-misc.h
@@ -436,8 +436,6 @@
   void accept (tree_walker& tw);
 };
 
-extern void symbols_of_pt_misc (void);
-
 #endif
 
 /*
--- a/src/pt-plot.h
+++ b/src/pt-plot.h
@@ -315,8 +315,6 @@
 
 extern void do_external_plotter_cd (const string& newdir);
 
-extern void symbols_of_pt_plot (void);
-
 #endif
 
 /*
--- a/src/toplev.h
+++ b/src/toplev.h
@@ -52,9 +52,6 @@
 extern void
 do_octave_atexit (void);
 
-extern void
-symbols_of_toplev (void);
-
 // argv[0] for this program.
 extern string Vprogram_invocation_name;
 
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -1692,31 +1692,6 @@
     "save command history");
 }
 
-void
-install_builtin_variables (void)
-{
-  symbols_of_data ();
-  symbols_of_defaults ();
-  symbols_of_dirfns ();
-  symbols_of_error ();
-  symbols_of_file_io ();
-  symbols_of_help ();
-  symbols_of_input ();
-  symbols_of_lex ();
-  symbols_of_load_save ();
-  symbols_of_oct_usr_fcn ();
-  symbols_of_pager ();
-  symbols_of_parse ();
-  symbols_of_pr_output ();
-  symbols_of_pt_mat ();
-  symbols_of_pt_misc ();
-  symbols_of_pt_plot ();
-  symbols_of_syscalls ();
-  symbols_of_toplev ();
-  symbols_of_value ();
-  symbols_of_variables ();
-}
-
 // Deleting names from the symbol tables.
 
 DEFUN_TEXT (clear, args, ,
--- a/src/variables.h
+++ b/src/variables.h
@@ -159,8 +159,6 @@
 		       sv_Function f = (sv_Function) 0,
 		       const string& help = string ());
 
-extern void install_builtin_variables (void);
-
 // Symbol table for symbols at the top level.
 extern symbol_table *top_level_sym_tab;