From bug-octave-request at bevo dot che dot wisc dot edu Sun Aug 20 14:13:24 2000 Subject: Bug report for parse.y function frob_function_def() From: "Martin Lang" To: Date: Sun, 20 Aug 2000 17:00:00 +0200 Bug report for Octave 2.0.16 configured for i386-pc-cygwin32 Description: ----------- Configure script defined the following item in config.h #define HAVE_GETTIMEOFDAY 1 After having octave compiled with this option, the time determination did not work (new files will not be recognized) Repeat-By: --------- N.A. Fix: --- One place for the problem may be in parse.y function frob_function_def: see Appendix 1. The problem may be the following line: time_t now = time (0); Function which use the same context, e.g. function symbol_out_of_date() in variables.cc, use the following code: #if defined (HAVE_GETTIMEOFDAY) struct timeval tv; #if defined (GETTIMEOFDAY_NO_TZ) gettimeofday (&tv); #else gettimeofday (&tv, 0); #endif double now = (double) tv.tv_sec + (double) tv.tv_usec / 1e6; #else double now = (double) time (0); #endif see Appendix 2 There might be other places with the problem, which I did not find. One quick fix for me was setting #define HAVE_GETTIMEOFDAY 0 after configuring. Best regards Martin Lang (Germany) Configuration (please do not edit this section): ----------------------------------------------- uname output: CYGWIN_95-4.0 PC1 20.1 (0.3/1/1) 1998-12-3 20:39:18 i586 unknown configure opts: Fortran compiler: g77 FFLAGS: -O F2C: F2CFLAGS: FLIBS: -lg2c -lm -L/SYS/GNU/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/ i586-cygwin32/2.95.2 -L/SYS/GNU/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib -L/SYS/ GNU/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95.2/../../../../i5 86-cygwin32/lib -L/SYS/GNU/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin3 2/2.95.2/../../.. -lm -lcygwin -luser32 -ladvapi32 -lshell32 CPPFLAGS: INCFLAGS: -I/usr/local/include -I/usr/local/include/octave-2.0.16 C compiler: gcc, version 2.95.2 19991024 (release) CFLAGS: -DHAVE_CONFIG_H -mieee-fp -g -O2 -Wall CPICFLAG: -fPIC C++ compiler: c++, version 2.95.2 19991024 (release) CXXFLAGS: -DHAVE_CONFIG_H -mieee-fp -fno-rtti -fno-exceptions -fno-i mplicit-templates -g -O2 -Wall CXXPICFLAG: -fPIC LDFLAGS: -g LIBFLAGS: -L/usr/local/lib/octave-2.0.16 RLD_FLAG: TERMLIBS: -ltermcap LIBS: LEXLIB: LIBPLPLOT: LIBDLFCN: DEFS: -DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=":" -DUSE_READLINE=1 -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1 -DHAVE_LIBM=1 -DF77_APPEND_UNDERSCORE=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_ALLOCA=1 -DNPOS=string::npos -DSTDC_HEADERS=1 -DHAVE_DIRENT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_ASSERT_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_FLOAT_H=1 -DHAVE_GRP_H=1 -DHAVE_IEEEFP_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_PWD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_UTSNAME_H=1 -DHAVE_TERMIO_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_VARARGS_H=1 -DHAVE_ATEXIT=1 -DHAVE_BCOPY=1 -DHAVE_BZERO=1 -DHAVE_DUP2=1 -DHAVE_ENDGRENT=1 -DHAVE_ENDPWENT=1 -DHAVE_EXEC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HAVE_GR_PASSWD=1 -DEXCEPTION_IN_MATH=1 -DRETSIGTYPE=void -DHAVE_POSIX_SIGNALS=1 -DHAVE_GETRUSAGE=1 -DHAVE_TIMES=1 -DRUSAGE_TIMES_ONLY=1 Appendix 1: (out of src/parse.y) // Do most of the work for defining a function. static tree_function * frob_function_def (tree_identifier *id, tree_function *fcn) { string id_name = id->name (); // If input is coming from a file, issue a warning if the name of // the file does not match the name of the function stated in the // file. Matlab doesn't provide a diagnostic (it ignores the stated // name). fcn->stash_function_name (id_name); if (reading_fcn_file) { if (curr_fcn_file_name != id_name) { if (Vwarn_function_name_clash) warning ("function name `%s' does not agree with function\ file name `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ()); global_sym_tab->rename (id_name, curr_fcn_file_name); if (error_state) return 0; id_name = id->name (); } time_t now = time (0); fcn->stash_function_name (id_name); fcn->stash_fcn_file_name (); fcn->stash_fcn_file_time (now); fcn->mark_as_system_fcn_file (); if (Vwarn_future_time_stamp) { string nm = fcn->fcn_file_name (); file_stat fs (nm); if (fs && fs.is_newer (now)) warning ("time stamp for `%s' is in the future", nm.c_str ()); } } else if (! (input_from_tmp_history_file || input_from_startup_file) && reading_script_file && curr_fcn_file_name == id_name) { warning ("function `%s' defined within script file `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ()); } top_level_sym_tab->clear (id_name); id->define (fcn); id->document (help_buf); return fcn; } Appendix 2: (out of src/variables.cc) // Is there a corresponding function file that is newer than the // symbol definition? static int symbol_out_of_date (symbol_record *sr) { if (Vignore_function_time_stamp == 2) return 0; if (sr) { tree_fvc *ans = sr->def (); if (ans) { string ff = ans->fcn_file_name (); if (! ff.empty () && ! (Vignore_function_time_stamp && ans->is_system_fcn_file ())) { if (Vlast_prompt_time >= ans->time_checked ()) { time_t tp = ans->time_parsed (); string fname; if (ans->is_builtin ()) fname = ff; else fname = fcn_file_in_path (ff); #if defined (HAVE_GETTIMEOFDAY) struct timeval tv; #if defined (GETTIMEOFDAY_NO_TZ) gettimeofday (&tv); #else gettimeofday (&tv, 0); #endif double now = (double) tv.tv_sec + (double) tv.tv_usec / 1e6; #else double now = (double) time (0); #endif ans->mark_fcn_file_up_to_date (now); file_stat fs (fname); if (fs && fs.is_newer (tp)) return 1; } } } } return 0; } ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------