From 2b32d88fabd0cf45cb42981dd03258b39d1828c4 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 14 Dec 2006 11:12:32 +0000 Subject: Move the UI pulse functions into the global library state. That is (as best as I can tell) the last of the global data, with the exception of the single global_lib_state pointer in libstate.cpp --- include/enums.h | 15 +++++++++++++++ include/libstate.h | 12 ++++++++++++ include/ui.h | 30 ------------------------------ 3 files changed, 27 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/enums.h b/include/enums.h index bc939aba1..c5ffeff24 100644 --- a/include/enums.h +++ b/include/enums.h @@ -99,6 +99,21 @@ enum Character_Set { LATIN1_CHARSET }; +/************************************************* +* Pulse Function * +*************************************************/ +enum Pulse_Type { + GENERAL_PULSE, + + PIPE_WRITE, + + PRIME_SEARCHING, + PRIME_SIEVING, + PRIME_PASSED_SIEVE, + PRIME_TESTING, + PRIME_FOUND +}; + static const u32bit NO_CERT_PATH_LIMIT = 0xFFFFFFF0; } diff --git a/include/libstate.h b/include/libstate.h index c2e217df7..8cf700220 100644 --- a/include/libstate.h +++ b/include/libstate.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -31,6 +32,13 @@ class Library_State }; friend class Engine_Iterator; + class UI + { + public: + virtual void pulse(Pulse_Type) {} + virtual ~UI() {} + }; + Allocator* get_allocator(const std::string& = "") const; void add_allocator(Allocator*); void set_default_allocator(const std::string&) const; @@ -59,6 +67,9 @@ class Library_State void set_x509_state(class X509_GlobalState*); class X509_GlobalState& x509_state(); + void pulse(Pulse_Type) const; + void set_ui(UI*); + void set_transcoder(class Charset_Transcoder*); std::string transcode(const std::string, Character_Set, Character_Set) const; @@ -80,6 +91,7 @@ class Library_State std::map alloc_factory; mutable Allocator* cached_default_allocator; + UI* ui; class Charset_Transcoder* transcoder; RandomNumberGenerator* rng; std::vector allocators; diff --git a/include/ui.h b/include/ui.h index a956518d6..888d92c48 100644 --- a/include/ui.h +++ b/include/ui.h @@ -28,36 +28,6 @@ class User_Interface mutable bool first_try; }; -namespace UI { - -/************************************************* -* Pulse Function * -*************************************************/ -enum Pulse_Type { - GENERAL_PULSE, - - PIPE_WRITE, - - PRIME_SEARCHING, - PRIME_SIEVING, - PRIME_PASSED_SIEVE, - PRIME_TESTING, - PRIME_FOUND -}; -typedef void (*pulse_func)(Pulse_Type, void*); - -/************************************************* -* Set the UI pulse function * -*************************************************/ -void set_pulse(pulse_func, void* = 0); - -/************************************************* -* Call the UI pulse function * -*************************************************/ -void pulse(Pulse_Type = GENERAL_PULSE); - -} - } #endif -- cgit v1.2.3