Mercurial > octave
changeset 21888:00f1249f2483
create wrappers for some gnulib functions
Begin moving toward a clean separation between Octave and gnulib
sources.
* liboctave/wrappers/canonicalize-file-name-wrapper.c,
liboctave/wrappers/canonicalize-file-name-wrapper.h,
liboctave/wrappers/gen-tempname-wrapper.c,
liboctave/wrappers/gen-tempname-wrapper.h,
liboctave/wrappers/mkostemp-wrapper.c,
liboctave/wrappers/mkostemp-wrapper.h,
liboctave/wrappers/nanosleep-wrapper.c,
liboctave/wrappers/nanosleep-wrapper.h,
liboctave/wrappers/nproc-wrapper.c,
liboctave/wrappers/nproc-wrapper.h,
liboctave/wrappers/putenv-wrapper.c,
liboctave/wrappers/putenv-wrapper.h,
liboctave/wrappers/strftime-wrapper.c,
liboctave/wrappers/strftime-wrapper.h,
liboctave/wrappers/strptime-wrapper.c,
liboctave/wrappers/strptime-wrapper.h,
liboctave/wrappers/unsetenv-wrapper.c,
liboctave/wrappers/unsetenv-wrapper.h,
liboctave/wrappers/vasprintf-wrapper.c,
liboctave/wrappers/vasprintf-wrapper.h,
liboctave/wrappers/module.mk: New files.
* liboctave/module.mk, changed libinterp/module.mk: Update.
* file-io.cc, load-save.cc, sysdep.cc, utils.cc, file-ops.cc,
oct-time.cc, lo-utils.cc: Include wrapper headers and use wrapper
functions instead of calling gnulib functions directly.
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/libinterp/corefcn/file-io.cc Mon Jun 13 16:01:26 2016 -0400 @@ -57,6 +57,7 @@ #include "file-ops.h" #include "file-stat.h" #include "lo-ieee.h" +#include "mkostemp-wrapper.h" #include "oct-env.h" #include "oct-locbuf.h" @@ -2898,7 +2899,7 @@ OCTAVE_LOCAL_BUFFER (char, tmp, tmpl8.size () + 1); strcpy (tmp, tmpl8.c_str ()); - int fd = gnulib::mkostemp (tmp, O_BINARY); + int fd = octave_mkostemp_wrapper (tmp); if (fd < 0) {
--- a/libinterp/corefcn/load-save.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/libinterp/corefcn/load-save.cc Mon Jun 13 16:01:26 2016 -0400 @@ -38,8 +38,6 @@ #include <sstream> #include <string> -#include "strftime.h" - #include "byte-swap.h" #include "data-conv.h" #include "file-ops.h" @@ -48,10 +46,11 @@ #include "lo-mappers.h" #include "mach-info.h" #include "oct-env.h" +#include "oct-locbuf.h" #include "oct-time.h" #include "quit.h" #include "str-vec.h" -#include "oct-locbuf.h" +#include "strftime-wrapper.h" #include "Cell.h" #include "defun.h"
--- a/libinterp/corefcn/sysdep.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/libinterp/corefcn/sysdep.cc Mon Jun 13 16:01:26 2016 -0400 @@ -71,6 +71,7 @@ #include "mach-info.h" #include "oct-env.h" #include "quit.h" +#include "unsetenv-wrapper.h" #include "Cell.h" #include "builtins.h" @@ -695,7 +696,7 @@ std::string tmp = args(0).string_value (); - return ovl (gnulib::unsetenv (tmp.c_str ())); + return ovl (octave_unsetenv_wrapper (tmp.c_str ())); } /*
--- a/libinterp/corefcn/utils.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/libinterp/corefcn/utils.cc Mon Jun 13 16:01:26 2016 -0400 @@ -33,19 +33,19 @@ #include <limits> #include <string> -#include "vasnprintf.h" - #include "dir-ops.h" #include "file-ops.h" #include "file-stat.h" #include "lo-mappers.h" #include "lo-utils.h" +#include "nanosleep-wrapper.h" #include "oct-cmplx.h" #include "oct-env.h" #include "oct-locbuf.h" #include "pathsearch.h" #include "quit.h" #include "str-vec.h" +#include "vasprintf-wrapper.h" #include "Cell.h" #include <defaults.h> @@ -1288,7 +1288,7 @@ char *result; - int status = gnulib::vasprintf (&result, fmt, args); + int status = octave_vasprintf_wrapper (&result, fmt, args); if (status >= 0) { @@ -1329,7 +1329,7 @@ struct timespec delay = { sec, static_cast<long> (fraction) }; struct timespec remaining; - gnulib::nanosleep (&delay, &remaining); + octave_nanosleep_wrapper (&delay, &remaining); octave_quit (); }
--- a/libinterp/module.mk Mon Jun 13 11:35:19 2016 -0400 +++ b/libinterp/module.mk Mon Jun 13 16:01:26 2016 -0400 @@ -20,6 +20,7 @@ -Ilibinterp/parse-tree -I$(srcdir)/libinterp/parse-tree \ -Ilibinterp/corefcn -I$(srcdir)/libinterp/corefcn \ -Ilibgnu -I$(srcdir)/libgnu \ + -I$(srcdir)/liboctave/wrappers \ $(HDF5_CPPFLAGS) \ $(MAGICK_CPPFLAGS)
--- a/liboctave/module.mk Mon Jun 13 11:35:19 2016 -0400 +++ b/liboctave/module.mk Mon Jun 13 16:01:26 2016 -0400 @@ -16,7 +16,8 @@ -Iliboctave/operators -I$(srcdir)/liboctave/operators \ -I$(srcdir)/liboctave/system \ -I$(srcdir)/liboctave/util \ - -Ilibgnu -I$(srcdir)/libgnu + -Ilibgnu -I$(srcdir)/libgnu \ + -I$(srcdir)/liboctave/wrappers liboctave_liboctave_la_CFLAGS = $(AM_CFLAGS) $(WARN_CFLAGS) @@ -65,6 +66,7 @@ include liboctave/operators/module.mk include liboctave/system/module.mk include liboctave/util/module.mk +include liboctave/wrappers/module.mk ## liboctave merely collects a bunch of compiled convenience libraries. ## It has no source code itself.
--- a/liboctave/system/file-ops.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/liboctave/system/file-ops.cc Mon Jun 13 16:01:26 2016 -0400 @@ -35,12 +35,8 @@ #include <sys/stat.h> #include "pathmax.h" -#include "canonicalize.h" -extern "C" { -#include <tempname.h> -} - +#include "canonicalize-file-name-wrapper.h" #include "dir-ops.h" #include "file-ops.h" #include "file-stat.h" @@ -51,6 +47,7 @@ #include "quit.h" #include "singleton-cleanup.h" #include "str-vec.h" +#include "gen-tempname-wrapper.h" #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) # include <algorithm> @@ -720,7 +717,7 @@ strcpy (tname, templatename.c_str ()); - if (gen_tempname (tname, 0, 0, GT_NOCREATE) == -1) + if (octave_gen_tempname_wrapper (tname) == -1) msg = gnulib::strerror (errno); else retval = tname; @@ -742,7 +739,7 @@ std::string retval; - char *tmp = gnulib::canonicalize_file_name (name.c_str ()); + char *tmp = octave_canonicalize_file_name_wrapper (name.c_str ()); if (tmp) {
--- a/liboctave/system/oct-time.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/liboctave/system/oct-time.cc Mon Jun 13 16:01:26 2016 -0400 @@ -30,13 +30,13 @@ #include <sys/time.h> -#include "strftime.h" - #include "lo-error.h" #include "lo-math.h" #include "lo-utils.h" #include "oct-locbuf.h" #include "oct-time.h" +#include "strftime-wrapper.h" +#include "strptime-wrapper.h" namespace octave { @@ -189,7 +189,8 @@ buf = new char [bufsize]; buf[0] = '\0'; - chars_written = nstrftime (buf, bufsize, fmt_str, &t, 0, 0); + chars_written + = octave_strftime_wrapper (buf, bufsize, fmt_str, &t, 0, 0); bufsize *= 2; } @@ -283,7 +284,7 @@ const char *p = str.c_str (); - char *q = gnulib::strptime (p, fmt.c_str (), &t); + char *q = octave_strptime_wrapper (p, fmt.c_str (), &t); // Fill in wday and yday, but only if mday is valid and the mon and year // are filled in, avoiding issues with mktime and invalid dates.
--- a/liboctave/util/lo-utils.cc Mon Jun 13 11:35:19 2016 -0400 +++ b/liboctave/util/lo-utils.cc Mon Jun 13 16:01:26 2016 -0400 @@ -40,6 +40,7 @@ #include "lo-ieee.h" #include "lo-mappers.h" #include "lo-utils.h" +#include "putenv-wrapper.h" bool xis_int_or_inf_or_nan (double x) { return octave::math::isnan (x) || octave::math::x_nint (x) == x; } @@ -104,7 +105,7 @@ // As far as I can see there's no way to distinguish between the // various errors; putenv doesn't have errno values. - if (gnulib::putenv (new_item) < 0) + if (octave_putenv_wrapper (new_item) < 0) (*current_liboctave_error_handler) ("putenv (%s) failed", new_item); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/canonicalize-file-name-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,40 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// canonicalize_file_name may be provided by gnulib. We don't include +// gnulib headers directly in Octave's C++ source files to avoid +// problems that may be caused by the way that gnulib overrides standard +// library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <stdlib.h> + +#include "canonicalize-file-name-wrapper.h" + +char * +octave_canonicalize_file_name_wrapper (const char *name) +{ + return canonicalize_file_name (name); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/canonicalize-file-name-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_canonicalize_file_name_wrapper_h) +#define octave_canonicalize_file_name_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern char *octave_canonicalize_file_name_wrapper (const char *name); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/gen-tempname-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// gen_tempname is provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "tempname.h" + +#include "gen-tempname-wrapper.h" + +int +octave_gen_tempname_wrapper (char *tmpl) +{ + return gen_tempname (tmpl, 0, 0, GT_NOCREATE); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/gen-tempname-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_gen_tempname_wrapper_h) +#define octave_gen_tempname_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_gen_tempname_wrapper (char *tmpl); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/mkostemp-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,43 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// mkostemp may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <stdlib.h> + +#include "mkostemp-wrapper.h" + +#ifndef O_BINARY +# define O_BINARY 0 +#endif + +int +octave_mkostemp_wrapper (char *tmpl) +{ + return mkostemp (tmpl, O_BINARY); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/mkostemp-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_mkostemp_wrapper_h) +#define octave_mkostemp_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_mkostemp_wrapper (char *tmpl); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/module.mk Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,34 @@ +NOINSTALL_WRAPPERS_INC = \ + liboctave/wrappers/canonicalize-file-name-wrapper.h \ + liboctave/wrappers/gen-tempname-wrapper.h \ + liboctave/wrappers/mkostemp-wrapper.h \ + liboctave/wrappers/nanosleep-wrapper.h \ + liboctave/wrappers/nproc-wrapper.h \ + liboctave/wrappers/putenv-wrapper.h \ + liboctave/wrappers/strftime-wrapper.h \ + liboctave/wrappers/strptime-wrapper.h \ + liboctave/wrappers/unsetenv-wrapper.h \ + liboctave/wrappers/vasprintf-wrapper.h + +WRAPPERS_SRC = \ + liboctave/wrappers/canonicalize-file-name-wrapper.c \ + liboctave/wrappers/gen-tempname-wrapper.c \ + liboctave/wrappers/mkostemp-wrapper.c \ + liboctave/wrappers/nanosleep-wrapper.c \ + liboctave/wrappers/nproc-wrapper.c \ + liboctave/wrappers/putenv-wrapper.c \ + liboctave/wrappers/strftime-wrapper.c \ + liboctave/wrappers/strptime-wrapper.c \ + liboctave/wrappers/unsetenv-wrapper.c \ + liboctave/wrappers/vasprintf-wrapper.c + +noinst_LTLIBRARIES += liboctave/wrappers/libwrappers.la + +liboctave_wrappers_libwrappers_la_SOURCES = $(WRAPPERS_SRC) + +liboctave_wrappers_libwrappers_la_CPPFLAGS = \ + -Ilibgnu -I$(srcdir)/libgnu + +liboctave_wrappers_libwrappers_la_CFLAGS = $(liboctave_liboctave_la_CFLAGS) + +liboctave_liboctave_la_LIBADD += liboctave/wrappers/libwrappers.la
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/nanosleep-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,40 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// nanosleep may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <time.h> + +#include "nanosleep-wrapper.h" + +int +octave_nanosleep_wrapper (const struct timespec *requested, + struct timespec *remaining) +{ + return nanosleep (requested, remaining); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/nanosleep-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,38 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_nanosleep_wrapper_h) +#define octave_nanosleep_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int +octave_nanosleep_wrapper (const struct timespec *requested, + struct timespec *remaining); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/nproc-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,57 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// num_processors is provided by gnulib. We don't include gnulib +// headers directly in Octave's C++ source files to avoid problems that +// may be caused by the way that gnulib overrides standard library +// functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "nproc.h" + +#include "nproc-wrapper.h" + +unsigned long int +octave_num_processors_wrapper (enum octave_nproc_query octave_query) +{ + enum nproc_query query; + + switch (octave_query) + { + case OCTAVE_NPROC_ALL: + query = NPROC_ALL; + break; + + case OCTAVE_NPROC_CURRENT: + query = NPROC_CURRENT; + break; + + case OCTAVE_NPROC_CURRENT_OVERRIDABLE: + query = NPROC_CURRENT_OVERRIDABLE; + break; + } + + return num_processors (query); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/nproc-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,44 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_nproc_wrapper_h) +#define octave_nproc_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +enum octave_nproc_query +{ + OCTAVE_NPROC_ALL, + OCTAVE_NPROC_CURRENT, + OCTAVE_NPROC_CURRENT_OVERRIDABLE +}; + +extern unsigned long int +octave_num_processors_wrapper (enum octave_nproc_query); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/putenv-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// putenv may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <stdlib.h> + +#include "putenv-wrapper.h" + +int +octave_putenv_wrapper (char *str) +{ + return putenv (str); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/putenv-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_putenv_wrapper_h) +#define octave_putenv_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_putenv_wrapper (char *str); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strftime-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,42 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// nstrftime is provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <time.h> + +#include "strftime.h" + +#include "strftime-wrapper.h" + +size_t +octave_strftime_wrapper (char *buf, size_t len, const char *fmt, + const struct tm *t, struct tm_zone *tz, int ns) +{ + return nstrftime (buf, len, fmt, t, tz, ns); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strftime-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,44 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_strftime_wrapper_h) +#define octave_strftime_wrapper_h 1 + +#if defined __cplusplus +# include <cstddef> +#else +# include <stddef.h> +#endif + +#if defined __cplusplus +extern "C" { +#endif + +extern size_t +octave_strftime_wrapper (char *buf, size_t len, const char *fmt, + const struct tm *t, struct tm_zone *tz, int ns); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strptime-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// strptime may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <time.h> + +#include "strptime-wrapper.h" + +char * +octave_strptime_wrapper (const char *p, const char *fmt, struct tm *t) +{ + return strptime (p, fmt, t); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strptime-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,37 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_strptime_wrapper_h) +#define octave_strptime_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern char * +octave_strptime_wrapper (const char *p, const char *fmt, struct tm *t); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/unsetenv-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// unsetenv may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <stdlib.h> + +#include "unsetenv-wrapper.h" + +int +octave_unsetenv_wrapper (const char *name) +{ + return unsetenv (name); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/unsetenv-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_unsetenv_wrapper_h) +#define octave_unsetenv_wrapper_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_unsetenv_wrapper (const char *name); + +#if defined __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/vasprintf-wrapper.c Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +// vasprintf may be provided by gnulib. We don't include gnulib headers +// directly in Octave's C++ source files to avoid problems that may be +// caused by the way that gnulib overrides standard library functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <stdio.h> + +#include "vasprintf-wrapper.h" + +int +octave_vasprintf_wrapper (char **buf, const char *fmt, va_list args) +{ + return vasprintf (buf, fmt, args); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/vasprintf-wrapper.h Mon Jun 13 16:01:26 2016 -0400 @@ -0,0 +1,43 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_vasprintf_wrapper_h) +#define octave_vasprintf_wrapper_h 1 + +#if defined __cplusplus +# include <cstdarg> +#else +# include <stdarg.h> +#endif + +#if defined __cplusplus +extern "C" { +#endif + +extern int +octave_vasprintf_wrapper (char **buf, const char *fmt, va_list args); + +#if defined __cplusplus +} +#endif + +#endif