# HG changeset patch # User jwe # Date 940496234 0 # Node ID 7ae1928ca623243e55d04c30106cfa21a32a6efe # Parent b6c74a0772b5be6e0077684644cd485568c9ee38 [project @ 1999-10-21 08:57:11 by jwe] diff -r b6c74a0772b5 -r 7ae1928ca623 ChangeLog --- a/ChangeLog Thu Oct 21 03:09:53 1999 +0000 +++ b/ChangeLog Thu Oct 21 08:57:14 1999 +0000 @@ -1,3 +1,8 @@ +1999-10-21 John W. Eaton + + * configure.in: Check for select and poll. Also check for poll.h + and sys/poll.h. + 1999-10-19 Geoff Jacobsen * autogen.sh: New file. diff -r b6c74a0772b5 -r 7ae1928ca623 configure.in --- a/configure.in Thu Oct 21 03:09:53 1999 +0000 +++ b/configure.in Thu Oct 21 08:57:14 1999 +0000 @@ -21,7 +21,7 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -AC_REVISION($Revision: 1.317 $) +AC_REVISION($Revision: 1.318 $) AC_PREREQ(2.9) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h) @@ -706,11 +706,12 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(assert.h curses.h dlfcn.h fcntl.h float.h floatingpoint.h \ - fnmatch.h glob.h grp.h ieeefp.h limits.h memory.h nan.h ncurses.h \ - pwd.h sgtty.h stdlib.h string.h sys/ioctl.h sys/param.h sys/resource.h \ - sys/select.h sys/stat.h sys/time.h sys/times.h sys/types.h \ - sys/utsname.h termcap.h termio.h $TERMIOS_H unistd.h varargs.h) +AC_CHECK_HEADERS(assert.h curses.h dlfcn.h fcntl.h float.h \ + floatingpoint.h fnmatch.h glob.h grp.h ieeefp.h limits.h memory.h \ + nan.h ncurses.h poll.h pwd.h sgtty.h stdlib.h string.h sys/ioctl.h \ + sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \ + sys/time.h sys/times.h sys/types.h sys/utsname.h termcap.h \ + termio.h $TERMIOS_H unistd.h varargs.h) ### I'm told that termios.h is broken on NeXT systems. @@ -776,11 +777,11 @@ AC_CHECK_FUNCS(atexit bcopy bzero dup2 endgrent endpwent execvp fcntl \ fork getcwd getegid geteuid getgid getgrent getgrgid getgrnam \ gethostname getpgrp getpid getppid getpwent getpwnam getpwuid \ - gettimeofday getuid getwd lstat memmove mkdir mkfifo on_exit pipe \ - putenv rename rindex rmdir setgrent setpwent setvbuf sigaction \ - sigpending sigprocmask sigsuspend stat strcasecmp strdup strerror \ - strftime stricmp strncasecmp strnicmp tempnam umask unlink usleep \ - vfprintf vsprintf waitpid) + gettimeofday getuid getwd lstat memmove mkdir mkfifo on_exit pipe + poll putenv rename rindex rmdir select setgrent setpwent setvbuf \ + sigaction sigpending sigprocmask sigsuspend stat strcasecmp strdup \ + strerror strftime stricmp strncasecmp strnicmp tempnam umask unlink \ + usleep vfprintf vsprintf waitpid) OCTAVE_SMART_PUTENV diff -r b6c74a0772b5 -r 7ae1928ca623 src/ChangeLog --- a/src/ChangeLog Thu Oct 21 03:09:53 1999 +0000 +++ b/src/ChangeLog Thu Oct 21 08:57:14 1999 +0000 @@ -1,3 +1,22 @@ +1999-10-21 John W. Eaton + + * variables.h (is_valid_function): Provide default values for the + string argument. + + * symtab.cc (variable_reference): Maybe print warning (or error) + about variables that hide functions of the same name. + (symbol_record::define (const octave_value&, unsigned int)): Ditto. + (Vvariables_can_hide_functions): New static variable. + (variables_can_hide_functions, symbols_of_symtab): New functions. + + * cutils.c: New file. + * Makefile.in (SOURCES): Add it to the list. + * utils.h: Declare octave_usleep here. + * dirfns.cc (Fls): Simply all octave_usleep. + * oct-procbuf.cc (octave_procbuf::open): Ditto. + * sysdep.cc (Fusleep): Ditto. + * toplev.cc (run_command_and_return_output): Ditto. + 1999-10-20 John W. Eaton * data.cc (make_diag (const octave_value&, const octave_value&)): diff -r b6c74a0772b5 -r 7ae1928ca623 src/Makefile.in --- a/src/Makefile.in Thu Oct 21 03:09:53 1999 +0000 +++ b/src/Makefile.in Thu Oct 21 08:57:14 1999 +0000 @@ -123,7 +123,7 @@ pt-select.cc pt-stmt.cc pt-unop.cc DIST_SRC := BaseSLList.cc Map.cc SLList.cc SLStack.cc Stack.cc \ - data.cc defaults.cc defun.cc dirfns.cc dynamic-ld.cc \ + cutils.c data.cc defaults.cc defun.cc dirfns.cc dynamic-ld.cc \ error.cc file-io.cc fn-cache.cc gripes.cc help.cc input.cc \ lex.l load-save.cc mappers.cc matherr.c oct-fstrm.cc \ oct-hist.cc oct-iostrm.cc oct-map.cc oct-obj.cc oct-prcstrm.cc \ diff -r b6c74a0772b5 -r 7ae1928ca623 src/dirfns.cc --- a/src/dirfns.cc Thu Oct 21 03:09:53 1999 +0000 +++ b/src/dirfns.cc Thu Oct 21 08:57:14 1999 +0000 @@ -197,11 +197,7 @@ { cmd->clear (); -#if defined (HAVE_USLEEP) - usleep (100); -#else - sleep (1); -#endif + octave_usleep (100); } while (cmd->get (ch)) diff -r b6c74a0772b5 -r 7ae1928ca623 src/oct-procbuf.cc --- a/src/oct-procbuf.cc Thu Oct 21 03:09:53 1999 +0000 +++ b/src/oct-procbuf.cc Thu Oct 21 08:57:14 1999 +0000 @@ -43,6 +43,7 @@ #include "defun.h" #include "gripes.h" +#include "utils.h" // Number of microseconds to delay in the parent after forking. #if defined (__CYGWIN32__) @@ -112,13 +113,8 @@ exit (127); } -#if defined (HAVE_USLEEP) if (Vkluge_procbuf_delay > 0) - usleep (Vkluge_procbuf_delay); -#else - if (Vkluge_procbuf_delay > 499999) - sleep ((Vkluge_procbuf_delay + 500000) / 1000000); -#endif + octave_usleep (Vkluge_procbuf_delay); ::close (child_end); diff -r b6c74a0772b5 -r 7ae1928ca623 src/symtab.cc --- a/src/symtab.cc Thu Oct 21 03:09:53 1999 +0000 +++ b/src/symtab.cc Thu Oct 21 08:57:14 1999 +0000 @@ -37,6 +37,7 @@ #include "glob-match.h" #include "str-vec.h" +#include "defun.h" #include "error.h" #include "oct-lvalue.h" #include "ov.h" @@ -45,6 +46,11 @@ #include "utils.h" #include "variables.h" +// Should variables be allowed to hide functions of the same name? A +// positive value means yes. A negative value means yes, but print a +// warning message. Zero means it should be considered an error. +static int Vvariables_can_hide_functions; + octave_allocator symbol_record::symbol_def::allocator (sizeof (symbol_record::symbol_def)); @@ -74,7 +80,17 @@ if (! (is_variable () && read_only_error ("redefine"))) { if (is_function () || is_constant ()) - push_def (new symbol_def ()); + { + if (Vvariables_can_hide_functions) + { + push_def (new symbol_def ()); + + if (Vvariables_can_hide_functions < 0) + warning ("variable `%s' hides function", nm.c_str ()); + } + else + error ("variable `%s' hides function", nm.c_str ()); + } if (definition->type () == symbol_record::BUILTIN_VARIABLE) sym_type = symbol_record::BUILTIN_VARIABLE; @@ -243,6 +259,19 @@ octave_lvalue symbol_record::variable_reference (void) { + if (Vvariables_can_hide_functions <= 0 + && (is_function () + || (! is_defined () && is_valid_function (nm)))) + { + if (Vvariables_can_hide_functions < 0) + warning ("variable `%s' hides function", nm.c_str ()); + else + { + error ("variable `%s' hides function", nm.c_str ()); + return octave_lvalue (); + } + } + if (is_function () || is_constant ()) clear (); @@ -778,6 +807,24 @@ return h & (table_size - 1); } + +static int +variables_can_hide_functions (void) +{ + Vvariables_can_hide_functions + = check_preference ("variables_can_hide_functions"); + + return 0; +} + +void +symbols_of_symtab (void) +{ + DEFVAR (variables_can_hide_functions, 1.0, variables_can_hide_functions, + "Should variables be allowed to hide functions of the same name?"); +} + + /* ;;; Local Variables: *** ;;; mode: C++ *** diff -r b6c74a0772b5 -r 7ae1928ca623 src/sysdep.cc --- a/src/sysdep.cc Thu Oct 21 03:09:53 1999 +0000 +++ b/src/sysdep.cc Thu Oct 21 08:57:14 1999 +0000 @@ -519,17 +519,10 @@ warning ("usleep: NaN is an invalid delay"); else { -#if defined (HAVE_USLEEP) int delay = NINT (dval); if (delay > 0) - usleep (delay); -#else - int delay = NINT (dval / 1e6); - - if (delay > 0) - sleep (delay); -#endif + octave_usleep (delay); } } } diff -r b6c74a0772b5 -r 7ae1928ca623 src/toplev.cc --- a/src/toplev.cc Thu Oct 21 03:09:53 1999 +0000 +++ b/src/toplev.cc Thu Oct 21 08:57:14 1999 +0000 @@ -335,11 +335,7 @@ { cmd->clear (); -#if defined (HAVE_USLEEP) - usleep (100); -#else - sleep (1); -#endif + octave_usleep (100); } while (cmd->get (ch)) diff -r b6c74a0772b5 -r 7ae1928ca623 src/utils.h --- a/src/utils.h Thu Oct 21 03:09:53 1999 +0000 +++ b/src/utils.h Thu Oct 21 08:57:14 1999 +0000 @@ -58,6 +58,8 @@ extern int check_preference (const string& var); +extern "C" void octave_usleep (unsigned int useconds); + #endif /* diff -r b6c74a0772b5 -r 7ae1928ca623 src/variables.h --- a/src/variables.h Thu Oct 21 03:09:53 1999 +0000 +++ b/src/variables.h Thu Oct 21 08:57:14 1999 +0000 @@ -50,10 +50,12 @@ extern bool is_globally_visible (const string&); extern octave_function * -is_valid_function (const octave_value&, const string&, bool warn = false); +is_valid_function (const octave_value&, const string& = string (), + bool warn = false); extern octave_function * -is_valid_function (const string&, const string&, bool warn = false); +is_valid_function (const string&, const string& = string (), + bool warn = false); extern octave_function * extract_function (const octave_value& arg, const string& warn_for,