You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2013/06/12 21:08:55 UTC
svn commit: r1492377 [11/12] - in /incubator/celix/trunk:
dependency_manager/private/src/ dependency_manager/public/include/
deployment_admin/private/include/ deployment_admin/private/src/
deployment_admin/public/include/ device_access/device_access/pr...
Modified: incubator/celix/trunk/remote_shell/private/src/shell_mediator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/shell_mediator.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/shell_mediator.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/shell_mediator.c Wed Jun 12 19:08:50 2013
@@ -38,12 +38,12 @@
struct shell_mediator {
apr_pool_t *pool;
- bundle_context_t context;
- service_tracker_t tracker;
+ bundle_context_pt context;
+ service_tracker_pt tracker;
apr_thread_mutex_t *mutex;
//protected by mutex
- SHELL_SERVICE shellService;
+ shell_service_pt shellService;
};
//NOTE: multiple instances of shell_mediator are not supported, because we need
@@ -53,16 +53,16 @@ static apr_socket_t *currentOutputSocket
static apr_status_t shellMediator_cleanup(void *handle); //gets called from apr pool cleanup
static void shellMediator_writeOnCurrentSocket(char *buff);
-static celix_status_t shellMediator_addingService(void *handler, service_reference_t reference, void **service);
-static celix_status_t shellMediator_addedService(void *handler, service_reference_t reference, void * service);
-static celix_status_t shellMediator_modifiedService(void *handler, service_reference_t reference, void * service);
-static celix_status_t shellMediator_removedService(void *handler, service_reference_t reference, void * service);
+static celix_status_t shellMediator_addingService(void *handler, service_reference_pt reference, void **service);
+static celix_status_t shellMediator_addedService(void *handler, service_reference_pt reference, void * service);
+static celix_status_t shellMediator_modifiedService(void *handler, service_reference_pt reference, void * service);
+static celix_status_t shellMediator_removedService(void *handler, service_reference_pt reference, void * service);
-celix_status_t shellMediator_create(apr_pool_t *pool, bundle_context_t context, shell_mediator_t *instance) {
+celix_status_t shellMediator_create(apr_pool_t *pool, bundle_context_pt context, shell_mediator_pt *instance) {
celix_status_t status = CELIX_SUCCESS;
- service_tracker_customizer_t customizer = NULL;
+ service_tracker_customizer_pt customizer = NULL;
- (*instance) = (shell_mediator_t) (pool, sizeof(**instance));
+ (*instance) = (shell_mediator_pt) (pool, sizeof(**instance));
if ((*instance) != NULL) {
apr_pool_pre_cleanup_register(pool, *instance, shellMediator_cleanup);
@@ -90,7 +90,7 @@ celix_status_t shellMediator_create(apr_
}
static apr_status_t shellMediator_cleanup(void *handle) {
- shell_mediator_t instance = (shell_mediator_t) handle;
+ shell_mediator_pt instance = (shell_mediator_pt) handle;
apr_thread_mutex_lock(instance->mutex);
instance->shellService=NULL;
@@ -105,7 +105,7 @@ static void shellMediator_writeOnCurrent
apr_socket_send(currentOutputSocket, buff, &len);
}
-celix_status_t shellMediator_executeCommand(shell_mediator_t instance, char *command, apr_socket_t *socket) {
+celix_status_t shellMediator_executeCommand(shell_mediator_pt instance, char *command, apr_socket_t *socket) {
apr_status_t status = CELIX_SUCCESS;
apr_thread_mutex_lock(instance->mutex);
@@ -119,31 +119,31 @@ celix_status_t shellMediator_executeComm
return status;
}
-static celix_status_t shellMediator_addingService(void *handler, service_reference_t reference, void **service) {
+static celix_status_t shellMediator_addingService(void *handler, service_reference_pt reference, void **service) {
celix_status_t status = CELIX_SUCCESS;
- shell_mediator_t instance = (shell_mediator_t) handler;
+ shell_mediator_pt instance = (shell_mediator_pt) handler;
bundleContext_getService(instance->context, reference, service);
return status;
}
-static celix_status_t shellMediator_addedService(void *handler, service_reference_t reference, void * service) {
+static celix_status_t shellMediator_addedService(void *handler, service_reference_pt reference, void * service) {
celix_status_t status = CELIX_SUCCESS;
- shell_mediator_t instance = (shell_mediator_t) handler;
+ shell_mediator_pt instance = (shell_mediator_pt) handler;
apr_thread_mutex_lock(instance->mutex);
- instance->shellService = (SHELL_SERVICE) service;
+ instance->shellService = (shell_service_pt) service;
apr_thread_mutex_unlock(instance->mutex);
return status;
}
-static celix_status_t shellMediator_modifiedService(void *handler, service_reference_t reference, void * service) {
+static celix_status_t shellMediator_modifiedService(void *handler, service_reference_pt reference, void * service) {
celix_status_t status = CELIX_SUCCESS;
//ignore
return status;
}
-static celix_status_t shellMediator_removedService(void *handler, service_reference_t reference, void * service) {
+static celix_status_t shellMediator_removedService(void *handler, service_reference_pt reference, void * service) {
celix_status_t status = CELIX_SUCCESS;
- shell_mediator_t instance = (shell_mediator_t) handler;
+ shell_mediator_pt instance = (shell_mediator_pt) handler;
apr_thread_mutex_lock(instance->mutex);
instance->shellService = NULL;
apr_thread_mutex_unlock(instance->mutex);
Modified: incubator/celix/trunk/shell/private/include/inspect_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/inspect_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/inspect_command.h (original)
+++ incubator/celix/trunk/shell/private/include/inspect_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef INSPECT_COMMAND_H_
#define INSPECT_COMMAND_H_
-COMMAND inspectCommand_create(bundle_context_t context);
-void inspectCommand_destroy(COMMAND command);
+command_pt inspectCommand_create(bundle_context_pt context);
+void inspectCommand_destroy(command_pt command);
#endif /* INSPECT_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/install_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/install_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/install_command.h (original)
+++ incubator/celix/trunk/shell/private/include/install_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef INSTALL_COMMAND_H_
#define INSTALL_COMMAND_H_
-COMMAND installCommand_create(bundle_context_t context);
-void installCommand_destroy(COMMAND command);
+command_pt installCommand_create(bundle_context_pt context);
+void installCommand_destroy(command_pt command);
#endif /* INSTALL_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/log_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/log_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/log_command.h (original)
+++ incubator/celix/trunk/shell/private/include/log_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef LOG_COMMAND_H_
#define LOG_COMMAND_H_
-COMMAND logCommand_create(bundle_context_t context);
-void logCommand_destroy(COMMAND command);
+command_pt logCommand_create(bundle_context_pt context);
+void logCommand_destroy(command_pt command);
#endif /* LOG_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/ps_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/ps_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/ps_command.h (original)
+++ incubator/celix/trunk/shell/private/include/ps_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef PS_COMMAND_H_
#define PS_COMMAND_H_
-COMMAND psCommand_create(bundle_context_t context);
-void psCommand_destroy(COMMAND command);
+command_pt psCommand_create(bundle_context_pt context);
+void psCommand_destroy(command_pt command);
#endif /* PS_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/shell_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/shell_private.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/shell_private.h (original)
+++ incubator/celix/trunk/shell/private/include/shell_private.h Wed Jun 12 19:08:50 2013
@@ -33,18 +33,18 @@
struct shell {
apr_pool_t *pool;
- bundle_context_t bundleContext;
- hash_map_t commandReferenceMap;
- hash_map_t commandNameMap;
+ bundle_context_pt bundleContext;
+ hash_map_pt commandReferenceMap;
+ hash_map_pt commandNameMap;
};
-SHELL shell_create();
-char * shell_getCommandUsage(SHELL shell, char * commandName);
-char * shell_getCommandDescription(SHELL shell, char * commandName);
-service_reference_t shell_getCommandReference(SHELL shell, char * command);
-void shell_executeCommand(SHELL shell, char * commandLine, void (*out)(char *), void (*error)(char *));
+shell_pt shell_create();
+char * shell_getCommandUsage(shell_pt shell, char * commandName);
+char * shell_getCommandDescription(shell_pt shell, char * commandName);
+service_reference_pt shell_getCommandReference(shell_pt shell, char * command);
+void shell_executeCommand(shell_pt shell, char * commandLine, void (*out)(char *), void (*error)(char *));
-COMMAND shell_getCommand(SHELL shell, char * commandName);
+command_pt shell_getCommand(shell_pt shell, char * commandName);
#endif /* SHELL_PRIVATE_H_ */
Modified: incubator/celix/trunk/shell/private/include/start_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/start_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/start_command.h (original)
+++ incubator/celix/trunk/shell/private/include/start_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef START_COMMAND_H_
#define START_COMMAND_H_
-COMMAND startCommand_create(bundle_context_t context);
-void startCommand_destroy(COMMAND command);
+command_pt startCommand_create(bundle_context_pt context);
+void startCommand_destroy(command_pt command);
#endif /* START_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/stop_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/stop_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/stop_command.h (original)
+++ incubator/celix/trunk/shell/private/include/stop_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef STOP_COMMAND_H_
#define STOP_COMMAND_H_
-COMMAND stopCommand_create(bundle_context_t context);
-void stopCommand_destroy(COMMAND command);
+command_pt stopCommand_create(bundle_context_pt context);
+void stopCommand_destroy(command_pt command);
#endif /* STOP_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/uninstall_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/uninstall_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/uninstall_command.h (original)
+++ incubator/celix/trunk/shell/private/include/uninstall_command.h Wed Jun 12 19:08:50 2013
@@ -27,7 +27,7 @@
#ifndef UNINSTALL_COMMAND_H_
#define UNINSTALL_COMMAND_H_
-COMMAND uninstallCommand_create(bundle_context_t context);
-void uninstallCommand_destroy(COMMAND command);
+command_pt uninstallCommand_create(bundle_context_pt context);
+void uninstallCommand_destroy(command_pt command);
#endif /* UNINSTALL_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/include/update_command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/include/update_command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/include/update_command.h (original)
+++ incubator/celix/trunk/shell/private/include/update_command.h Wed Jun 12 19:08:50 2013
@@ -29,7 +29,7 @@
#include "command.h"
-COMMAND updateCommand_create(bundle_context_t context);
-void updateCommand_destroy(COMMAND command);
+command_pt updateCommand_create(bundle_context_pt context);
+void updateCommand_destroy(command_pt command);
#endif /* UPDATE_COMMAND_H_ */
Modified: incubator/celix/trunk/shell/private/src/command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/command.c (original)
+++ incubator/celix/trunk/shell/private/src/command.c Wed Jun 12 19:08:50 2013
@@ -28,18 +28,18 @@
#include "command_private.h"
-char * command_getName(COMMAND command) {
+char * command_getName(command_pt command) {
return command->name;
}
-char * command_getUsage(COMMAND command) {
+char * command_getUsage(command_pt command) {
return command->usage;
}
-char * command_getShortDescription(COMMAND command) {
+char * command_getShortDescription(command_pt command) {
return command->shortDescription;
}
-void command_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
+void command_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
command->executeCommand(command, line, out, err);
}
Modified: incubator/celix/trunk/shell/private/src/inspect_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/inspect_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/inspect_command.c (original)
+++ incubator/celix/trunk/shell/private/src/inspect_command.c Wed Jun 12 19:08:50 2013
@@ -38,14 +38,14 @@
#include "service_reference.h"
#define SERVICE_TYPE "service"
-#define capability_t "capability"
+#define capability_pt "capability"
#define REQUIREMENT "requirement"
-void inspectCommand_execute(COMMAND command, char * commandline, void (*out)(char *), void (*err)(char *));
-celix_status_t inspectCommand_printExportedServices(COMMAND command, array_list_t ids, void (*out)(char *), void (*err)(char *));
+void inspectCommand_execute(command_pt command, char * commandline, void (*out)(char *), void (*err)(char *));
+celix_status_t inspectCommand_printExportedServices(command_pt command, array_list_pt ids, void (*out)(char *), void (*err)(char *));
-COMMAND inspectCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt inspectCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "inspect";
command->shortDescription = "inspect dependencies";
@@ -54,11 +54,11 @@ COMMAND inspectCommand_create(bundle_con
return command;
}
-void inspectCommand_destroy(COMMAND command) {
+void inspectCommand_destroy(command_pt command) {
free(command);
}
-void inspectCommand_execute(COMMAND command, char * commandline, void (*out)(char *), void (*err)(char *)) {
+void inspectCommand_execute(command_pt command, char * commandline, void (*out)(char *), void (*err)(char *)) {
celix_status_t status = CELIX_SUCCESS;
char *token;
char *commandStr = apr_strtok(commandline, " ", &token);
@@ -67,7 +67,7 @@ void inspectCommand_execute(COMMAND comm
char *direction = apr_strtok(NULL, " ", &token);
if (direction != NULL) {
apr_pool_t *pool = NULL;
- array_list_t ids = NULL;
+ array_list_pt ids = NULL;
char *id = apr_strtok(NULL, " ", &token);
bundleContext_getMemoryPool(command->bundleContext, &pool);
@@ -78,7 +78,7 @@ void inspectCommand_execute(COMMAND comm
}
if (strcmp(type, SERVICE_TYPE) == 0) {
- if (strcmp(direction, capability_t) == 0) {
+ if (strcmp(direction, capability_pt) == 0) {
status = inspectCommand_printExportedServices(command, ids, out, err);
if (status != CELIX_SUCCESS) {
out("INSPECT: Error\n");
@@ -97,9 +97,9 @@ void inspectCommand_execute(COMMAND comm
}
}
-celix_status_t inspectCommand_printExportedServices(COMMAND command, array_list_t ids, void (*out)(char *), void (*err)(char *)) {
+celix_status_t inspectCommand_printExportedServices(command_pt command, array_list_pt ids, void (*out)(char *), void (*err)(char *)) {
celix_status_t status = CELIX_SUCCESS;
- array_list_t bundles = NULL;
+ array_list_pt bundles = NULL;
if (arrayList_isEmpty(ids)) {
celix_status_t status = bundleContext_getBundles(command->bundleContext, &bundles);
@@ -112,7 +112,7 @@ celix_status_t inspectCommand_printExpor
for (i = 0; i < arrayList_size(ids); i++) {
char *idStr = (char *) arrayList_get(ids, i);
long id = atol(idStr);
- bundle_t b = NULL;
+ bundle_pt b = NULL;
celix_status_t st = bundleContext_getBundleById(command->bundleContext, id, &b);
if (st == CELIX_SUCCESS) {
arrayList_add(bundles, b);
@@ -127,7 +127,7 @@ celix_status_t inspectCommand_printExpor
if (status == CELIX_SUCCESS) {
unsigned int i = 0;
for (i = 0; i < arrayList_size(bundles); i++) {
- bundle_t bundle = (bundle_t) arrayList_get(bundles, i);
+ bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
if (i > 0) {
out("\n");
@@ -135,12 +135,12 @@ celix_status_t inspectCommand_printExpor
if (bundle != NULL) {
apr_pool_t *pool;
- array_list_t refs = NULL;
+ array_list_pt refs = NULL;
bundleContext_getMemoryPool(command->bundleContext, &pool);
if (bundle_getRegisteredServices(bundle, pool, &refs) == CELIX_SUCCESS) {
char line[256];
- module_t module = NULL;
+ module_pt module = NULL;
char * name = NULL;
status = bundle_getCurrentModule(bundle, &module);
if (status == CELIX_SUCCESS) {
@@ -155,9 +155,9 @@ celix_status_t inspectCommand_printExpor
} else {
unsigned int j = 0;
for (j = 0; j < arrayList_size(refs); j++) {
- service_reference_t ref = (service_reference_t) arrayList_get(refs, j);
- service_registration_t reg = NULL;
- properties_t props = NULL;
+ service_reference_pt ref = (service_reference_pt) arrayList_get(refs, j);
+ service_registration_pt reg = NULL;
+ properties_pt props = NULL;
char line[256];
char *objectClass = NULL;
Modified: incubator/celix/trunk/shell/private/src/install_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/install_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/install_command.c (original)
+++ incubator/celix/trunk/shell/private/src/install_command.c Wed Jun 12 19:08:50 2013
@@ -33,11 +33,11 @@
#include "bundle.h"
#include "install_command.h"
-void installCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
-void installCommand_install(COMMAND command, bundle_t *bundle, char * location, void (*out)(char *), void (*err)(char *));
+void installCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
+void installCommand_install(command_pt command, bundle_pt *bundle, char * location, void (*out)(char *), void (*err)(char *));
-COMMAND installCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt installCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "install";
command->shortDescription = "install bundle(s).";
@@ -46,11 +46,11 @@ COMMAND installCommand_create(bundle_con
return command;
}
-void installCommand_destroy(COMMAND command) {
+void installCommand_destroy(command_pt command) {
free(command);
}
-void installCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
+void installCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
char delims[] = " ";
char * sub = NULL;
char info[256];
@@ -61,11 +61,11 @@ void installCommand_execute(COMMAND comm
info[0] = '\0';
while (sub != NULL) {
- bundle_t bundle = NULL;
+ bundle_pt bundle = NULL;
installCommand_install(command, &bundle, strdup(sub), out, err);
if (bundle != NULL) {
long id;
- bundle_archive_t archive = NULL;
+ bundle_archive_pt archive = NULL;
char bundleId[sizeof(id) + 1];
if (strlen(info) > 0) {
@@ -89,6 +89,6 @@ void installCommand_execute(COMMAND comm
}
}
-void installCommand_install(COMMAND command, bundle_t *bundle, char * location, void (*out)(char *), void (*err)(char *)) {
+void installCommand_install(command_pt command, bundle_pt *bundle, char * location, void (*out)(char *), void (*err)(char *)) {
bundleContext_installBundle(command->bundleContext, location, bundle);
}
Modified: incubator/celix/trunk/shell/private/src/log_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/log_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/log_command.c (original)
+++ incubator/celix/trunk/shell/private/src/log_command.c Wed Jun 12 19:08:50 2013
@@ -33,10 +33,10 @@
#include "log_entry.h"
#include "linked_list_iterator.h"
-void logCommand_execute(COMMAND command, char *line, void (*out)(char *), void (*err)(char *));
+void logCommand_execute(command_pt command, char *line, void (*out)(char *), void (*err)(char *));
-COMMAND logCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt logCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "log";
command->shortDescription = "print log";
@@ -45,22 +45,22 @@ COMMAND logCommand_create(bundle_context
return command;
}
-void logCommand_destroy(COMMAND command) {
+void logCommand_destroy(command_pt command) {
free(command);
}
-void logCommand_execute(COMMAND command, char *line, void (*out)(char *), void (*err)(char *)) {
- service_reference_t readerService = NULL;
- service_reference_t logService = NULL;
+void logCommand_execute(command_pt command, char *line, void (*out)(char *), void (*err)(char *)) {
+ service_reference_pt readerService = NULL;
+ service_reference_pt logService = NULL;
apr_pool_t *memory_pool = NULL;
apr_pool_t *bundle_memory_pool = NULL;
bundleContext_getServiceReference(command->bundleContext, (char *) LOG_READER_SERVICE_NAME, &readerService);
if (readerService != NULL) {
char line[256];
- linked_list_t list = NULL;
- linked_list_iterator_t iter = NULL;
- log_reader_service_t reader = NULL;
+ linked_list_pt list = NULL;
+ linked_list_iterator_pt iter = NULL;
+ log_reader_service_pt reader = NULL;
bundleContext_getMemoryPool(command->bundleContext, &bundle_memory_pool);
apr_pool_create(&memory_pool, bundle_memory_pool);
@@ -69,7 +69,7 @@ void logCommand_execute(COMMAND command,
reader->getLog(reader->reader, memory_pool, &list);
iter = linkedListIterator_create(list, 0);
while (linkedListIterator_hasNext(iter)) {
- log_entry_t entry = linkedListIterator_next(iter);
+ log_entry_pt entry = linkedListIterator_next(iter);
sprintf(line, "%s\n", entry->message);
out(line);
}
Modified: incubator/celix/trunk/shell/private/src/ps_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/ps_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/ps_command.c (original)
+++ incubator/celix/trunk/shell/private/src/ps_command.c Wed Jun 12 19:08:50 2013
@@ -33,10 +33,10 @@
#include "bundle.h"
char * psCommand_stateString(bundle_state_e state);
-void psCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
+void psCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
-COMMAND psCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt psCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "ps";
command->shortDescription = "list installed bundles.";
@@ -45,12 +45,12 @@ COMMAND psCommand_create(bundle_context_
return command;
}
-void psCommand_destroy(COMMAND command) {
+void psCommand_destroy(command_pt command) {
free(command);
}
-void psCommand_execute(COMMAND command, char * commandline, void (*out)(char *), void (*err)(char *)) {
- array_list_t bundles = NULL;
+void psCommand_execute(command_pt command, char * commandline, void (*out)(char *), void (*err)(char *)) {
+ array_list_pt bundles = NULL;
celix_status_t status = bundleContext_getBundles(command->bundleContext, &bundles);
if (status == CELIX_SUCCESS) {
@@ -82,12 +82,12 @@ void psCommand_execute(COMMAND command,
sprintf(line, " %-5s %-12s %s\n", "ID", "State", msg);
out(line);
for (i = 0; i < arrayList_size(bundles); i++) {
- bundle_t bundle = (bundle_t) arrayList_get(bundles, i);
- bundle_archive_t archive = NULL;
+ bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
+ bundle_archive_pt archive = NULL;
long id;
bundle_state_e state;
char * stateString = NULL;
- module_t module = NULL;
+ module_pt module = NULL;
char * name = NULL;
bundle_getArchive(bundle, &archive);
Modified: incubator/celix/trunk/shell/private/src/shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/shell.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/shell.c (original)
+++ incubator/celix/trunk/shell/private/src/shell.c Wed Jun 12 19:08:50 2013
@@ -45,53 +45,53 @@
#include "utils.h"
struct shellServiceActivator {
- SHELL shell;
- SHELL_SERVICE shellService;
- service_registration_t registration;
- service_listener_t listener;
+ shell_pt shell;
+ shell_service_pt shellService;
+ service_registration_pt registration;
+ service_listener_pt listener;
- service_registration_t psCommand;
- COMMAND psCmd;
+ service_registration_pt psCommand;
+ command_pt psCmd;
- service_registration_t startCommand;
- COMMAND startCmd;
+ service_registration_pt startCommand;
+ command_pt startCmd;
- service_registration_t stopCommand;
- COMMAND stopCmd;
+ service_registration_pt stopCommand;
+ command_pt stopCmd;
- service_registration_t installCommand;
- COMMAND installCmd;
+ service_registration_pt installCommand;
+ command_pt installCmd;
- service_registration_t uninstallCommand;
- COMMAND uninstallCmd;
+ service_registration_pt uninstallCommand;
+ command_pt uninstallCmd;
- service_registration_t updateCommand;
- COMMAND updateCmd;
+ service_registration_pt updateCommand;
+ command_pt updateCmd;
- service_registration_t logCommand;
- COMMAND logCmd;
+ service_registration_pt logCommand;
+ command_pt logCmd;
- service_registration_t inspectCommand;
- COMMAND inspectCmd;
+ service_registration_pt inspectCommand;
+ command_pt inspectCmd;
};
-SHELL shell_create(apr_pool_t *pool) {
- SHELL shell = (SHELL) malloc(sizeof(*shell));
+shell_pt shell_create(apr_pool_t *pool) {
+ shell_pt shell = (shell_pt) malloc(sizeof(*shell));
shell->pool = pool;
shell->commandNameMap = hashMap_create(string_hash, NULL, string_equals, NULL);
shell->commandReferenceMap = hashMap_create(NULL, NULL, NULL, NULL);
return shell;
}
-void shell_destroy(SHELL shell) {
+void shell_destroy(shell_pt shell) {
hashMap_destroy(shell->commandNameMap, false, false);
hashMap_destroy(shell->commandReferenceMap, false, false);
free(shell);
}
-array_list_t shell_getCommands(SHELL shell) {
- array_list_t commands = NULL;
- hash_map_iterator_t iter = hashMapIterator_create(shell->commandNameMap);
+array_list_pt shell_getCommands(shell_pt shell) {
+ array_list_pt commands = NULL;
+ hash_map_iterator_pt iter = hashMapIterator_create(shell->commandNameMap);
arrayList_create(shell->pool, &commands);
while (hashMapIterator_hasNext(iter)) {
@@ -101,32 +101,32 @@ array_list_t shell_getCommands(SHELL she
return commands;
}
-char * shell_getCommandUsage(SHELL shell, char * commandName) {
- COMMAND command = hashMap_get(shell->commandNameMap, commandName);
+char * shell_getCommandUsage(shell_pt shell, char * commandName) {
+ command_pt command = hashMap_get(shell->commandNameMap, commandName);
return (command == NULL) ? NULL : command->usage;
}
-char * shell_getCommandDescription(SHELL shell, char * commandName) {
- COMMAND command = hashMap_get(shell->commandNameMap, commandName);
+char * shell_getCommandDescription(shell_pt shell, char * commandName) {
+ command_pt command = hashMap_get(shell->commandNameMap, commandName);
return (command == NULL) ? NULL : command->shortDescription;
}
-service_reference_t shell_getCommandReference(SHELL shell, char * command) {
- hash_map_iterator_t iter = hashMapIterator_create(shell->commandReferenceMap);
+service_reference_pt shell_getCommandReference(shell_pt shell, char * command) {
+ hash_map_iterator_pt iter = hashMapIterator_create(shell->commandReferenceMap);
while (hashMapIterator_hasNext(iter)) {
- hash_map_entry_t entry = hashMapIterator_nextEntry(iter);
- COMMAND cmd = (COMMAND) hashMapEntry_getValue(entry);
+ hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+ command_pt cmd = (command_pt) hashMapEntry_getValue(entry);
if (strcmp(cmd->name, command) == 0) {
- return (service_reference_t) hashMapEntry_getValue(entry);
+ return (service_reference_pt) hashMapEntry_getValue(entry);
}
}
return NULL;
}
-void shell_executeCommand(SHELL shell, char * commandLine, void (*out)(char *), void (*error)(char *)) {
+void shell_executeCommand(shell_pt shell, char * commandLine, void (*out)(char *), void (*error)(char *)) {
unsigned int pos = strcspn(commandLine, " ");
char * commandName = (pos != strlen(commandLine)) ? string_ndup((char *)commandLine, pos) : strdup(commandLine);
- COMMAND command = shell_getCommand(shell, commandName);
+ command_pt command = shell_getCommand(shell, commandName);
if (command != NULL) {
command->executeCommand(command, commandLine, out, error);
} else {
@@ -135,37 +135,37 @@ void shell_executeCommand(SHELL shell, c
free(commandName);
}
-COMMAND shell_getCommand(SHELL shell, char * commandName) {
- COMMAND command = hashMap_get(shell->commandNameMap, commandName);
+command_pt shell_getCommand(shell_pt shell, char * commandName) {
+ command_pt command = hashMap_get(shell->commandNameMap, commandName);
return (command == NULL) ? NULL : command;
}
-void shell_addCommand(SHELL shell, service_reference_t reference) {
- COMMAND command = NULL;
+void shell_addCommand(shell_pt shell, service_reference_pt reference) {
+ command_pt command = NULL;
void *cmd = NULL;
bundleContext_getService(shell->bundleContext, reference, &cmd);
- command = (COMMAND) cmd;
+ command = (command_pt) cmd;
hashMap_put(shell->commandNameMap, command->name, command);
hashMap_put(shell->commandReferenceMap, reference, command);
}
-void shell_removeCommand(SHELL shell, service_reference_t reference) {
- COMMAND command = (COMMAND) hashMap_remove(shell->commandReferenceMap, reference);
+void shell_removeCommand(shell_pt shell, service_reference_pt reference) {
+ command_pt command = (command_pt) hashMap_remove(shell->commandReferenceMap, reference);
if (command != NULL) {
hashMap_remove(shell->commandNameMap, command->name);
}
}
-void shell_serviceChanged(service_listener_t listener, service_event_t event) {
- SHELL shell = (SHELL) listener->handle;
+void shell_serviceChanged(service_listener_pt listener, service_event_pt event) {
+ shell_pt shell = (shell_pt) listener->handle;
if (event->type == SERVICE_EVENT_REGISTERED) {
shell_addCommand(shell, event->reference);
}
}
-celix_status_t bundleActivator_create(bundle_context_t context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
apr_pool_t *pool = NULL;
- SHELL shell = NULL;
+ shell_pt shell = NULL;
*userData = malloc(sizeof(struct shellServiceActivator));
bundleContext_getMemoryPool(context, &pool);
shell = shell_create(pool);
@@ -187,14 +187,14 @@ celix_status_t bundleActivator_create(bu
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
celix_status_t status;
apr_pool_t *pool = NULL;
struct shellServiceActivator * activator = (struct shellServiceActivator *) userData;
activator->shell->bundleContext = context;
- activator->shellService = (SHELL_SERVICE) malloc(sizeof(*activator->shellService));
+ activator->shellService = (shell_service_pt) malloc(sizeof(*activator->shellService));
activator->shellService->shell = activator->shell;
activator->shellService->getCommands = shell_getCommands;
activator->shellService->getCommandDescription = shell_getCommandDescription;
@@ -206,7 +206,7 @@ celix_status_t bundleActivator_start(voi
bundleContext_getMemoryPool(context, &pool);
if (status == CELIX_SUCCESS) {
- service_listener_t listener = (service_listener_t) malloc(sizeof(*listener));
+ service_listener_pt listener = (service_listener_pt) malloc(sizeof(*listener));
activator->listener = listener;
listener->pool = pool;
listener->handle = activator->shell;
@@ -243,7 +243,7 @@ celix_status_t bundleActivator_start(voi
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
struct shellServiceActivator * activator = (struct shellServiceActivator *) userData;
serviceRegistration_unregister(activator->registration);
@@ -277,7 +277,7 @@ celix_status_t bundleActivator_stop(void
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
struct shellServiceActivator * activator = (struct shellServiceActivator *) userData;
shell_destroy(activator->shell);
free(activator);
Modified: incubator/celix/trunk/shell/private/src/start_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/start_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/start_command.c (original)
+++ incubator/celix/trunk/shell/private/src/start_command.c Wed Jun 12 19:08:50 2013
@@ -31,10 +31,10 @@
#include "bundle_context.h"
#include "bundle.h"
-void startCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
+void startCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
-COMMAND startCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt startCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "start";
command->shortDescription = "start bundle(s).";
@@ -43,19 +43,19 @@ COMMAND startCommand_create(bundle_conte
return command;
}
-void startCommand_destroy(COMMAND command) {
+void startCommand_destroy(command_pt command) {
free(command);
}
-void startCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
+void startCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
char delims[] = " ";
char * sub = NULL;
sub = strtok(line, delims);
sub = strtok(NULL, delims);
while (sub != NULL) {
long id = atol(sub);
- bundle_t bundle = NULL;
+ bundle_pt bundle = NULL;
bundleContext_getBundleById(command->bundleContext, id, &bundle);
if (bundle != NULL) {
bundle_start(bundle, 0);
Modified: incubator/celix/trunk/shell/private/src/stop_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/stop_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/stop_command.c (original)
+++ incubator/celix/trunk/shell/private/src/stop_command.c Wed Jun 12 19:08:50 2013
@@ -32,10 +32,10 @@
#include "bundle.h"
#include "utils.h"
-void stopCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
+void stopCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
-COMMAND stopCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt stopCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "stop";
command->shortDescription = "stop bundle(s).";
@@ -44,11 +44,11 @@ COMMAND stopCommand_create(bundle_contex
return command;
}
-void stopCommand_destroy(COMMAND command) {
+void stopCommand_destroy(command_pt command) {
free(command);
}
-void stopCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
+void stopCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
char delims[] = " ";
char * sub = NULL;
sub = strtok(line, delims);
@@ -58,7 +58,7 @@ void stopCommand_execute(COMMAND command
utils_isNumeric(sub, &numeric);
if (numeric) {
long id = atol(sub);
- bundle_t bundle = NULL;
+ bundle_pt bundle = NULL;
bundleContext_getBundleById(command->bundleContext, id, &bundle);
if (bundle != NULL) {
bundle_stop(bundle, 0);
Modified: incubator/celix/trunk/shell/private/src/uninstall_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/uninstall_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/uninstall_command.c (original)
+++ incubator/celix/trunk/shell/private/src/uninstall_command.c Wed Jun 12 19:08:50 2013
@@ -32,10 +32,10 @@
#include "bundle.h"
#include "uninstall_command.h"
-void uninstallCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
+void uninstallCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
-COMMAND uninstallCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt uninstallCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "uninstall";
command->shortDescription = "uninstall bundle(s).";
@@ -44,19 +44,19 @@ COMMAND uninstallCommand_create(bundle_c
return command;
}
-void uninstallCommand_destroy(COMMAND command) {
+void uninstallCommand_destroy(command_pt command) {
free(command);
}
-void uninstallCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
+void uninstallCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
char delims[] = " ";
char * sub = NULL;
sub = strtok(line, delims);
sub = strtok(NULL, delims);
while (sub != NULL) {
long id = atol(sub);
- bundle_t bundle = NULL;
+ bundle_pt bundle = NULL;
bundleContext_getBundleById(command->bundleContext, id, &bundle);
if (bundle != NULL) {
bundle_uninstall(bundle);
Modified: incubator/celix/trunk/shell/private/src/update_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/update_command.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/update_command.c (original)
+++ incubator/celix/trunk/shell/private/src/update_command.c Wed Jun 12 19:08:50 2013
@@ -35,12 +35,12 @@
#include "bundle.h"
#include "update_command.h"
-void updateCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *));
-celix_status_t updateCommand_download(COMMAND command, char * url, char **inputFile);
+void updateCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
+celix_status_t updateCommand_download(command_pt command, char * url, char **inputFile);
size_t updateCommand_writeData(void *ptr, size_t size, size_t nmemb, FILE *stream);
-COMMAND updateCommand_create(bundle_context_t context) {
- COMMAND command = (COMMAND) malloc(sizeof(*command));
+command_pt updateCommand_create(bundle_context_pt context) {
+ command_pt command = (command_pt) malloc(sizeof(*command));
command->bundleContext = context;
command->name = "update";
command->shortDescription = "update bundle.";
@@ -49,13 +49,13 @@ COMMAND updateCommand_create(bundle_cont
return command;
}
-void updateCommand_destroy(COMMAND command) {
+void updateCommand_destroy(command_pt command) {
free(command);
}
-void updateCommand_execute(COMMAND command, char * line, void (*out)(char *), void (*err)(char *)) {
- bundle_t bundle = NULL;
+void updateCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
+ bundle_pt bundle = NULL;
char delims[] = " ";
char * sub = NULL;
sub = strtok(line, delims);
@@ -89,7 +89,7 @@ void updateCommand_execute(COMMAND comma
}
}
-celix_status_t updateCommand_download(COMMAND command, char * url, char **inputFile) {
+celix_status_t updateCommand_download(command_pt command, char * url, char **inputFile) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
Modified: incubator/celix/trunk/shell/public/include/command.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/public/include/command.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/public/include/command.h (original)
+++ incubator/celix/trunk/shell/public/include/command.h Wed Jun 12 19:08:50 2013
@@ -29,14 +29,14 @@
static const char * const COMMAND_SERVICE_NAME = "commandService";
-typedef struct command * COMMAND;
+typedef struct command * command_pt;
struct commandService {
- COMMAND command;
- char * (*getName)(COMMAND command);
- char * (*getUsage)(COMMAND command);
- char * (*getShortDescription)(COMMAND command);
- void (*executeCommand)(COMMAND command, char * commandLine, void (*out)(char *), void (*error)(char *));
+ command_pt command;
+ char * (*getName)(command_pt command);
+ char * (*getUsage)(command_pt command);
+ char * (*getShortDescription)(command_pt command);
+ void (*executeCommand)(command_pt command, char * commandLine, void (*out)(char *), void (*error)(char *));
};
Modified: incubator/celix/trunk/shell/public/include/command_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/public/include/command_private.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/public/include/command_private.h (original)
+++ incubator/celix/trunk/shell/public/include/command_private.h Wed Jun 12 19:08:50 2013
@@ -35,9 +35,9 @@ struct command {
char * usage;
char * shortDescription;
- bundle_context_t bundleContext;
+ bundle_context_pt bundleContext;
- void (*executeCommand)(COMMAND command, char * commandLine, void (*out)(char *), void (*error)(char *));
+ void (*executeCommand)(command_pt command, char * commandLine, void (*out)(char *), void (*error)(char *));
};
Modified: incubator/celix/trunk/shell/public/include/shell.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/public/include/shell.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell/public/include/shell.h (original)
+++ incubator/celix/trunk/shell/public/include/shell.h Wed Jun 12 19:08:50 2013
@@ -32,17 +32,17 @@
static const char * const SHELL_SERVICE_NAME = "shellService";
-typedef struct shell * SHELL;
+typedef struct shell * shell_pt;
struct shellService {
- SHELL shell;
- array_list_t (*getCommands)(SHELL shell);
- char * (*getCommandUsage)(SHELL shell, char * commandName);
- char * (*getCommandDescription)(SHELL shell, char * commandName);
- service_reference_t (*getCommandReference)(SHELL shell, char * command);
- void (*executeCommand)(SHELL shell, char * commandLine, void (*out)(char *), void (*error)(char *));
+ shell_pt shell;
+ array_list_pt (*getCommands)(shell_pt shell);
+ char * (*getCommandUsage)(shell_pt shell, char * commandName);
+ char * (*getCommandDescription)(shell_pt shell, char * commandName);
+ service_reference_pt (*getCommandReference)(shell_pt shell, char * command);
+ void (*executeCommand)(shell_pt shell, char * commandLine, void (*out)(char *), void (*error)(char *));
};
-typedef struct shellService * SHELL_SERVICE;
+typedef struct shellService * shell_service_pt;
#endif /* SHELL_H_ */
Modified: incubator/celix/trunk/shell_tui/private/src/shell_tui.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/private/src/shell_tui.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/private/src/shell_tui.c (original)
+++ incubator/celix/trunk/shell_tui/private/src/shell_tui.c Wed Jun 12 19:08:50 2013
@@ -33,22 +33,22 @@
#include "utils.h"
struct shellTuiActivator {
- bundle_context_t context;
- SHELL_SERVICE shell;
- service_reference_t reference;
+ bundle_context_pt context;
+ shell_service_pt shell;
+ service_reference_pt reference;
struct serviceListener * listener;
bool running;
apr_thread_t *runnable;
};
-typedef struct shellTuiActivator * SHELL_TUI_ACTIVATOR;
+typedef struct shellTuiActivator * shell_tui_activator_pt;
void shellTui_write(char * line) {
fprintf(stdout, "%s", line);
}
static void *APR_THREAD_FUNC shellTui_runnable(apr_thread_t *thd, void *data) {
- SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) data;
+ shell_tui_activator_pt act = (shell_tui_activator_pt) data;
char in[256];
bool needPrompt = true;
@@ -76,20 +76,20 @@ static void *APR_THREAD_FUNC shellTui_ru
return NULL;
}
-void shellTui_initializeService(SHELL_TUI_ACTIVATOR activator) {
+void shellTui_initializeService(shell_tui_activator_pt activator) {
if (activator->shell == NULL) {
bundleContext_getServiceReference(activator->context, (char *) SHELL_SERVICE_NAME, &activator->reference);
if (activator->reference != NULL) {
void *shell_svc = NULL;
bundleContext_getService(activator->context, activator->reference, &shell_svc);
- activator->shell = (SHELL_SERVICE) shell_svc;
+ activator->shell = (shell_service_pt) shell_svc;
}
}
}
-void shellTui_serviceChanged(service_listener_t listener, service_event_t event) {
+void shellTui_serviceChanged(service_listener_pt listener, service_event_pt event) {
bool result = false;
- SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) listener->handle;
+ shell_tui_activator_pt act = (shell_tui_activator_pt) listener->handle;
if ((event->type == SERVICE_EVENT_REGISTERED) && (act->reference == NULL)) {
shellTui_initializeService(act);
@@ -102,22 +102,22 @@ void shellTui_serviceChanged(service_lis
}
}
-celix_status_t bundleActivator_create(bundle_context_t context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
apr_pool_t *pool = NULL;
celix_status_t status = bundleContext_getMemoryPool(context, &pool);
- SHELL_TUI_ACTIVATOR activator = (SHELL_TUI_ACTIVATOR) apr_palloc(pool, sizeof(*activator));
- //SHELL_TUI_ACTIVATOR activator = (SHELL_TUI_ACTIVATOR) malloc(sizeof(*activator));
+ shell_tui_activator_pt activator = (shell_tui_activator_pt) apr_palloc(pool, sizeof(*activator));
+ //shell_tui_activator_pt activator = (shell_tui_activator_pt) malloc(sizeof(*activator));
activator->shell = NULL;
(*userData) = activator;
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
celix_status_t status;
apr_pool_t *pool = NULL;
- SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) userData;
- service_listener_t listener = (service_listener_t) malloc(sizeof(*listener));
+ shell_tui_activator_pt act = (shell_tui_activator_pt) userData;
+ service_listener_pt listener = (service_listener_pt) malloc(sizeof(*listener));
act->context = context;
act->running = true;
@@ -138,9 +138,9 @@ celix_status_t bundleActivator_start(voi
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
celix_status_t status;
- SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) userData;
+ shell_tui_activator_pt act = (shell_tui_activator_pt) userData;
status = bundleContext_removeServiceListener(context, act->listener);
if (status == CELIX_SUCCESS) {
@@ -154,6 +154,6 @@ celix_status_t bundleActivator_stop(void
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_t context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
return CELIX_SUCCESS;
}
Modified: incubator/celix/trunk/utils/private/include/array_list_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/include/array_list_private.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/include/array_list_private.h (original)
+++ incubator/celix/trunk/utils/private/include/array_list_private.h Wed Jun 12 19:08:50 2013
@@ -36,17 +36,17 @@ struct arrayList {
unsigned int modCount;
- arrayListElementEqualsFunction equals;
+ array_list_element_equals_pt equals;
};
struct arrayListIterator {
- array_list_t list;
+ array_list_pt list;
unsigned int cursor;
int lastReturned;
unsigned int expectedModificationCount;
};
-void * arrayList_remove(array_list_t list, unsigned int index);
+void * arrayList_remove(array_list_pt list, unsigned int index);
#endif /* array_list_t_PRIVATE_H_ */
Modified: incubator/celix/trunk/utils/private/include/hash_map_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/include/hash_map_private.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/include/hash_map_private.h (original)
+++ incubator/celix/trunk/utils/private/include/hash_map_private.h Wed Jun 12 19:08:50 2013
@@ -33,20 +33,20 @@
UTILS_EXPORT unsigned int hashMap_hashCode(void * toHash);
UTILS_EXPORT int hashMap_equals(void * toCompare, void * compare);
-void hashMap_resize(hash_map_t map, int newCapacity);
-void * hashMap_removeEntryForKey(hash_map_t map, void * key);
-UTILS_EXPORT hash_map_entry_t hashMap_removeMapping(hash_map_t map, hash_map_entry_t entry);
-void hashMap_addEntry(hash_map_t map, int hash, void * key, void * value, int bucketIndex);
+void hashMap_resize(hash_map_pt map, int newCapacity);
+void * hashMap_removeEntryForKey(hash_map_pt map, void * key);
+UTILS_EXPORT hash_map_entry_pt hashMap_removeMapping(hash_map_pt map, hash_map_entry_pt entry);
+void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex);
struct hashMapEntry {
void * key;
void * value;
- hash_map_entry_t next;
+ hash_map_entry_pt next;
unsigned int hash;
};
struct hashMap {
- hash_map_entry_t * table;
+ hash_map_entry_pt * table;
unsigned int size;
unsigned int treshold;
unsigned int modificationCount;
@@ -59,23 +59,23 @@ struct hashMap {
};
struct hashMapIterator {
- hash_map_t map;
- hash_map_entry_t next;
- hash_map_entry_t current;
+ hash_map_pt map;
+ hash_map_entry_pt next;
+ hash_map_entry_pt current;
int expectedModCount;
int index;
};
struct hashMapKeySet {
- hash_map_t map;
+ hash_map_pt map;
};
struct hashMapValues {
- hash_map_t map;
+ hash_map_pt map;
};
struct hashMapEntrySet {
- hash_map_t map;
+ hash_map_pt map;
};
Modified: incubator/celix/trunk/utils/private/include/linked_list_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/include/linked_list_private.h?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/include/linked_list_private.h (original)
+++ incubator/celix/trunk/utils/private/include/linked_list_private.h Wed Jun 12 19:08:50 2013
@@ -38,7 +38,7 @@ struct linkedListEntry {
struct linkedList {
apr_pool_t *memory_pool;
- linked_list_entry_t header;
+ linked_list_entry_pt header;
size_t size;
int modificationCount;
};
Modified: incubator/celix/trunk/utils/private/src/array_list.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/array_list.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/array_list.c (original)
+++ incubator/celix/trunk/utils/private/src/array_list.c Wed Jun 12 19:08:50 2013
@@ -32,15 +32,15 @@
static celix_status_t arrayList_elementEquals(void *a, void *b, bool *equals);
-celix_status_t arrayList_create(apr_pool_t *pool, array_list_t *list) {
+celix_status_t arrayList_create(apr_pool_t *pool, array_list_pt *list) {
return arrayList_createWithEquals(pool, arrayList_elementEquals, list);
}
- celix_status_t arrayList_createWithEquals(apr_pool_t *pool, arrayListElementEqualsFunction equals, array_list_t *list) {
+ celix_status_t arrayList_createWithEquals(apr_pool_t *pool, array_list_element_equals_pt equals, array_list_pt *list) {
apr_pool_t *mypool;
apr_pool_create(&mypool, pool);
-// *list = (array_list_t) apr_palloc(mypool, sizeof(**list));
- *list = (array_list_t) malloc(sizeof(**list));
+// *list = (array_list_pt) apr_palloc(mypool, sizeof(**list));
+ *list = (array_list_pt) malloc(sizeof(**list));
(*list)->equals = equals;
(*list)->size = 0;
@@ -51,7 +51,7 @@ celix_status_t arrayList_create(apr_pool
return CELIX_SUCCESS;
}
-void arrayList_destroy(array_list_t list) {
+void arrayList_destroy(array_list_pt list) {
list->size = 0;
free(list->elementData);
list->elementData = NULL;
@@ -64,7 +64,7 @@ static celix_status_t arrayList_elementE
return CELIX_SUCCESS;
}
-void arrayList_trimToSize(array_list_t list) {
+void arrayList_trimToSize(array_list_pt list) {
unsigned int oldCapacity;
list->modCount++;
oldCapacity = list->capacity;
@@ -75,7 +75,7 @@ void arrayList_trimToSize(array_list_t l
}
}
-void arrayList_ensureCapacity(array_list_t list, int capacity) {
+void arrayList_ensureCapacity(array_list_pt list, int capacity) {
void ** newList;
int oldCapacity;
list->modCount++;
@@ -91,20 +91,20 @@ void arrayList_ensureCapacity(array_list
}
}
-unsigned int arrayList_size(array_list_t list) {
+unsigned int arrayList_size(array_list_pt list) {
return list->size;
}
-bool arrayList_isEmpty(array_list_t list) {
+bool arrayList_isEmpty(array_list_pt list) {
return list->size == 0;
}
-bool arrayList_contains(array_list_t list, void * element) {
+bool arrayList_contains(array_list_pt list, void * element) {
int index = arrayList_indexOf(list, element);
return index >= 0;
}
-int arrayList_indexOf(array_list_t list, void * element) {
+int arrayList_indexOf(array_list_pt list, void * element) {
if (element == NULL) {
unsigned int i = 0;
for (i = 0; i < list->size; i++) {
@@ -125,7 +125,7 @@ int arrayList_indexOf(array_list_t list,
return -1;
}
-int arrayList_lastIndexOf(array_list_t list, void * element) {
+int arrayList_lastIndexOf(array_list_pt list, void * element) {
if (element == NULL) {
int i = 0;
for (i = list->size - 1; i >= 0; i--) {
@@ -146,7 +146,7 @@ int arrayList_lastIndexOf(array_list_t l
return -1;
}
-void * arrayList_get(array_list_t list, unsigned int index) {
+void * arrayList_get(array_list_pt list, unsigned int index) {
if (index >= list->size) {
return NULL;
}
@@ -154,7 +154,7 @@ void * arrayList_get(array_list_t list,
return list->elementData[index];
}
-void * arrayList_set(array_list_t list, unsigned int index, void * element) {
+void * arrayList_set(array_list_pt list, unsigned int index, void * element) {
void * oldElement;
if (index >= list->size) {
return NULL;
@@ -165,13 +165,13 @@ void * arrayList_set(array_list_t list,
return oldElement;
}
-bool arrayList_add(array_list_t list, void * element) {
+bool arrayList_add(array_list_pt list, void * element) {
arrayList_ensureCapacity(list, list->size + 1);
list->elementData[list->size++] = element;
return true;
}
-int arrayList_addIndex(array_list_t list, unsigned int index, void * element) {
+int arrayList_addIndex(array_list_pt list, unsigned int index, void * element) {
unsigned int numMoved;
if (index > list->size || index < 0) {
return -1;
@@ -185,7 +185,7 @@ int arrayList_addIndex(array_list_t list
return 0;
}
-void * arrayList_remove(array_list_t list, unsigned int index) {
+void * arrayList_remove(array_list_pt list, unsigned int index) {
void * oldElement;
unsigned int numMoved;
if (index >= list->size) {
@@ -201,7 +201,7 @@ void * arrayList_remove(array_list_t lis
return oldElement;
}
-void arrayList_fastRemove(array_list_t list, unsigned int index) {
+void arrayList_fastRemove(array_list_pt list, unsigned int index) {
unsigned int numMoved;
list->modCount++;
@@ -210,7 +210,7 @@ void arrayList_fastRemove(array_list_t l
list->elementData[--list->size] = NULL;
}
-bool arrayList_removeElement(array_list_t list, void * element) {
+bool arrayList_removeElement(array_list_pt list, void * element) {
if (element == NULL) {
unsigned int i = 0;
for (i = 0; i < list->size; i++) {
@@ -233,7 +233,7 @@ bool arrayList_removeElement(array_list_
return false;
}
-void arrayList_clear(array_list_t list) {
+void arrayList_clear(array_list_pt list) {
unsigned int i;
list->modCount++;
@@ -244,7 +244,7 @@ void arrayList_clear(array_list_t list)
list->size = 0;
}
-bool arrayList_addAll(array_list_t list, array_list_t toAdd) {
+bool arrayList_addAll(array_list_pt list, array_list_pt toAdd) {
unsigned int i;
unsigned int size = arrayList_size(toAdd);
arrayList_ensureCapacity(list, list->size + size);
@@ -256,9 +256,9 @@ bool arrayList_addAll(array_list_t list,
return size != 0;
}
-array_list_t arrayList_clone(apr_pool_t *pool, array_list_t list) {
+array_list_pt arrayList_clone(apr_pool_t *pool, array_list_pt list) {
unsigned int i;
- array_list_t new = NULL;
+ array_list_pt new = NULL;
arrayList_create(pool, &new);
// arrayList_ensureCapacity(new, list->size);
// memcpy(new->elementData, list->elementData, list->size);
@@ -271,8 +271,8 @@ array_list_t arrayList_clone(apr_pool_t
return new;
}
-array_list_iterator_t arrayListIterator_create(array_list_t list) {
- array_list_iterator_t iterator = (array_list_iterator_t) malloc(sizeof(*iterator));
+array_list_iterator_pt arrayListIterator_create(array_list_pt list) {
+ array_list_iterator_pt iterator = (array_list_iterator_pt) malloc(sizeof(*iterator));
iterator->lastReturned = -1;
iterator->cursor = 0;
@@ -282,7 +282,7 @@ array_list_iterator_t arrayListIterator_
return iterator;
}
-void arrayListIterator_destroy(array_list_iterator_t iterator) {
+void arrayListIterator_destroy(array_list_iterator_pt iterator) {
iterator->lastReturned = -1;
iterator->cursor = 0;
iterator->expectedModificationCount = 0;
@@ -291,11 +291,11 @@ void arrayListIterator_destroy(array_lis
iterator = NULL;
}
-bool arrayListIterator_hasNext(array_list_iterator_t iterator) {
+bool arrayListIterator_hasNext(array_list_iterator_pt iterator) {
return iterator->cursor != iterator->list->size;
}
-void * arrayListIterator_next(array_list_iterator_t iterator) {
+void * arrayListIterator_next(array_list_iterator_pt iterator) {
void * next;
if (iterator->expectedModificationCount != iterator->list->modCount) {
return NULL;
@@ -305,11 +305,11 @@ void * arrayListIterator_next(array_list
return next;
}
-bool arrayListIterator_hasPrevious(array_list_iterator_t iterator) {
+bool arrayListIterator_hasPrevious(array_list_iterator_pt iterator) {
return iterator->cursor != 0;
}
-void * arrayListIterator_previous(array_list_iterator_t iterator) {
+void * arrayListIterator_previous(array_list_iterator_pt iterator) {
int i;
void * previous;
if (iterator->expectedModificationCount != iterator->list->modCount) {
@@ -321,7 +321,7 @@ void * arrayListIterator_previous(array_
return previous;
}
-void arrayListIterator_remove(array_list_iterator_t iterator) {
+void arrayListIterator_remove(array_list_iterator_pt iterator) {
if (iterator->lastReturned == -1) {
return;
}
Modified: incubator/celix/trunk/utils/private/src/hash_map.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/hash_map.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/hash_map.c (original)
+++ incubator/celix/trunk/utils/private/src/hash_map.c Wed Jun 12 19:08:50 2013
@@ -46,7 +46,7 @@ int hashMap_equals(void * toCompare, voi
return toCompare == compare;
}
-int hashMap_entryEquals(hash_map_t map, hash_map_entry_t entry, hash_map_entry_t compare) {
+int hashMap_entryEquals(hash_map_pt map, hash_map_entry_pt entry, hash_map_entry_pt compare) {
if (entry->key == compare->key || map->equalsKey(entry->key, compare->key)) {
if (entry->value == compare->value || map->equalsValue(entry->value, compare->value)) {
return true;
@@ -67,11 +67,11 @@ static unsigned int hashMap_indexFor(uns
return h & (length - 1);
}
-hash_map_t hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *),
+hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *),
int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *)) {
- hash_map_t map = (hash_map_t) malloc(sizeof(*map));
+ hash_map_pt map = (hash_map_pt) malloc(sizeof(*map));
map->treshold = (int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);
- map->table = (hash_map_entry_t *) calloc(DEFAULT_INITIAL_CAPACITY, sizeof(hash_map_entry_t));
+ map->table = (hash_map_entry_pt *) calloc(DEFAULT_INITIAL_CAPACITY, sizeof(hash_map_entry_pt));
map->size = 0;
map->modificationCount = 0;
map->tablelength = DEFAULT_INITIAL_CAPACITY;
@@ -96,26 +96,26 @@ hash_map_t hashMap_create(unsigned int (
return map;
}
-void hashMap_destroy(hash_map_t map, bool freeKeys, bool freeValues) {
+void hashMap_destroy(hash_map_pt map, bool freeKeys, bool freeValues) {
hashMap_clear(map, freeKeys, freeValues);
free(map->table);
free(map);
map = NULL;
}
-int hashMap_size(hash_map_t map) {
+int hashMap_size(hash_map_pt map) {
return map->size;
}
-bool hashMap_isEmpty(hash_map_t map) {
+bool hashMap_isEmpty(hash_map_pt map) {
return hashMap_size(map) == 0;
}
-void * hashMap_get(hash_map_t map, void * key) {
+void * hashMap_get(hash_map_pt map, void * key) {
unsigned int hash;
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
if (key == NULL) {
- hash_map_entry_t entry = map->table[0];
+ hash_map_entry_pt entry = map->table[0];
for (entry = map->table[0]; entry != NULL; entry = entry->next) {
if (entry->key == NULL) {
return entry->value;
@@ -134,13 +134,13 @@ void * hashMap_get(hash_map_t map, void
return NULL;
}
-bool hashMap_containsKey(hash_map_t map, void * key) {
+bool hashMap_containsKey(hash_map_pt map, void * key) {
return hashMap_getEntry(map, key) != NULL;
}
-hash_map_entry_t hashMap_getEntry(hash_map_t map, void * key) {
+hash_map_entry_pt hashMap_getEntry(hash_map_pt map, void * key) {
unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key));
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
int index = hashMap_indexFor(hash, map->tablelength);
for (entry = map->table[index]; entry != NULL; entry = entry->next) {
if (entry->hash == hash && (entry->key == key || map->equalsKey(key, entry->key))) {
@@ -150,12 +150,12 @@ hash_map_entry_t hashMap_getEntry(hash_m
return NULL;
}
-void * hashMap_put(hash_map_t map, void * key, void * value) {
+void * hashMap_put(hash_map_pt map, void * key, void * value) {
unsigned int hash;
int i;
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
if (key == NULL) {
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
for (entry = map->table[0]; entry != NULL; entry = entry->next) {
if (entry->key == NULL) {
void * oldValue = entry->value;
@@ -182,21 +182,21 @@ void * hashMap_put(hash_map_t map, void
return NULL;
}
-void hashMap_resize(hash_map_t map, int newCapacity) {
- hash_map_entry_t * newTable;
+void hashMap_resize(hash_map_pt map, int newCapacity) {
+ hash_map_entry_pt * newTable;
unsigned int j;
if (map->tablelength == MAXIMUM_CAPACITY) {
return;
}
- newTable = (hash_map_entry_t *) calloc(newCapacity, sizeof(hash_map_entry_t));
+ newTable = (hash_map_entry_pt *) calloc(newCapacity, sizeof(hash_map_entry_pt));
for (j = 0; j < map->tablelength; j++) {
- hash_map_entry_t entry = map->table[j];
+ hash_map_entry_pt entry = map->table[j];
if (entry != NULL) {
map->table[j] = NULL;
do {
- hash_map_entry_t next = entry->next;
+ hash_map_entry_pt next = entry->next;
int i = hashMap_indexFor(entry->hash, newCapacity);
entry->next = newTable[i];
newTable[i] = entry;
@@ -210,8 +210,8 @@ void hashMap_resize(hash_map_t map, int
map->treshold = (unsigned int) ceil(newCapacity * DEFAULT_LOAD_FACTOR);
}
-void * hashMap_remove(hash_map_t map, void * key) {
- hash_map_entry_t entry = hashMap_removeEntryForKey(map, key);
+void * hashMap_remove(hash_map_pt map, void * key) {
+ hash_map_entry_pt entry = hashMap_removeEntryForKey(map, key);
void * value = (entry == NULL ? NULL : entry->value);
if (entry != NULL) {
entry->key = NULL;
@@ -222,14 +222,14 @@ void * hashMap_remove(hash_map_t map, vo
return value;
}
-void * hashMap_removeEntryForKey(hash_map_t map, void * key) {
+void * hashMap_removeEntryForKey(hash_map_pt map, void * key) {
unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key));
int i = hashMap_indexFor(hash, map->tablelength);
- hash_map_entry_t prev = map->table[i];
- hash_map_entry_t entry = prev;
+ hash_map_entry_pt prev = map->table[i];
+ hash_map_entry_pt entry = prev;
while (entry != NULL) {
- hash_map_entry_t next = entry->next;
+ hash_map_entry_pt next = entry->next;
if (entry->hash == hash && (entry->key == key || (key != NULL && map->equalsKey(key, entry->key)))) {
map->modificationCount++;
map->size--;
@@ -247,10 +247,10 @@ void * hashMap_removeEntryForKey(hash_ma
return entry;
}
-hash_map_entry_t hashMap_removeMapping(hash_map_t map, hash_map_entry_t entry) {
+hash_map_entry_pt hashMap_removeMapping(hash_map_pt map, hash_map_entry_pt entry) {
unsigned int hash;
- hash_map_entry_t prev;
- hash_map_entry_t e;
+ hash_map_entry_pt prev;
+ hash_map_entry_pt e;
int i;
if (entry == NULL) {
return NULL;
@@ -261,7 +261,7 @@ hash_map_entry_t hashMap_removeMapping(h
e = prev;
while (e != NULL) {
- hash_map_entry_t next = e->next;
+ hash_map_entry_pt next = e->next;
if (e->hash == hash && hashMap_entryEquals(map, e, entry)) {
map->modificationCount++;
map->size--;
@@ -279,16 +279,16 @@ hash_map_entry_t hashMap_removeMapping(h
return e;
}
-void hashMap_clear(hash_map_t map, bool freeKey, bool freeValue) {
+void hashMap_clear(hash_map_pt map, bool freeKey, bool freeValue) {
unsigned int i;
- hash_map_entry_t * table;
+ hash_map_entry_pt * table;
map->modificationCount++;
table = map->table;
for (i = 0; i < map->tablelength; i++) {
- hash_map_entry_t entry = table[i];
+ hash_map_entry_pt entry = table[i];
while (entry != NULL) {
- hash_map_entry_t f = entry;
+ hash_map_entry_pt f = entry;
entry = entry->next;
if (freeKey && f->key != NULL)
free(f->key);
@@ -301,11 +301,11 @@ void hashMap_clear(hash_map_t map, bool
map->size = 0;
}
-bool hashMap_containsValue(hash_map_t map, void * value) {
+bool hashMap_containsValue(hash_map_pt map, void * value) {
unsigned int i;
if (value == NULL) {
for (i = 0; i < map->tablelength; i++) {
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
for (entry = map->table[i]; entry != NULL; entry = entry->next) {
if (entry->value == NULL) {
return true;
@@ -315,7 +315,7 @@ bool hashMap_containsValue(hash_map_t ma
return false;
}
for (i = 0; i < map->tablelength; i++) {
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
for (entry = map->table[i]; entry != NULL; entry = entry->next) {
if (entry->value == value || map->equalsValue(entry->value, value)) {
return true;
@@ -325,9 +325,9 @@ bool hashMap_containsValue(hash_map_t ma
return false;
}
-void hashMap_addEntry(hash_map_t map, int hash, void * key, void * value, int bucketIndex) {
- hash_map_entry_t entry = map->table[bucketIndex];
- hash_map_entry_t new = (hash_map_entry_t) malloc(sizeof(*new));
+void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex) {
+ hash_map_entry_pt entry = map->table[bucketIndex];
+ hash_map_entry_pt new = (hash_map_entry_pt) malloc(sizeof(*new));
new->hash = hash;
new->key = key;
new->value = value;
@@ -338,8 +338,8 @@ void hashMap_addEntry(hash_map_t map, in
}
}
-hash_map_iterator_t hashMapIterator_create(hash_map_t map) {
- hash_map_iterator_t iterator = (hash_map_iterator_t) malloc(sizeof(*iterator));
+hash_map_iterator_pt hashMapIterator_create(hash_map_pt map) {
+ hash_map_iterator_pt iterator = (hash_map_iterator_pt) malloc(sizeof(*iterator));
iterator->map = map;
iterator->expectedModCount = map->modificationCount;
iterator->index = 0;
@@ -352,7 +352,7 @@ hash_map_iterator_t hashMapIterator_crea
return iterator;
}
-void hashMapIterator_destroy(hash_map_iterator_t iterator) {
+void hashMapIterator_destroy(hash_map_iterator_pt iterator) {
iterator->current = NULL;
iterator->expectedModCount = 0;
iterator->index = 0;
@@ -362,13 +362,13 @@ void hashMapIterator_destroy(hash_map_it
iterator = NULL;
}
-bool hashMapIterator_hasNext(hash_map_iterator_t iterator) {
+bool hashMapIterator_hasNext(hash_map_iterator_pt iterator) {
return iterator->next != NULL;
}
-void hashMapIterator_remove(hash_map_iterator_t iterator) {
+void hashMapIterator_remove(hash_map_iterator_pt iterator) {
void * key;
- hash_map_entry_t entry;
+ hash_map_entry_pt entry;
if (iterator->current == NULL) {
return;
}
@@ -382,8 +382,8 @@ void hashMapIterator_remove(hash_map_ite
iterator->expectedModCount = iterator->map->modificationCount;
}
-void * hashMapIterator_nextValue(hash_map_iterator_t iterator) {
- hash_map_entry_t entry;
+void * hashMapIterator_nextValue(hash_map_iterator_pt iterator) {
+ hash_map_entry_pt entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
@@ -399,8 +399,8 @@ void * hashMapIterator_nextValue(hash_ma
return entry->value;
}
-void * hashMapIterator_nextKey(hash_map_iterator_t iterator) {
- hash_map_entry_t entry;
+void * hashMapIterator_nextKey(hash_map_iterator_pt iterator) {
+ hash_map_entry_pt entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
@@ -416,8 +416,8 @@ void * hashMapIterator_nextKey(hash_map_
return entry->key;
}
-hash_map_entry_t hashMapIterator_nextEntry(hash_map_iterator_t iterator) {
- hash_map_entry_t entry;
+hash_map_entry_pt hashMapIterator_nextEntry(hash_map_iterator_pt iterator) {
+ hash_map_entry_pt entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
@@ -433,63 +433,63 @@ hash_map_entry_t hashMapIterator_nextEnt
return entry;
}
-hash_map_key_set_t hashMapKeySet_create(hash_map_t map) {
- hash_map_key_set_t keySet = (hash_map_key_set_t) malloc(sizeof(*keySet));
+hash_map_key_set_pt hashMapKeySet_create(hash_map_pt map) {
+ hash_map_key_set_pt keySet = (hash_map_key_set_pt) malloc(sizeof(*keySet));
keySet->map = map;
return keySet;
}
-int hashMapKeySet_size(hash_map_key_set_t keySet) {
+int hashMapKeySet_size(hash_map_key_set_pt keySet) {
return keySet->map->size;
}
-bool hashMapKeySet_contains(hash_map_key_set_t keySet, void * key) {
+bool hashMapKeySet_contains(hash_map_key_set_pt keySet, void * key) {
return hashMap_containsKey(keySet->map, key);
}
-bool hashMapKeySet_remove(hash_map_key_set_t keySet, void * key) {
- hash_map_entry_t entry = hashMap_removeEntryForKey(keySet->map, key);
+bool hashMapKeySet_remove(hash_map_key_set_pt keySet, void * key) {
+ hash_map_entry_pt entry = hashMap_removeEntryForKey(keySet->map, key);
bool removed = entry != NULL;
free(entry);
return removed;
}
-void hashMapKeySet_clear(hash_map_key_set_t keySet) {
+void hashMapKeySet_clear(hash_map_key_set_pt keySet) {
hashMap_clear(keySet->map, false, false);
}
-bool hashMapKeySet_isEmpty(hash_map_key_set_t keySet) {
+bool hashMapKeySet_isEmpty(hash_map_key_set_pt keySet) {
return hashMapKeySet_size(keySet) == 0;
}
-hash_map_values_t hashMapValues_create(hash_map_t map) {
- hash_map_values_t values = (hash_map_values_t) malloc(sizeof(*values));
+hash_map_values_pt hashMapValues_create(hash_map_pt map) {
+ hash_map_values_pt values = (hash_map_values_pt) malloc(sizeof(*values));
values->map = map;
return values;
}
-void hashMapValues_destroy(hash_map_values_t values) {
+void hashMapValues_destroy(hash_map_values_pt values) {
values->map = NULL;
free(values);
values = NULL;
}
-hash_map_iterator_t hashMapValues_iterator(hash_map_values_t values) {
+hash_map_iterator_pt hashMapValues_iterator(hash_map_values_pt values) {
return hashMapIterator_create(values->map);
}
-int hashMapValues_size(hash_map_values_t values) {
+int hashMapValues_size(hash_map_values_pt values) {
return values->map->size;
}
-bool hashMapValues_contains(hash_map_values_t values, void * value) {
+bool hashMapValues_contains(hash_map_values_pt values, void * value) {
return hashMap_containsValue(values->map, value);
}
-void hashMapValues_toArray(hash_map_values_t values, void* *array[], unsigned int *size) {
- hash_map_iterator_t it;
+void hashMapValues_toArray(hash_map_values_pt values, void* *array[], unsigned int *size) {
+ hash_map_iterator_pt it;
int i;
int vsize = hashMapValues_size(values);
*size = vsize;
@@ -505,8 +505,8 @@ void hashMapValues_toArray(hash_map_valu
hashMapIterator_destroy(it);
}
-bool hashMapValues_remove(hash_map_values_t values, void * value) {
- hash_map_iterator_t iterator = hashMapValues_iterator(values);
+bool hashMapValues_remove(hash_map_values_pt values, void * value) {
+ hash_map_iterator_pt iterator = hashMapValues_iterator(values);
if (value == NULL) {
while (hashMapIterator_hasNext(iterator)) {
if (hashMapIterator_nextValue(iterator) == NULL) {
@@ -525,46 +525,46 @@ bool hashMapValues_remove(hash_map_value
return false;
}
-void hashMapValues_clear(hash_map_values_t values) {
+void hashMapValues_clear(hash_map_values_pt values) {
hashMap_clear(values->map, false, false);
}
-bool hashMapValues_isEmpty(hash_map_values_t values) {
+bool hashMapValues_isEmpty(hash_map_values_pt values) {
return hashMapValues_size(values) == 0;
}
-hash_map_entry_set_t hashMapEntrySet_create(hash_map_t map) {
- hash_map_entry_set_t entrySet = (hash_map_entry_set_t) malloc(sizeof(*entrySet));
+hash_map_entry_set_pt hashMapEntrySet_create(hash_map_pt map) {
+ hash_map_entry_set_pt entrySet = (hash_map_entry_set_pt) malloc(sizeof(*entrySet));
entrySet->map = map;
return entrySet;
}
-int hashMapEntrySet_size(hash_map_entry_set_t entrySet) {
+int hashMapEntrySet_size(hash_map_entry_set_pt entrySet) {
return entrySet->map->size;
}
-bool hashMapEntrySet_contains(hash_map_entry_set_t entrySet, hash_map_entry_t entry) {
+bool hashMapEntrySet_contains(hash_map_entry_set_pt entrySet, hash_map_entry_pt entry) {
return hashMap_containsValue(entrySet->map, entry);
}
-bool hashMapEntrySet_remove(hash_map_values_t entrySet, hash_map_entry_t entry) {
+bool hashMapEntrySet_remove(hash_map_values_pt entrySet, hash_map_entry_pt entry) {
return hashMap_removeMapping(entrySet->map, entry) != NULL;
}
-void hashMapEntrySet_clear(hash_map_entry_set_t entrySet) {
+void hashMapEntrySet_clear(hash_map_entry_set_pt entrySet) {
hashMap_clear(entrySet->map, false, false);
}
-bool hashMapEntrySet_isEmpty(hash_map_entry_set_t entrySet) {
+bool hashMapEntrySet_isEmpty(hash_map_entry_set_pt entrySet) {
return hashMapEntrySet_size(entrySet) == 0;
}
-void * hashMapEntry_getKey(hash_map_entry_t entry) {
+void * hashMapEntry_getKey(hash_map_entry_pt entry) {
return entry->key;
}
-void * hashMapEntry_getValue(hash_map_entry_t entry) {
+void * hashMapEntry_getValue(hash_map_entry_pt entry) {
return entry->value;
}
Modified: incubator/celix/trunk/utils/private/src/linked_list_iterator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/linked_list_iterator.c?rev=1492377&r1=1492376&r2=1492377&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/linked_list_iterator.c (original)
+++ incubator/celix/trunk/utils/private/src/linked_list_iterator.c Wed Jun 12 19:08:50 2013
@@ -30,19 +30,19 @@
#include "linked_list_private.h"
struct linkedListIterator {
- linked_list_entry_t lastReturned;
- linked_list_entry_t next;
+ linked_list_entry_pt lastReturned;
+ linked_list_entry_pt next;
int nextIndex;
- linked_list_t list;
+ linked_list_pt list;
int expectedModificationCount;
};
-linked_list_iterator_t linkedListIterator_create(linked_list_t list, unsigned int index) {
- linked_list_iterator_t iterator;
+linked_list_iterator_pt linkedListIterator_create(linked_list_pt list, unsigned int index) {
+ linked_list_iterator_pt iterator;
if (index < 0 || index > list->size) {
return NULL;
}
- iterator = (linked_list_iterator_t) malloc(sizeof(*iterator));
+ iterator = (linked_list_iterator_pt) malloc(sizeof(*iterator));
iterator->lastReturned = list->header;
iterator->list = list;
iterator->expectedModificationCount = list->modificationCount;
@@ -60,7 +60,7 @@ linked_list_iterator_t linkedListIterato
return iterator;
}
-void linkedListIterator_destroy(linked_list_iterator_t iterator) {
+void linkedListIterator_destroy(linked_list_iterator_pt iterator) {
iterator->expectedModificationCount = 0;
iterator->lastReturned = NULL;
iterator->list = NULL;
@@ -69,11 +69,11 @@ void linkedListIterator_destroy(linked_l
free(iterator);
}
-bool linkedListIterator_hasNext(linked_list_iterator_t iterator) {
+bool linkedListIterator_hasNext(linked_list_iterator_pt iterator) {
return iterator->nextIndex != iterator->list->size;
}
-void * linkedListIterator_next(linked_list_iterator_t iterator) {
+void * linkedListIterator_next(linked_list_iterator_pt iterator) {
if (iterator->list->modificationCount != iterator->expectedModificationCount) {
return NULL;
}
@@ -86,11 +86,11 @@ void * linkedListIterator_next(linked_li
return iterator->lastReturned->element;
}
-bool linkedListIterator_hasPrevious(linked_list_iterator_t iterator) {
+bool linkedListIterator_hasPrevious(linked_list_iterator_pt iterator) {
return iterator->nextIndex != 0;
}
-void * linkedListIterator_previous(linked_list_iterator_t iterator) {
+void * linkedListIterator_previous(linked_list_iterator_pt iterator) {
if (iterator->nextIndex == 0) {
return NULL;
}
@@ -105,16 +105,16 @@ void * linkedListIterator_previous(linke
return iterator->lastReturned->element;
}
-int linkedListIterator_nextIndex(linked_list_iterator_t iterator) {
+int linkedListIterator_nextIndex(linked_list_iterator_pt iterator) {
return iterator->nextIndex;
}
-int linkedListIterator_previousIndex(linked_list_iterator_t iterator) {
+int linkedListIterator_previousIndex(linked_list_iterator_pt iterator) {
return iterator->nextIndex-1;
}
-void linkedListIterator_remove(linked_list_iterator_t iterator) {
- linked_list_entry_t lastNext;
+void linkedListIterator_remove(linked_list_iterator_pt iterator) {
+ linked_list_entry_pt lastNext;
if (iterator->list->modificationCount != iterator->expectedModificationCount) {
return;
}
@@ -131,7 +131,7 @@ void linkedListIterator_remove(linked_li
iterator->expectedModificationCount++;
}
-void linkedListIterator_set(linked_list_iterator_t iterator, void * element) {
+void linkedListIterator_set(linked_list_iterator_pt iterator, void * element) {
if (iterator->lastReturned == iterator->list->header) {
return;
}
@@ -141,7 +141,7 @@ void linkedListIterator_set(linked_list_
iterator->lastReturned->element = element;
}
-void linkedListIterator_add(linked_list_iterator_t iterator, void * element) {
+void linkedListIterator_add(linked_list_iterator_pt iterator, void * element) {
if (iterator->list->modificationCount != iterator->expectedModificationCount) {
return;
}