Mercurial > hg > octave-lyh
changeset 4067:e97fb79fc1d5
[project @ 2002-09-26 22:43:25 by jwe]
author | jwe |
---|---|
date | Thu, 26 Sep 2002 22:43:25 +0000 |
parents | 47d3baea432d |
children | 2c088a2f36e2 |
files | ChangeLog aclocal.m4 configure.in src/ChangeLog src/cutils.c src/sysdep.cc src/sysdep.h src/utils.h |
diffstat | 8 files changed, 78 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-09-25 Mumit Khan <khan@nanotech.wisc.edu> + + * aclocal.m4 (OCTAVE_MKDIR_TAKES_ONE_ARG): New macro to determine if + host mkdir accepts only one arg instead of the usual two. + * configure.in: Use. Check for direct.h. + (mkdir): Define. + +2002-09-26 Paul Kienzle <pkienzle@users.sf.net> + + * configure.in: Check for conio.h. + Check for _kbhit. + 2002-09-26 John W. Eaton <jwe@bevo.che.wisc.edu> * configure.in (AH_BOTTOM): Don't define
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -643,4 +643,24 @@ AC_MSG_RESULT($octave_cv_cxx_abi) AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) ]) - +dnl +dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. +dnl +AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, +[AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, +[AC_TRY_COMPILE([ +#include <sys/types.h> +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#ifdef HAVE_DIRECT_H +# include <direct.h> +#endif], [mkdir ("foo", 0);], + octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) +if test $octave_cv_mkdir_takes_one_arg = yes ; then + AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) +fi +])
--- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.368 $) +AC_REVISION($Revision: 1.369 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -792,7 +792,7 @@ ### C headers -AC_CHECK_HEADERS(assert.h curses.h dlfcn.h fcntl.h float.h \ +AC_CHECK_HEADERS(assert.h curses.h direct.h dlfcn.h fcntl.h float.h \ floatingpoint.h grp.h ieeefp.h limits.h memory.h nan.h \ ncurses.h poll.h pwd.h stdlib.h string.h sys/ioctl.h \ sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \ @@ -811,6 +811,7 @@ AC_CHECK_HEADERS(sgtty.h, have_sgtty_h=yes, have_sgtty_h=no) AC_CHECK_HEADERS(glob.h, have_glob_h=yes, have_glob_h=no) AC_CHECK_HEADERS(fnmatch.h, have_fnmatch_h=yes, have_fnmatch_h=no) +AC_CHECK_HEADERS(conio.h, have_conio_h=yes, have_conio_h=no) ### I'm told that termios.h is broken on NeXT systems. @@ -868,7 +869,7 @@ AC_CHECK_FUNCS(atexit bcopy bzero dup2 endgrent endpwent execvp \ fcntl fork getcwd getegid geteuid getgid getgrent getgrgid \ getgrnam getpgrp getpid getppid getpwent \ - getpwuid gettimeofday getuid getwd link localtime_r lstat \ + getpwuid gettimeofday getuid getwd _kbhit link localtime_r lstat \ memmove mkdir mkfifo on_exit pipe poll putenv readlink rename \ rindex rmdir select setgrent setpwent setvbuf sigaction sigpending \ sigprocmask sigsuspend stat strcasecmp strdup strerror strftime \ @@ -1031,6 +1032,9 @@ AC_CHECK_MEMBERS(struct group.gr_passwd) +# mkdir takes a single argument on some systems. +OCTAVE_MKDIR_TAKES_ONE_ARG + octave_found_termlib=no for termlib in ncurses curses termcap terminfo termlib; do AC_CHECK_LIB(${termlib}, tputs, [TERMLIBS="${TERMLIBS} -l${termlib}"]) @@ -1256,6 +1260,10 @@ #if !defined(HAVE_SIGSET_T) typedef int sigset_t; #endif + +#if defined(MKDIR_TAKES_ONE_ARG) +# define mkdir(a,b) mkdir(a) +#endif ]) ### Do the substitutions in all the Makefiles.
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-09-26 Paul Kienzle <pkienzle@users.sf.net> + + * sysdep.cc: Include conio.h if it exists. + (octave_kbhit): Rename from kbhit. Implement with _kbhit if it + exists. Change all callers. + * cutils.c (octave_sleep): New function. + Change all callers of sleep to use octave_sleep instead. + 2002-09-26 John W. Eaton <jwe@bevo.che.wisc.edu> * BaseSLList.cc, BaseSLList.h, Cell.cc, Cell.h, DLList.cc, @@ -44,8 +52,6 @@ If __GNUG__, use pragma interface/implementation. Allow this to be turned off by defining NO_PRAGMA_INTERFACE_IMPLEMENTATION. - - 2002-09-26 Paul Kienzle <pkienzle@users.sf.net> * mappers.cc (install_mapper_functions): Install erf, not xerf.
--- a/src/cutils.c +++ b/src/cutils.c @@ -72,6 +72,12 @@ } void +octave_sleep (unsigned int seconds) +{ + sleep (seconds); +} + +void octave_usleep (unsigned int useconds) { unsigned int sec = useconds / 1000000;
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -47,6 +47,10 @@ #include <termio.h> #elif defined (HAVE_SGTTY_H) #include <sgtty.h> +#endif + +#if defined (HAVE_CONIO_H) +#include <conio.h> #endif #if defined (HAVE_SYS_IOCTL_H) @@ -312,8 +316,14 @@ // Read one character from the terminal. int -kbhit (bool wait) +octave_kbhit (bool wait) { +#ifdef HAVE__KBHIT + if (! wait && ! _kbhit ()) + c = 0; + else + c = std::cin.get (); +#else raw_mode (true, wait); int c = std::cin.get (); @@ -322,6 +332,7 @@ std::cin.clear (); raw_mode (false, true); +#endif return c; } @@ -433,7 +444,7 @@ if (interactive || forced_interactive) { - int c = kbhit (args.length () == 0); + int c = octave_kbhit (args.length () == 0); if (c == -1) c = 0; @@ -486,20 +497,20 @@ else if (xisinf (dval)) { flush_octave_stdout (); - kbhit (); + octave_kbhit (); } else { int delay = NINT (dval); if (delay > 0) - sleep (delay); + octave_sleep (delay); } } } else { flush_octave_stdout (); - kbhit (); + octave_kbhit (); } return retval; @@ -525,7 +536,7 @@ { int delay = NINT (dval); if (delay > 0) - sleep (delay); + octave_sleep (delay); } } }
--- a/src/sysdep.h +++ b/src/sysdep.h @@ -32,7 +32,7 @@ extern void raw_mode (bool, bool wait = true); -extern int kbhit (bool wait = true); +extern int octave_kbhit (bool wait = true); #endif
--- a/src/utils.h +++ b/src/utils.h @@ -75,6 +75,8 @@ extern "C" void octave_usleep (unsigned int useconds); +extern "C" void octave_sleep (unsigned int seconds); + extern "C" int octave_strcasecmp (const char *s1, const char *s2); extern "C" int octave_strncasecmp (const char *s1, const char *s2, size_t n);