Mercurial > hg > octave-nkf
changeset 6274:d42abdfcb8e9
[project @ 2007-02-07 07:22:02 by jwe]
author | jwe |
---|---|
date | Wed, 07 Feb 2007 07:22:03 +0000 |
parents | de81db175325 |
children | 6e5835ef21f8 |
files | src/ChangeLog src/defaults.cc src/defaults.h.in src/toplev.cc |
diffstat | 4 files changed, 134 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2007-02-07 John W. Eaton <jwe@octave.org> + + * toplev.cc (Foctave_config_info): Use struct for conf_info. + Call subst_octave_home on selected values when initializing map. + * defaults.cc (subst_octave_home): Now extern. + * defaults.h.in: Provide decl. + 2007-02-05 John W. Eaton <jwe@octave.org> * mex.cc (mxArray_number::as_octave_value): Fake mxSINGLE_CLASS
--- a/src/defaults.cc +++ b/src/defaults.cc @@ -96,7 +96,7 @@ std::string Vlocal_site_defaults_file; std::string Vsite_defaults_file; -static std::string +std::string subst_octave_home (const std::string& s) { std::string retval;
--- a/src/defaults.h.in +++ b/src/defaults.h.in @@ -197,6 +197,8 @@ // Name of the FFTW wisdom program. extern std::string Vfftw_wisdom_program; +extern std::string subst_octave_home (const std::string&); + extern void install_defaults (void); extern void set_exec_path (const std::string& path = std::string ());
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -726,115 +726,122 @@ static bool initialized = false; static Octave_map m; - static const char * const conf_info[] = + struct conf_info_struct + { + bool subst_home; + const char *key; + const char *val; + }; + + static const conf_info_struct conf_info[] = { - "ALL_CFLAGS", OCTAVE_CONF_ALL_CFLAGS, - "ALL_CXXFLAGS", OCTAVE_CONF_ALL_CXXFLAGS, - "ALL_FFLAGS", OCTAVE_CONF_ALL_FFLAGS, - "ALL_LDFLAGS", OCTAVE_CONF_ALL_LDFLAGS, - "AR", OCTAVE_CONF_AR, - "ARFLAGS", OCTAVE_CONF_ARFLAGS, - "BLAS_LIBS", OCTAVE_CONF_BLAS_LIBS, - "CC", OCTAVE_CONF_CC, - "CC_VERSION", OCTAVE_CONF_CC_VERSION, - "CFLAGS", OCTAVE_CONF_CFLAGS, - "CPICFLAG", OCTAVE_CONF_CPICFLAG, - "CPPFLAGS", OCTAVE_CONF_CPPFLAGS, - "CURL_LIBS", OCTAVE_CONF_CURL_LIBS, - "CXX", OCTAVE_CONF_CXX, - "CXXCPP", OCTAVE_CONF_CXXCPP, - "CXXFLAGS", OCTAVE_CONF_CXXFLAGS, - "CXXPICFLAG", OCTAVE_CONF_CXXPICFLAG, - "CXX_VERSION", OCTAVE_CONF_CXX_VERSION, - "DEFAULT_PAGER", OCTAVE_DEFAULT_PAGER, - "DEFS", OCTAVE_CONF_DEFS, - "DLFCN_INCFLAGS", OCTAVE_CONF_DLFCN_INCFLAGS, - "DL_LD", OCTAVE_CONF_DL_LD, - "DL_LDFLAGS", OCTAVE_CONF_DL_LDFLAGS, - "ENABLE_DYNAMIC_LINKING", OCTAVE_CONF_ENABLE_DYNAMIC_LINKING, - "EXEEXT", OCTAVE_CONF_EXEEXT, - "F2C", OCTAVE_CONF_F2C, - "F2CFLAGS", OCTAVE_CONF_F2CFLAGS, - "F77", OCTAVE_CONF_F77, - "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG, - "FC", OCTAVE_CONF_FC, - "FFLAGS", OCTAVE_CONF_FFLAGS, - "FFTW_LIBS", OCTAVE_CONF_FFTW_LIBS, - "FLIBS", OCTAVE_CONF_FLIBS, - "FPICFLAG", OCTAVE_CONF_FPICFLAG, - "GLPK_LIBS", OCTAVE_CONF_GLPK_LIBS, - "INCFLAGS", OCTAVE_CONF_INCFLAGS, - "LDFLAGS", OCTAVE_CONF_LDFLAGS, - "LD_CXX", OCTAVE_CONF_LD_CXX, - "LD_STATIC_FLAG", OCTAVE_CONF_LD_STATIC_FLAG, - "LEX", OCTAVE_CONF_LEX, - "LEXLIB", OCTAVE_CONF_LEXLIB, - "LFLAGS", OCTAVE_CONF_LFLAGS, - "LIBCRUFT", OCTAVE_CONF_LIBCRUFT, - "LIBDLFCN", OCTAVE_CONF_LIBDLFCN, - "LIBEXT", OCTAVE_CONF_LIBEXT, - "LIBFLAGS", OCTAVE_CONF_LIBFLAGS, - "LIBOCTAVE", OCTAVE_CONF_LIBOCTAVE, - "LIBOCTINTERP", OCTAVE_CONF_LIBOCTINTERP, - "LIBREADLINE", OCTAVE_CONF_LIBREADLINE, - "LIBS", OCTAVE_CONF_LIBS, - "LN_S", OCTAVE_CONF_LN_S, - "MKOCTFILE_DL_LDFLAGS", OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS, - "MKOCTFILE_INCFLAGS", OCTAVE_CONF_MKOCTFILE_INCFLAGS, - "MKOCTFILE_LFLAGS", OCTAVE_CONF_MKOCTFILE_LFLAGS, - "RANLIB", OCTAVE_CONF_RANLIB, - "RDYNAMIC_FLAG", OCTAVE_CONF_RDYNAMIC_FLAG, - "RLD_FLAG", OCTAVE_CONF_RLD_FLAG, - "RUNTEST", OCTAVE_CONF_RUNTEST, - "SED", OCTAVE_CONF_SED, - "SHARED_LIBS", OCTAVE_CONF_SHARED_LIBS, - "SHLEXT", OCTAVE_CONF_SHLEXT, - "SHLEXT_VER", OCTAVE_CONF_SHLEXT_VER, - "SH_LD", OCTAVE_CONF_SH_LD, - "SH_LDFLAGS", OCTAVE_CONF_SH_LDFLAGS, - "SONAME_FLAGS", OCTAVE_CONF_SONAME_FLAGS, - "STATIC_LIBS", OCTAVE_CONF_STATIC_LIBS, - "UGLY_DEFS", OCTAVE_CONF_UGLY_DEFS, - "USE_64_BIT_IDX_T", OCTAVE_CONF_USE_64_BIT_IDX_T, - "XTRA_CFLAGS", OCTAVE_CONF_XTRA_CFLAGS, - "XTRA_CXXFLAGS", OCTAVE_CONF_XTRA_CXXFLAGS, - "YACC", OCTAVE_CONF_YACC, - "YFLAGS", OCTAVE_CONF_YFLAGS, - "api_version", OCTAVE_API_VERSION, - "archlibdir", OCTAVE_ARCHLIBDIR, - "bindir", OCTAVE_BINDIR, - "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE, - "config_opts", OCTAVE_CONF_config_opts, - "datadir", OCTAVE_DATADIR, - "datarootdir", OCTAVE_DATAROOTDIR, - "exec_prefix", OCTAVE_EXEC_PREFIX, - "fcnfiledir", OCTAVE_FCNFILEDIR, - "imagedir", OCTAVE_IMAGEDIR, - "includedir", OCTAVE_INCLUDEDIR, - "infodir", OCTAVE_INFODIR, - "infofile", OCTAVE_INFOFILE, - "libdir", OCTAVE_LIBDIR, - "libexecdir", OCTAVE_LIBEXECDIR, - "localapifcnfiledir", OCTAVE_LOCALAPIFCNFILEDIR, - "localapioctfiledir", OCTAVE_LOCALAPIOCTFILEDIR, - "localarchlibdir", OCTAVE_LOCALARCHLIBDIR, - "localfcnfiledir", OCTAVE_LOCALFCNFILEDIR, - "localoctfiledir", OCTAVE_LOCALOCTFILEDIR, - "localstartupfiledir", OCTAVE_LOCALSTARTUPFILEDIR, - "localapiarchlibdir", OCTAVE_LOCALAPIARCHLIBDIR, - "localverarchlibdir", OCTAVE_LOCALVERARCHLIBDIR, - "localverfcnfiledir", OCTAVE_LOCALVERFCNFILEDIR, - "localveroctfiledir", OCTAVE_LOCALVEROCTFILEDIR, - "man1dir", OCTAVE_MAN1DIR, - "man1ext", OCTAVE_MAN1EXT, - "mandir", OCTAVE_MANDIR, - "octfiledir", OCTAVE_OCTFILEDIR, - "octincludedir", OCTAVE_OCTINCLUDEDIR, - "octlibdir", OCTAVE_OCTLIBDIR, - "prefix", OCTAVE_PREFIX, - "startupfiledir", OCTAVE_STARTUPFILEDIR, - "version", OCTAVE_VERSION, - 0, 0 + { false, "ALL_CFLAGS", OCTAVE_CONF_ALL_CFLAGS }, + { false, "ALL_CXXFLAGS", OCTAVE_CONF_ALL_CXXFLAGS }, + { false, "ALL_FFLAGS", OCTAVE_CONF_ALL_FFLAGS }, + { false, "ALL_LDFLAGS", OCTAVE_CONF_ALL_LDFLAGS }, + { false, "AR", OCTAVE_CONF_AR }, + { false, "ARFLAGS", OCTAVE_CONF_ARFLAGS }, + { false, "BLAS_LIBS", OCTAVE_CONF_BLAS_LIBS }, + { false, "CC", OCTAVE_CONF_CC }, + { false, "CC_VERSION", OCTAVE_CONF_CC_VERSION }, + { false, "CFLAGS", OCTAVE_CONF_CFLAGS }, + { false, "CPICFLAG", OCTAVE_CONF_CPICFLAG }, + { false, "CPPFLAGS", OCTAVE_CONF_CPPFLAGS }, + { false, "CURL_LIBS", OCTAVE_CONF_CURL_LIBS }, + { false, "CXX", OCTAVE_CONF_CXX }, + { false, "CXXCPP", OCTAVE_CONF_CXXCPP }, + { false, "CXXFLAGS", OCTAVE_CONF_CXXFLAGS }, + { false, "CXXPICFLAG", OCTAVE_CONF_CXXPICFLAG }, + { false, "CXX_VERSION", OCTAVE_CONF_CXX_VERSION }, + { false, "DEFAULT_PAGER", OCTAVE_DEFAULT_PAGER }, + { false, "DEFS", OCTAVE_CONF_DEFS }, + { false, "DLFCN_INCFLAGS", OCTAVE_CONF_DLFCN_INCFLAGS }, + { false, "DL_LD", OCTAVE_CONF_DL_LD }, + { false, "DL_LDFLAGS", OCTAVE_CONF_DL_LDFLAGS }, + { false, "ENABLE_DYNAMIC_LINKING", OCTAVE_CONF_ENABLE_DYNAMIC_LINKING }, + { false, "EXEEXT", OCTAVE_CONF_EXEEXT }, + { false, "F2C", OCTAVE_CONF_F2C }, + { false, "F2CFLAGS", OCTAVE_CONF_F2CFLAGS }, + { false, "F77", OCTAVE_CONF_F77 }, + { false, "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG }, + { false, "FC", OCTAVE_CONF_FC }, + { false, "FFLAGS", OCTAVE_CONF_FFLAGS }, + { false, "FFTW_LIBS", OCTAVE_CONF_FFTW_LIBS }, + { false, "FLIBS", OCTAVE_CONF_FLIBS }, + { false, "FPICFLAG", OCTAVE_CONF_FPICFLAG }, + { false, "GLPK_LIBS", OCTAVE_CONF_GLPK_LIBS }, + { false, "INCFLAGS", OCTAVE_CONF_INCFLAGS }, + { false, "LDFLAGS", OCTAVE_CONF_LDFLAGS }, + { false, "LD_CXX", OCTAVE_CONF_LD_CXX }, + { false, "LD_STATIC_FLAG", OCTAVE_CONF_LD_STATIC_FLAG }, + { false, "LEX", OCTAVE_CONF_LEX }, + { false, "LEXLIB", OCTAVE_CONF_LEXLIB }, + { false, "LFLAGS", OCTAVE_CONF_LFLAGS }, + { false, "LIBCRUFT", OCTAVE_CONF_LIBCRUFT }, + { false, "LIBDLFCN", OCTAVE_CONF_LIBDLFCN }, + { false, "LIBEXT", OCTAVE_CONF_LIBEXT }, + { false, "LIBFLAGS", OCTAVE_CONF_LIBFLAGS }, + { false, "LIBOCTAVE", OCTAVE_CONF_LIBOCTAVE }, + { false, "LIBOCTINTERP", OCTAVE_CONF_LIBOCTINTERP }, + { false, "LIBREADLINE", OCTAVE_CONF_LIBREADLINE }, + { false, "LIBS", OCTAVE_CONF_LIBS }, + { false, "LN_S", OCTAVE_CONF_LN_S }, + { false, "MKOCTFILE_DL_LDFLAGS", OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS }, + { false, "MKOCTFILE_INCFLAGS", OCTAVE_CONF_MKOCTFILE_INCFLAGS }, + { false, "MKOCTFILE_LFLAGS", OCTAVE_CONF_MKOCTFILE_LFLAGS }, + { false, "RANLIB", OCTAVE_CONF_RANLIB }, + { false, "RDYNAMIC_FLAG", OCTAVE_CONF_RDYNAMIC_FLAG }, + { false, "RLD_FLAG", OCTAVE_CONF_RLD_FLAG }, + { false, "RUNTEST", OCTAVE_CONF_RUNTEST }, + { false, "SED", OCTAVE_CONF_SED }, + { false, "SHARED_LIBS", OCTAVE_CONF_SHARED_LIBS }, + { false, "SHLEXT", OCTAVE_CONF_SHLEXT }, + { false, "SHLEXT_VER", OCTAVE_CONF_SHLEXT_VER }, + { false, "SH_LD", OCTAVE_CONF_SH_LD }, + { false, "SH_LDFLAGS", OCTAVE_CONF_SH_LDFLAGS }, + { false, "SONAME_FLAGS", OCTAVE_CONF_SONAME_FLAGS }, + { false, "STATIC_LIBS", OCTAVE_CONF_STATIC_LIBS }, + { false, "UGLY_DEFS", OCTAVE_CONF_UGLY_DEFS }, + { false, "USE_64_BIT_IDX_T", OCTAVE_CONF_USE_64_BIT_IDX_T }, + { false, "XTRA_CFLAGS", OCTAVE_CONF_XTRA_CFLAGS }, + { false, "XTRA_CXXFLAGS", OCTAVE_CONF_XTRA_CXXFLAGS }, + { false, "YACC", OCTAVE_CONF_YACC }, + { false, "YFLAGS", OCTAVE_CONF_YFLAGS }, + { false, "api_version", OCTAVE_API_VERSION }, + { true, "archlibdir", OCTAVE_ARCHLIBDIR }, + { true, "bindir", OCTAVE_BINDIR }, + { false, "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE }, + { false, "config_opts", OCTAVE_CONF_config_opts }, + { true, "datadir", OCTAVE_DATADIR }, + { true, "datarootdir", OCTAVE_DATAROOTDIR }, + { false, "exec_prefix", OCTAVE_EXEC_PREFIX }, + { true, "fcnfiledir", OCTAVE_FCNFILEDIR }, + { true, "imagedir", OCTAVE_IMAGEDIR }, + { true, "includedir", OCTAVE_INCLUDEDIR }, + { true, "infodir", OCTAVE_INFODIR }, + { false, "infofile", OCTAVE_INFOFILE }, + { true, "libdir", OCTAVE_LIBDIR }, + { true, "libexecdir", OCTAVE_LIBEXECDIR }, + { true, "localapifcnfiledir", OCTAVE_LOCALAPIFCNFILEDIR }, + { true, "localapioctfiledir", OCTAVE_LOCALAPIOCTFILEDIR }, + { true, "localarchlibdir", OCTAVE_LOCALARCHLIBDIR }, + { true, "localfcnfiledir", OCTAVE_LOCALFCNFILEDIR }, + { true, "localoctfiledir", OCTAVE_LOCALOCTFILEDIR }, + { true, "localstartupfiledir", OCTAVE_LOCALSTARTUPFILEDIR }, + { true, "localapiarchlibdir", OCTAVE_LOCALAPIARCHLIBDIR }, + { true, "localverarchlibdir", OCTAVE_LOCALVERARCHLIBDIR }, + { true, "localverfcnfiledir", OCTAVE_LOCALVERFCNFILEDIR }, + { true, "localveroctfiledir", OCTAVE_LOCALVEROCTFILEDIR }, + { true, "man1dir", OCTAVE_MAN1DIR }, + { false, "man1ext", OCTAVE_MAN1EXT }, + { true, "mandir", OCTAVE_MANDIR }, + { true, "octfiledir", OCTAVE_OCTFILEDIR }, + { true, "octincludedir", OCTAVE_OCTINCLUDEDIR }, + { true, "octlibdir", OCTAVE_OCTLIBDIR }, + { false, "prefix", OCTAVE_PREFIX }, + { true, "startupfiledir", OCTAVE_STARTUPFILEDIR }, + { false, "version", OCTAVE_VERSION }, + { false, 0, 0 } }; if (! initialized) @@ -855,10 +862,17 @@ while (true) { - const char *key = conf_info[i++]; + const conf_info_struct& elt = conf_info[i++]; + + const char *key = elt.key; if (key) - m.assign (key, octave_value (conf_info[i++])); + { + if (elt.subst_home) + m.assign (key, octave_value (subst_octave_home (elt.val))); + else + m.assign (key, octave_value (elt.val)); + } else break; }