changeset 703:21cc5b9b9ed6

[project @ 1994-09-15 02:39:57 by jwe]
author jwe
date Thu, 15 Sep 1994 02:41:12 +0000
parents 45764610984a
children 250fc1c93fe2
files src/defun-dld.h src/defun-int.h src/octave.cc
diffstat 3 files changed, 53 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/defun-dld.h	Thu Sep 15 02:32:47 1994 +0000
+++ b/src/defun-dld.h	Thu Sep 15 02:41:12 1994 +0000
@@ -36,8 +36,32 @@
 // If Octave is not configured for dynamic linking of builtin
 // functions, this is exactly like DEFUN.
 
-#define DEFUN_DLD(name, fname, sname, nargin_max, nargout_max, doc) \
+#if defined (WITH_DLD) && defined (OCTAVE_LITE) && defined (MAKE_BUILTINS)
+#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \
+  BEGIN_INSTALL_BUILTIN \
+    DEFINE_FUN_STRUCT (name, 0, sname, nargin_max, nargout_max, 0, doc); \
+    install_builtin_function (&sname); \
+  END_INSTALL_BUILTIN
+#else
+#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \
   DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 0, doc)
+#endif
+
+// Define a function that may be loaded dynamically at run time.
+//
+// If Octave is not configured for dynamic linking of builtin
+// functions, this won't do anything useful.
+//
+// The forward declaration is for the struct, the second is for the
+// definition of the function.
+
+#if ! defined (MAKE_BUILTINS)
+#define DEFUN_DLD(name, fname, sname, fsname, nargin_max, nargout_max, doc) \
+  DECLARE_FUN (fname);
+  DEFINE_FUN_STRUCT (name, fname, sname, nargin_max, nargout_max, 0, doc); \
+  DEFINE_FUN_STRUCT_FUN (sname, fsname) \
+  DECLARE_FUN (fname)
+#endif
 
 #endif
 
--- a/src/defun-int.h	Thu Sep 15 02:32:47 1994 +0000
+++ b/src/defun-int.h	Thu Sep 15 02:41:12 1994 +0000
@@ -37,9 +37,9 @@
 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \
 		       is_text_fcn, doc) \
   BEGIN_INSTALL_BUILTIN \
-    extern DECLARE_FUN(fname); \
-    static builtin_function sname = \
-      { name, nargin_max, nargout_max, is_text_fcn, fname, doc }; \
+    extern DECLARE_FUN (fname); \
+    DEFINE_FUN_STRUCT (name, fname, sname, nargin_max, nargout_max, \
+		       is_text_fcn, doc); \
     install_builtin_function (&sname); \
   END_INSTALL_BUILTIN
 
@@ -57,7 +57,7 @@
 
 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \
 		       is_text_fcn, doc) \
-  DECLARE_FUN(fname)
+  DECLARE_FUN (fname)
 
 // No definition is required for an alias.
 
@@ -65,6 +65,21 @@
 
 #endif /* ! MAKE_BUILTINS */
 
+// Define the structure that will be used to insert this function into
+// the symbol table.
+
+#define DEFINE_FUN_STRUCT(name, fname, sname, nargin_max, \
+			  nargout_max, is_text_fcn, doc) \
+  static builtin_function sname = \
+    { name, nargin_max, nargout_max, is_text_fcn, fname, doc }
+
+#define DEFINE_FUN_STRUCT_FUN(sname, fsname) \
+  builtin_function * \
+  fsname (void) \
+  { \
+    return &sname; \
+  }
+
 // Declare an internal function named fname.  This is the interface
 // used by all internal functions in Octave that are also callable
 // from the Octave language.
--- a/src/octave.cc	Thu Sep 15 02:32:47 1994 +0000
+++ b/src/octave.cc	Thu Sep 15 02:41:12 1994 +0000
@@ -54,6 +54,7 @@
 #include "sighandlers.h"
 #include "variables.h"
 #include "error.h"
+#include "dynamic-ld.h"
 #include "tree-misc.h"
 #include "tree-const.h"
 #include "tree-plot.h"
@@ -437,6 +438,10 @@
 // defaults.
   initialize_globals (argv[0]);
 
+// Initialize dynamic linking.  This might not do anything.  Must
+// happen after initializing raw_prog_name.
+  init_dynamic_linker ();
+
   int optc;
   while ((optc = getopt_long (argc, argv, short_opts, long_opts, 0)) != EOF)
     {
@@ -856,8 +861,8 @@
 
 // Execute a shell command.
 
-DEFUN ("shell_cmd", Fshell_cmd, Sshell_cmd, 2, 1,
-  "shell_cmd (string [, return_output]): execute shell commands")
+DEFUN ("system", Fsystem, Ssystem, 2, 1,
+  "system (string [, return_output]): execute shell commands")
 {
   Octave_object retval;
 
@@ -907,6 +912,8 @@
   return retval;
 }
 
+DEFALIAS (shell_cmd, system);
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***