Changeset 145
- Timestamp:
- 07/25/05 02:39:56 (3 years ago)
- Files:
-
- libcrash/trunk/configure.in (modified) (3 diffs)
- libcrash/trunk/crash/Expression.cc (modified) (1 diff)
- libcrash/trunk/crash/t.cc (modified) (1 diff)
- libcrash/trunk/TODO (modified) (1 diff)
- libcrash/trunk/utils/crash-module.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libcrash/trunk/configure.in
r144 r145 141 141 fi 142 142 143 AC_CHECKING([for SQL drivers]) 143 144 if test "_$enable_sqlite" = _yes; then 144 AC_CHECKING([for SQL drivers])145 146 145 AC_CHECK_LIB(sqlite, sqlite_compile, 147 146 [ … … 183 182 [ AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK, 1, [Have POSIX timed lock mutex]) ]) 184 183 184 AC_CHECKING([for crypto drivers]) 185 185 AC_TRY_LINK_FUNC(drand48, [AC_DEFINE(HAVE_DRAND48, 1, [Have drand48])]) 186 186 … … 216 216 217 217 if (echo "$CRYPTO_MODULES" | grep crypto/hash && echo "$CRYPTO_MODULES" | grep crypto/pk &&echo "$CRYPTO_MODULES" | grep crypto/cipher) > /dev/null 2>&1; then 218 CRASH_MODULES="${CRASH_MODULES} crypto/pk-wrapper"219 CRYPTO_DRIVERS="${CRYPTO_DRIVERS} PKServer.lo PKClient.lo"218 CRASH_MODULES="${CRASH_MODULES} crypto/pk-wrapper" 219 CRYPTO_DRIVERS="${CRYPTO_DRIVERS} PKServer.lo PKClient.lo" 220 220 fi 221 221 fi libcrash/trunk/crash/Expression.cc
r135 r145 240 240 if (*end && (isdigit(*end) || (*end == '-' || *end == '+') && isdigit(end[1]))) { 241 241 ++end; 242 while (isdigit(*end) ) ++end;242 while (isdigit(*end) || *end == '.') ++end; 243 243 type = NUMBER; 244 244 return MATCH_SOURCE; libcrash/trunk/crash/t.cc
r135 r145 1 #include <cstdio> 1 #include <crash/Singleton.h> 2 #include <list> 3 #include <string> 2 4 #include <iostream> 3 #include <string>4 #include <algorithm>5 #include <functional>6 5 6 namespace crash { 7 8 /** 9 The access point to instantiated extensions. 10 */ 11 template <typename T> 12 class ExtensionPoint : public Singleton<ExtensionPoint<T> > { 13 public : 14 typedef std::list<T*> Extensions; 15 typedef typename Extensions::iterator iterator; 16 typedef typename Extensions::const_iterator const_iterator; 17 18 void register_interface(T *interface) { 19 mextensioninstances.push_back(interface); 20 } 21 22 iterator begin() { return mextensioninstances.begin(); } 23 iterator end() { return mextensioninstances.end(); } 24 25 private : 26 friend class Singleton<ExtensionPoint>; 27 28 Extensions mextensioninstances; 29 }; 30 31 /** 32 Define a new interface. 33 */ 34 template <typename T> 35 class Interface : public Singleton<Interface<T> > { 36 public : 37 /* typedef typename Extensions::iterator iterator;*/ 38 39 const std::string &name() const { return mextensionname; } 40 41 /* iterator begin() { return Extensions::singleton().begin(); } 42 iterator end() { return Extensions::singleton().end(); }*/ 43 44 protected : 45 friend class Singleton<Interface<T> >; 46 47 Interface(const std::string &name) : mextensionname(name) { 48 ExtensionPoint<Interface<T> >::singleton().register_interface(this); 49 } 50 51 private : 52 const std::string mextensionname; 53 }; 54 55 /** 56 REGISTER_COMPONENT(ExpressionFilter) 57 */ 58 #define REGISTER_COMPONENT(component) \ 59 static component __##component##_instance__; 60 61 struct ISearchProvider : public Interface<ISearchProvider> { 62 ISearchProvider(const std::string &name) : Interface<ISearchProvider>(name) {} 63 virtual std::string do_search(std::string search) = 0; 64 }; 65 66 struct BodySearch : public ISearchProvider { 67 BodySearch() : ISearchProvider("body_search") {} 68 69 std::string do_search(std::string search) { 70 return search + " in WOOOOOOOO"; 71 } 72 }; 73 74 REGISTER_COMPONENT(BodySearch) 75 76 } 77 78 int main(int argc, const char **argv) { 79 using namespace crash; 7 80 using namespace std; 8 81 9 int main() { 10 const string path = "/home/athomas/projects/todo2/.todo"; 11 const string up = "..", self = "."; 12 string out; 13 14 for (string::const_iterator end = find(path.begin(), path.end(), '/'), start = path.begin(); start != path.end(); start = end, end = find(end + 1, path.end(), '/')) { 15 if (start == end) continue; 16 if (*start == '/') ++start; 17 if (start == end || lexicographical_compare(start, end, up.begin(), up.end()) || *start == '.') 18 continue; 19 out += "/" + string(start, end); 20 for_each(start, end, putchar); 21 putchar('\n'); 82 for (ExtensionPoint<ISearchProvider>::iterator i = ExtensionPoint<ISearchProvider>::singleton().begin(); 83 i != ExtensionPoint<ISearchProvider>::singleton().end(); ++i) { 84 cout << (*i)->do_search("foo") << endl; 22 85 } 23 cout << out << endl;24 86 return 0; 25 87 } libcrash/trunk/TODO
r135 r145 1 1 2 libCrash - A modular library of source code.- Ensure Terminal operations work correctly even if raw capabilities are not 3 there (case in point - goto bottom left) 4 (added 05/05/02, 09:21, completed incomplete, priority veryhigh) 2 libCrash - A modular library of source code.- libCrash Scripting engine 3 (added 01/01/70, 10:00, incomplete, priority medium) 5 4 6 - Mark constructors 'explicit' that should be marked explicit. Prevents nasty7 bugs.8 (added 28/06/02, 00:56, completedincomplete, priority veryhigh)5 - Ensure Terminal operations work correctly even if raw capabilities are not there 6 (case in point - goto bottom left) 7 (added 05/05/02, 09:21, incomplete, priority veryhigh) 9 8 10 9 - Add libz support (Compress class) and make input and output chainable streams. 11 (added 29/05/02, 23:34, completedincomplete, priority medium)10 (added 29/05/02, 23:34, incomplete, priority medium) 12 11 13 12 - Add a 'chunk' binary format, ala the Electronic Arts IFF format. 14 (added 22/06/02, 20:19, completedincomplete, priority medium)13 (added 22/06/02, 20:19, incomplete, priority medium) 15 14 16 - Make an SQL abstraction layer, then make MySQL and SQLite implementations.17 (added 27/06/02, 00:58, completed incomplete, priority medium)15 - Base64 is not working properly - it decodes with extra characters. 16 (added 31/07/02, 21:20, incomplete, priority veryhigh) 18 17 18 - Make mlock() portable, or don't use it? 19 (added 28/11/02, 17:57, incomplete, priority medium) 20 21 - Figure out how to make d2i_DHparams portable across OpenSSL versions - they changed 22 the second argument from non-const to const somewhere between 0.9.6d and 0.9.7a. 23 Though why gcc 3.x is saying that passing a non-const object to a const function 24 argument is an error is beyond me. 25 (added 06/04/03, 17:49, incomplete, priority veryhigh) 26 27 - Write a join() that accept iterators of arbitrary containers. 28 (added 03/05/03, 14:46, incomplete, priority medium) 29 30 - Need to make Expression handle floating point numbers rather than just integers. 31 (added 04/03/04, 18:10, incomplete, priority medium) 32 libcrash/trunk/utils/crash-module.in
r135 r145 178 178 rm -f @OBJS $LIB 179 179 180 distclean: clean 181 180 182 .cc.o: 181 183 \$(CXX) \$(CXXFLAGS) -c \$< -o \$@
