* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / src / vm / suck.hpp
index de9317ec01b0702453ea994201e8bc573ade8fe1..ff7077387636fb569662d9639708ad8210335707 100644 (file)
 
 #include "config.h"
 
+#ifdef __cplusplus
+#include <list>
+#endif
+
 #include "vm/types.h"
 
 #include "threads/mutex.hpp"
 
 #include "toolbox/hashtable.h"
-#include "toolbox/list.h"
 
-#include "vm/class.h"
+#include "vm/class.hpp"
 #include "vm/global.h"
 #include "vm/loader.hpp"
 
@@ -47,9 +50,7 @@ enum {
        CLASSPATH_ARCHIVE
 };
 
-typedef struct list_classpath_entry list_classpath_entry;
-
-struct list_classpath_entry {
+typedef struct list_classpath_entry {
 #if defined(ENABLE_THREADS)
        Mutex             *mutex;               /* mutex locking on zip/jar files */
 #endif
@@ -59,9 +60,28 @@ struct list_classpath_entry {
 #if defined(ENABLE_ZLIB)
        hashtable         *htclasses;
 #endif
-       listnode_t         linkage;
+} list_classpath_entry;
+
+
+#ifdef __cplusplus
+
+/**
+ * Classpath entries list.
+ */
+class SuckClasspath : protected std::list<list_classpath_entry*> {
+public:
+       void add(char *classpath);
+       void add_from_property(const char *key);
+
+       // make iterator of std::list visible
+       using std::list<list_classpath_entry*>::iterator;
+
+       // make functions of std::list visible
+       using std::list<list_classpath_entry*>::begin;
+       using std::list<list_classpath_entry*>::end;
 };
 
+#endif
 
 /* macros to read LE and BE types from a buffer ********************************
 
@@ -79,10 +99,7 @@ struct list_classpath_entry {
 #define SUCK_LE_U1(p)    *((u1 *) (p))
 #define SUCK_LE_U2(p)    *((u2 *) (p))
 #define SUCK_LE_U4(p)    *((u4 *) (p))
-
-#if U8_AVAILABLE == 1
 #define SUCK_LE_U8(p)    *((u8 *) (p))
-#endif
 
 #else /* defined(__I386__) || defined(__X86_64__) */
 
@@ -99,7 +116,6 @@ struct list_classpath_entry {
      (((u4) (p)[1]) << 8) + \
       ((u4) (p)[0]))
 
-#if U8_AVAILABLE == 1
 #define SUCK_LE_U8(p) \
     ((((u8) (p)[7]) << 56) + \
      (((u8) (p)[6]) << 48) + \
@@ -109,7 +125,6 @@ struct list_classpath_entry {
      (((u8) (p)[2]) << 16) + \
      (((u8) (p)[1]) << 8) + \
       ((u8) (p)[0]))
-#endif
 
 #endif /* defined(__I386__) || defined(__X86_64__) */
 
@@ -129,7 +144,6 @@ struct list_classpath_entry {
      (((u4) (p)[2]) << 8) + \
       ((u4) (p)[3]))
 
-#if U8_AVAILABLE == 1
 #define SUCK_BE_U8(p) \
     ((((u8) (p)[0]) << 56) + \
      (((u8) (p)[1]) << 48) + \
@@ -139,7 +153,6 @@ struct list_classpath_entry {
      (((u8) (p)[5]) << 16) + \
      (((u8) (p)[6]) << 8) + \
       ((u8) (p)[7]))
-#endif
 
 
 #define SUCK_BE_S1(p)    (s1) SUCK_BE_U1(p)
@@ -156,22 +169,12 @@ struct list_classpath_entry {
 #define suck_s8(a)    (s8) suck_u8((a))
 
 
-/* export variables ***********************************************************/
-
-extern list_t *list_classpath_entries;
-
-
 /* function prototypes ********************************************************/
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-bool suck_init(void);
-
-void suck_add(char *classpath);
-void suck_add_from_property(const char *key);
-
 bool suck_check_classbuffer_size(classbuffer *cb, s4 len);
 
 u1 suck_u1(classbuffer *cb);