[Pkg-electronics-commits] [gnucap] 12/43: plugpath-3d: putenv windows compat, bug fixes, help, alt Make2's in main
felix salfelder
felix-guest at moszumanska.debian.org
Wed Oct 4 03:21:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to branch master
in repository gnucap.
commit eecc8ebe57c32ba7344ee9499b348e578f2401ad
Author: al davis <ad211 at freeelectron.net>
Date: Thu Mar 23 03:04:16 2017 -0400
plugpath-3d: putenv windows compat, bug fixes, help, alt Make2's in main
(rebased)
---
include/l_lib.h | 18 ++++++++++++++++--
include/patchlev.h | 2 +-
lib/c_attach.cc | 34 +++++++++++++++-------------------
lib/d_subckt.cc | 2 +-
main/Make2.Debug | 8 +++++---
main/Make2.g++ | 4 +++-
main/Make2.mingw32 | 4 +++-
7 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/include/l_lib.h b/include/l_lib.h
index ce8cd9f..cd91eb5 100644
--- a/include/l_lib.h
+++ b/include/l_lib.h
@@ -77,8 +77,22 @@ namespace OS {
}
}
- inline void setenv(const std::string& s, const std::string& v, bool overwrite=true) {
- ::setenv(s.c_str(), v.c_str(), overwrite);
+ inline void setenv(const std::string& Name, const std::string& Value, bool Overwrite=true) {
+ if (Name == "") {untested();
+ throw Exception("setenv: bad name " + Name);
+ }else if (Value == "") {untested();
+ throw Exception("setenv: bad value " + Value);
+ }else if (!Overwrite && getenv(Name) != "") {untested();
+ error(bDEBUG, "setenv: " + Name + " overwrite prohibited");
+ }else{
+ std::string ev = Name + "=" + Value;
+ char *es = ::strdup(ev.c_str()); //BUG// memory leak
+ assert(es);
+ if (::putenv(es) != 0) {untested();
+ throw Exception("");
+ }else{
+ }
+ }
}
}
/*--------------------------------------------------------------------------*/
diff --git a/include/patchlev.h b/include/patchlev.h
index c3b9b80..65973b3 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "plugpath-3c 2017.03.21"
+#define PATCHLEVEL "plugpath-3c 2017.03.24"
diff --git a/lib/c_attach.cc b/lib/c_attach.cc
index 4a9c2e4..bb0d31f 100644
--- a/lib/c_attach.cc
+++ b/lib/c_attach.cc
@@ -30,24 +30,20 @@ namespace {
std::map<const std::string, void*> attach_list;
/*--------------------------------------------------------------------------*/
std::string plug_path()
-{ untested();
- std::string path = OS::getenv("GNUCAP_PLUGPATH");
- if(path==""){ unreachable();
- }else{ untested();
- }
- return path;
+{
+ return OS::getenv("GNUCAP_PLUGPATH");
}
/*--------------------------------------------------------------------------*/
class CMD_ATTACH : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
- { untested();
+ {
unsigned here = cmd.cursor();
int dl_scope = RTLD_LOCAL;
int check = RTLD_NOW;
// RTLD_NOW means to resolve symbols on loading
// RTLD_LOCAL means symbols defined in a plugin are local
- do { untested();
+ do {
if (cmd.umatch("public ")) {untested();
dl_scope = RTLD_GLOBAL;
// RTLD_GLOBAL means symbols defined in a plugin are global
@@ -57,7 +53,7 @@ public:
// RTLD_LAZY means to defer resolving symbols until needed
// Use when a plugin will not load because of unresolved symbols,
// but it may work without it.
- }else{ untested();
+ }else{
}
} while (cmd.more() && !cmd.stuck(&here));
@@ -74,26 +70,26 @@ public:
cmd.reset(here);
throw Exception_CS("already loaded, cannot replace when there is a circuit", cmd);
}
- }else{ untested();
+ }else{
}
- if (short_file_name.find('/') == std::string::npos) { untested();
+ if (short_file_name.find('/') == std::string::npos) {
// no '/' in name, search for it
std::string path = plug_path();
std::string full_file_name = findfile(short_file_name, path, R_OK);
- if (full_file_name != "") { untested();
+ if (full_file_name != "") {
// found it in path
handle = dlopen(full_file_name.c_str(), check | dl_scope);
}else{itested();
cmd.reset(here);
throw Exception_CS("plugin not found in " + path, cmd);
}
- }else{untested();
+ }else{itested();
// has '/' in name, don't search, we have full name
handle = dlopen(short_file_name.c_str(), check | dl_scope);
}
- if (handle) { untested();
+ if (handle) {
attach_list[short_file_name] = handle;
}else{itested();
cmd.reset(here);
@@ -130,15 +126,15 @@ DISPATCHER<CMD>::INSTALL d2(&command_dispatcher, "detach|unload", &p2);
class CMD_DETACH_ALL : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
- { untested();
- if (CARD_LIST::card_list.is_empty()) { untested();
+ {
+ if (CARD_LIST::card_list.is_empty()) {
for (std::map<std::string, void*>::iterator
- ii = attach_list.begin(); ii != attach_list.end(); ++ii) { untested();
+ ii = attach_list.begin(); ii != attach_list.end(); ++ii) {
void* handle = ii->second;
- if (handle) { untested();
+ if (handle) {
dlclose(handle);
ii->second = NULL;
- }else{untested();
+ }else{itested();
// name still in list, but has been detached already
}
}
diff --git a/lib/d_subckt.cc b/lib/d_subckt.cc
index 7c2aeff..2d2650d 100644
--- a/lib/d_subckt.cc
+++ b/lib/d_subckt.cc
@@ -79,7 +79,7 @@ private:
} p1;
int DEV_SUBCKT::_count = -1;
/*--------------------------------------------------------------------------*/
-class INTERFACE DEV_SUBCKT_PROTO : public DEV_SUBCKT {
+class DEV_SUBCKT_PROTO : public DEV_SUBCKT {
private:
explicit DEV_SUBCKT_PROTO(const DEV_SUBCKT_PROTO&p);
public:
diff --git a/main/Make2.Debug b/main/Make2.Debug
index 7deeaa6..ab0c9ad 100644
--- a/main/Make2.Debug
+++ b/main/Make2.Debug
@@ -42,13 +42,15 @@ LIBS = \
LDFLAGS = -rdynamic \
-L../../lib/O-DEBUG
-%.SUFFIXES:
+CONF_CPPFLAGS=-DGNUCAP_PLUGPATH=\"$(PREFIX)/lib/gnucap\"
+
+.SUFFIXES:
.SUFFIXES: .o .cc
-.cc.o:; $(CCC) $(CCFLAGS) -c $<
+.cc.o:; $(CCC) $(CXXFLAGS) $(CONF_CPPFLAGS) $(CPPFLAGS) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET): $(TARGET_DEPENDS)
rm -f $@
- $(CCC) $(CCFLAGS) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
+ $(CCC) $(CXXFLAGS) $(CPPFLAGS) $(CCFLAGS) $(OBJS) -o $@ $(LIBS) $(LDFLAGS)
#------------------------------------------------------------
# warnings turned off, because they warn of nothing wrong
# 4.3
diff --git a/main/Make2.g++ b/main/Make2.g++
index 8991962..394fca4 100644
--- a/main/Make2.g++
+++ b/main/Make2.g++
@@ -34,9 +34,11 @@ LIBS = \
LDFLAGS = -rdynamic \
-L../../lib/O
+CONF_CPPFLAGS=-DGNUCAP_PLUGPATH=\"$(PREFIX)/lib/gnucap\"
+
.SUFFIXES:
.SUFFIXES: .o .cc
-.cc.o:; $(CCC) $(CCFLAGS) -c $<
+.cc.o:; $(CCC) $(CXXFLAGS) $(CONF_CPPFLAGS) $(CPPFLAGS) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET): $(TARGET_DEPENDS)
rm -f $@
diff --git a/main/Make2.mingw32 b/main/Make2.mingw32
index b6150e6..b718444 100644
--- a/main/Make2.mingw32
+++ b/main/Make2.mingw32
@@ -32,9 +32,11 @@ LIBS = -lgnucap
LDFLAGS = -L../../lib/MSW
+CONF_CPPFLAGS=-DGNUCAP_PLUGPATH=\"$(PREFIX)/lib/gnucap\"
+
.SUFFIXES:
.SUFFIXES: .o .cc
-.cc.o:; $(CCC) $(CCFLAGS) -c $<
+.cc.o:; $(CCC) $(CXXFLAGS) $(CONF_CPPFLAGS) $(CPPFLAGS) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET): $(TARGET)$(TARGET_EXT)
#------------------------------------------------------------------------
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git
More information about the Pkg-electronics-commits
mailing list