Changeset 145

Show
Ignore:
Timestamp:
07/25/05 02:39:56 (3 years ago)
Author:
athomas
Message:
  • Minor adjustments to configure.in
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libcrash/trunk/configure.in

    r144 r145  
    141141fi 
    142142 
     143AC_CHECKING([for SQL drivers]) 
    143144if test "_$enable_sqlite" = _yes; then 
    144     AC_CHECKING([for SQL drivers]) 
    145  
    146145    AC_CHECK_LIB(sqlite, sqlite_compile, 
    147146        [ 
     
    183182        [ AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK, 1, [Have POSIX timed lock mutex]) ]) 
    184183 
     184AC_CHECKING([for crypto drivers]) 
    185185AC_TRY_LINK_FUNC(drand48, [AC_DEFINE(HAVE_DRAND48, 1, [Have drand48])]) 
    186186 
     
    216216 
    217217    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" 
    220220    fi 
    221221fi 
  • libcrash/trunk/crash/Expression.cc

    r135 r145  
    240240        if (*end && (isdigit(*end) || (*end == '-' || *end == '+') && isdigit(end[1]))) { 
    241241                ++end; 
    242                 while (isdigit(*end)) ++end; 
     242                while (isdigit(*end) || *end == '.') ++end; 
    243243                type = NUMBER; 
    244244                return MATCH_SOURCE; 
  • libcrash/trunk/crash/t.cc

    r135 r145  
    1 #include <cstdio> 
     1#include <crash/Singleton.h> 
     2#include <list> 
     3#include <string> 
    24#include <iostream> 
    3 #include <string> 
    4 #include <algorithm> 
    5 #include <functional> 
    65 
     6namespace crash { 
     7 
     8/** 
     9        The access point to instantiated extensions. 
     10*/ 
     11template <typename T> 
     12class 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*/ 
     34template <typename T> 
     35class 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 
     61struct 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 
     66struct 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 
     74REGISTER_COMPONENT(BodySearch) 
     75 
     76} 
     77 
     78int main(int argc, const char **argv) { 
     79using namespace crash; 
    780using namespace std; 
    881 
    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; 
    2285        } 
    23         cout << out << endl; 
    2486        return 0; 
    2587} 
  • libcrash/trunk/TODO

    r135 r145  
    11 
    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) 
     2libCrash - A modular library of source code.- libCrash Scripting engine 
     3  (added 01/01/70, 10:00, incomplete, priority medium) 
    54 
    6 - Mark constructors 'explicit' that should be marked explicit. Prevents nasty 
    7   bugs. 
    8   (added 28/06/02, 00:56, completed incomplete, 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) 
    98 
    109- Add libz support (Compress class) and make input and output chainable streams. 
    11   (added 29/05/02, 23:34, completed incomplete, priority medium) 
     10  (added 29/05/02, 23:34, incomplete, priority medium) 
    1211 
    1312- Add a 'chunk' binary format, ala the Electronic Arts IFF format. 
    14   (added 22/06/02, 20:19, completed incomplete, priority medium) 
     13  (added 22/06/02, 20:19, incomplete, priority medium) 
    1514 
    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
    1817 
     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  
    178178        rm -f @OBJS $LIB 
    179179 
     180distclean: clean 
     181 
    180182.cc.o: 
    181183        \$(CXX) \$(CXXFLAGS) -c \$< -o \$@