aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-24 00:22:58 +0000
committerlloyd <[email protected]>2006-06-24 00:22:58 +0000
commit0f5b4a6a3460e2ad24b055bdc2bc5fd33ed35b0f (patch)
tree04335ce283a90c7eece02e3c2b26a9f437acba34
parentde6cfdef42515053d7396e512cc1370ee75a80e4 (diff)
Add a swap_global_state, to allow the use of multiple
simultaneous library states.
-rw-r--r--include/libstate.h1
-rw-r--r--src/libstate.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/libstate.h b/include/libstate.h
index ccc09c224..ff8266318 100644
--- a/include/libstate.h
+++ b/include/libstate.h
@@ -83,6 +83,7 @@ class Library_State
*************************************************/
Library_State& global_state();
void set_global_state(Library_State*);
+Library_State* swap_global_state(Library_State*);
}
diff --git a/src/libstate.cpp b/src/libstate.cpp
index 581345f76..2b7636cdf 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -34,6 +34,13 @@ void set_global_state(Library_State* new_state)
global_lib_state = new_state;
}
+Library_State* swap_global_state(Library_State* new_state)
+ {
+ Library_State* old_state = global_lib_state;
+ global_lib_state = new_state;
+ return old_state;
+ }
+
namespace {
/*************************************************
@@ -342,3 +349,4 @@ Library_State::~Library_State()
}
}
+n