#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"
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
#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 ********************************
#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__) */
(((u4) (p)[1]) << 8) + \
((u4) (p)[0]))
-#if U8_AVAILABLE == 1
#define SUCK_LE_U8(p) \
((((u8) (p)[7]) << 56) + \
(((u8) (p)[6]) << 48) + \
(((u8) (p)[2]) << 16) + \
(((u8) (p)[1]) << 8) + \
((u8) (p)[0]))
-#endif
#endif /* defined(__I386__) || defined(__X86_64__) */
(((u4) (p)[2]) << 8) + \
((u4) (p)[3]))
-#if U8_AVAILABLE == 1
#define SUCK_BE_U8(p) \
((((u8) (p)[0]) << 56) + \
(((u8) (p)[1]) << 48) + \
(((u8) (p)[5]) << 16) + \
(((u8) (p)[6]) << 8) + \
((u8) (p)[7]))
-#endif
#define SUCK_BE_S1(p) (s1) SUCK_BE_U1(p)
#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);