From: Martin Quinson Date: Thu, 22 Mar 2018 12:39:29 +0000 (+0100) Subject: old school legacy wrappers for MSG X-Git-Tag: v3.19.1~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6a17d773484b05eb5d041babda0b346350b9ae72?hp=d5b7ff90d7fb09a74c1bec86ec941d5c29e5226c old school legacy wrappers for MSG --- diff --git a/include/simgrid/storage.h b/include/simgrid/storage.h index 83cfd57254..01a58ee275 100644 --- a/include/simgrid/storage.h +++ b/include/simgrid/storage.h @@ -17,7 +17,7 @@ SG_BEGIN_DECL() XBT_PUBLIC const char* sg_storage_get_name(sg_storage_t storage); XBT_PUBLIC sg_storage_t sg_storage_get_by_name(const char* name); XBT_PUBLIC xbt_dict_t sg_storage_get_properties(sg_storage_t storage); -XBT_PUBLIC void sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value); +XBT_PUBLIC void sg_storage_set_property_value(sg_storage_t storage, const char* name, const char* value); XBT_PUBLIC const char* sg_storage_get_property_value(sg_storage_t storage, const char* name); XBT_PUBLIC xbt_dynar_t sg_storages_as_dynar(); XBT_PUBLIC void sg_storage_set_data(sg_storage_t host, void* data); diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp new file mode 100644 index 0000000000..dff8872692 --- /dev/null +++ b/src/msg/msg_legacy.cpp @@ -0,0 +1,231 @@ +/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "src/msg/msg_private.hpp" + +#define MSG_CALL(type, oldname, args) + +extern "C" { + +/* ************************** Actors *************************** */ +int MSG_process_get_PID(sg_actor_t actor) +{ + return sg_actor_get_PID(actor); +} +int MSG_process_get_PPID(sg_actor_t actor) +{ + return sg_actor_get_PPID(actor); +} +const char* MSG_process_get_name(sg_actor_t actor) +{ + return sg_actor_get_name(actor); +} +sg_host_t MSG_process_get_host(sg_actor_t actor) +{ + return sg_actor_get_host(actor); +} +xbt_dict_t MSG_process_get_properties(sg_actor_t actor) +{ + return sg_actor_get_properties(actor); +} +const char* MSG_process_get_property_value(sg_actor_t actor, const char* name) +{ + return sg_actor_get_property_value(actor, name); +} +void MSG_process_suspend(sg_actor_t actor) +{ + sg_actor_suspend(actor); +} +void MSG_process_resume(sg_actor_t actor) +{ + sg_actor_resume(actor); +} +int MSG_process_is_suspended(sg_actor_t actor) +{ + return sg_actor_is_suspended(actor); +} +void MSG_process_restart(sg_actor_t actor) +{ + sg_actor_restart(actor); +} +void MSG_process_daemonize(sg_actor_t actor) +{ + sg_actor_daemonize(actor); +} + +/* ************************** NetZones *************************** */ +sg_netzone_t MSG_zone_get_root() +{ + return sg_zone_get_root(); +} +const char* MSG_zone_get_name(sg_netzone_t zone) +{ + return sg_zone_get_name(zone); +} +sg_netzone_t MSG_zone_get_by_name(const char* name) +{ + return sg_zone_get_by_name(name); +} +void MSG_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto) +{ + return sg_zone_get_sons(zone, whereto); +} +const char* MSG_zone_get_property_value(sg_netzone_t zone, const char* name) +{ + return sg_zone_get_property_value(zone, name); +} +void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, char* value) +{ + sg_zone_set_property_value(zone, name, value); +} +void MSG_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto) +{ + sg_zone_get_hosts(zone, whereto); +} + +/* ************************** Storages *************************** */ +const char* MSG_storage_get_name(sg_storage_t storage) +{ + return sg_storage_get_name(storage); +} +sg_storage_t MSG_storage_get_by_name(const char* name) +{ + return sg_storage_get_by_name(name); +} +xbt_dict_t MSG_storage_get_properties(sg_storage_t storage) +{ + return sg_storage_get_properties(storage); +} +void MSG_storage_set_property_value(sg_storage_t storage, const char* name, const char* value) +{ + sg_storage_set_property_value(storage, name, value); +} +const char* MSG_storage_get_property_value(sg_storage_t storage, const char* name) +{ + return sg_storage_get_property_value(storage, name); +} +xbt_dynar_t MSG_storages_as_dynar() +{ + return sg_storages_as_dynar(); +} +void MSG_storage_set_data(sg_storage_t storage, void* data) +{ + sg_storage_set_data(storage, data); +} +void* MSG_storage_get_data(sg_storage_t storage) +{ + return sg_storage_get_data(storage); +} +const char* MSG_storage_get_host(sg_storage_t storage) +{ + return sg_storage_get_host(storage); +} +sg_size_t MSG_storage_read(sg_storage_t storage, sg_size_t size) +{ + return sg_storage_read(storage, size); +} +sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size) +{ + return sg_storage_write(storage, size); +} + +/* ************************** hosts *************************** */ +xbt_dynar_t MSG_hosts_as_dynar() +{ + return sg_hosts_as_dynar(); +} +size_t MSG_get_host_number() +{ + return sg_host_count(); +} +sg_host_t MSG_get_host_by_name(const char* name) +{ + return sg_host_by_name(name); +} +sg_host_t MSG_host_by_name(const char* name) +{ + return sg_host_by_name(name); +} +const char* MSG_host_get_name(sg_host_t host) +{ + return sg_host_get_name(host); +} +void* MSG_host_get_data(sg_host_t host) +{ + return sg_host_user(host); +} +void MSG_host_set_data(sg_host_t host, void* data) +{ + return sg_host_user_set(host, data); +} +xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host) +{ + return sg_host_get_mounted_storage_list(host); +} +xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host) +{ + return sg_host_get_attached_storage_list(host); +} +double MSG_host_get_speed(sg_host_t host) +{ + return sg_host_speed(host); +} +double MSG_host_get_power_peak_at(sg_host_t host, int pstate_index) +{ + return sg_host_get_pstate_speed(host, pstate_index); +} +int MSG_host_get_core_number(sg_host_t host) +{ + return sg_host_core_count(host); +} +int MSG_host_get_nb_pstates(sg_host_t host) +{ + return sg_host_get_nb_pstates(host); +} +int MSG_host_get_pstate(sg_host_t host) +{ + return sg_host_get_pstate(host); +} +void MSG_host_set_pstate(sg_host_t host, int pstate) +{ + sg_host_set_pstate(host, pstate); +} +void MSG_host_on(sg_host_t h) +{ + sg_host_turn_on(h); +} +void MSG_host_off(sg_host_t h) +{ + sg_host_turn_off(h); +} +int MSG_host_is_on(sg_host_t h) +{ + return sg_host_is_on(h); +} +int MSG_host_is_off(sg_host_t h) +{ + return sg_host_is_off(h); +} +xbt_dict_t MSG_host_get_properties(sg_host_t host) +{ + return sg_host_get_properties(host); +} +const char* MSG_host_get_property_value(sg_host_t host, const char* name) +{ + return sg_host_get_property_value(host, name); +} +void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value) +{ + sg_host_set_property_value(host, name, value); +} +void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto) +{ + sg_host_get_actor_list(host, whereto); +} +sg_host_t MSG_host_self() +{ + return sg_host_self(); +} +} diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index abb52ceacf..d7e0afc1b8 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -526,17 +526,4 @@ void sg_actor_daemonize(sg_actor_t actor) actor->daemonize(); } -/* ************************** Backward ABI compatibility *************************** */ -int MSG_process_get_PID(sg_actor_t actor) __attribute__((alias("sg_actor_get_PID"))); -int MSG_process_get_PPID(sg_actor_t actor) __attribute__((alias("sg_actor_get_PPID"))); -const char* MSG_process_get_name(sg_actor_t actor) __attribute__((alias("sg_actor_get_name"))); -sg_host_t MSG_process_get_host(sg_actor_t actor) __attribute__((alias("sg_actor_get_host"))); -xbt_dict_t MSG_process_get_properties(sg_actor_t actor) __attribute__((alias("sg_actor_get_properties"))); -const char* MSG_process_get_property_value(sg_actor_t actor, const char* name) - __attribute__((alias("sg_actor_get_property_value"))); -void MSG_process_suspend(sg_actor_t actor) __attribute__((alias("sg_actor_suspend"))); -void MSG_process_resume(sg_actor_t actor) __attribute__((alias("sg_actor_resume"))); -int MSG_process_is_suspended(sg_actor_t actor) __attribute__((alias("sg_actor_is_suspended"))); -void MSG_process_restart(sg_actor_t actor) __attribute__((alias("sg_actor_restart"))); -void MSG_process_daemonize(sg_actor_t actor) __attribute__((alias("sg_actor_daemonize"))); SG_END_DECL() diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index b526fbf62a..b17967db20 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -156,22 +156,4 @@ void sg_zone_get_hosts(sg_netzone_t netzone, xbt_dynar_t whereto) xbt_dynar_push(whereto, &host); } -/* ************************** Backward ABI compatibility *************************** */ -sg_netzone_t MSG_zone_get_root() __attribute__((alias("sg_zone_get_root"))); -; -const char* MSG_zone_get_name(sg_netzone_t zone) __attribute__((alias("sg_zone_get_name"))); -; -sg_netzone_t MSG_zone_get_by_name(const char* name) __attribute__((alias("sg_zone_get_by_name"))); -; -void MSG_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto) __attribute__((alias("sg_zone_get_sons"))); -; -const char* MSG_zone_get_property_value(sg_netzone_t zone, const char* name) - __attribute__((alias("sg_zone_get_property_value"))); -; -void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, char* value) - __attribute__((alias("sg_zone_set_property_value"))); -; -void MSG_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto) __attribute__((alias("sg_zone_get_hosts"))); -; - SG_END_DECL() diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index f08f242214..5279b41205 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -143,7 +143,7 @@ xbt_dict_t sg_storage_get_properties(sg_storage_t storage) * \param name a property name * \param value what to change the property to */ -void sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value) +void sg_storage_set_property_value(sg_storage_t storage, const char* name, const char* value) { storage->setProperty(name, value); } @@ -203,19 +203,4 @@ sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size) return storage->write(size); } -/* ************************** Backward ABI compatibility *************************** */ -const char* MSG_storage_get_name(sg_storage_t storage) __attribute__((alias("sg_storage_get_name"))); -sg_storage_t MSG_storage_get_by_name(const char* name) __attribute__((alias("sg_storage_get_by_name"))); -xbt_dict_t MSG_storage_get_properties(sg_storage_t storage) __attribute__((alias("sg_storage_get_properties"))); -void MSG_storage_set_property_value(sg_storage_t storage, const char* name, const char* value) - __attribute__((alias("sg_storage_set_property_value"))); -const char* MSG_storage_get_property_value(sg_storage_t storage, const char* name) - __attribute__((alias("sg_storage_get_property_value"))); -xbt_dynar_t MSG_storages_as_dynar() __attribute__((alias("sg_storages_as_dynar"))); -void MSG_storage_set_data(sg_storage_t storage, void* data) __attribute__((alias("sg_storage_set_data"))); -void* MSG_storage_get_data(sg_storage_t storage) __attribute__((alias("sg_storage_get_data"))); -const char* MSG_storage_get_host(sg_storage_t storage) __attribute__((alias("sg_storage_get_host"))); -sg_size_t MSG_storage_read(sg_storage_t storage, sg_size_t size) __attribute__((alias("sg_storage_read"))); -sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size) __attribute__((alias("sg_storage_write"))); - SG_END_DECL() diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index a663adda6f..0ee923f7bf 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -339,35 +339,4 @@ sg_host_t sg_host_self() return (process == nullptr) ? nullptr : process->host; } -/* ************************** Backward ABI compatibility *************************** */ -xbt_dynar_t MSG_hosts_as_dynar() __attribute__((alias("sg_hosts_as_dynar"))); - -size_t MSG_get_host_number() __attribute__((alias("sg_host_count"))); -sg_host_t MSG_get_host_by_name(const char* name) __attribute__((alias("sg_host_by_name"))); -sg_host_t MSG_host_by_name(const char* name) __attribute__((alias("sg_host_by_name"))); - -const char* MSG_host_get_name(sg_host_t host) __attribute__((alias("sg_host_get_name"))); -void* MSG_host_get_data(sg_host_t host) __attribute__((alias("sg_host_user"))); -void MSG_host_set_data(sg_host_t host, void* data) __attribute__((alias("sg_host_user_set"))); -xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host) __attribute__((alias("sg_host_get_mounted_storage_list"))); -xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host) - __attribute__((alias("sg_host_get_attached_storage_list"))); -double MSG_host_get_speed(sg_host_t host) __attribute__((alias("sg_host_speed"))); -double MSG_host_get_power_peak_at(sg_host_t host, int pstate_index) __attribute__((alias("sg_host_get_pstate_speed"))); -int MSG_host_get_core_number(sg_host_t host) __attribute__((alias("sg_host_core_count"))); -int MSG_host_get_nb_pstates(sg_host_t host) __attribute__((alias("sg_host_get_nb_pstates"))); -int MSG_host_get_pstate(sg_host_t host) __attribute__((alias("sg_host_get_pstate"))); -void MSG_host_set_pstate(sg_host_t host, int pstate) __attribute__((alias("sg_host_set_pstate"))); -void MSG_host_on(sg_host_t h) __attribute__((alias("sg_host_turn_on"))); -void MSG_host_off(sg_host_t h) __attribute__((alias("sg_host_turn_off"))); -int MSG_host_is_on(sg_host_t h) __attribute__((alias("sg_host_is_on"))); -int MSG_host_is_off(sg_host_t h) __attribute__((alias("sg_host_is_off"))); -xbt_dict_t MSG_host_get_properties(sg_host_t host) __attribute__((alias("sg_host_get_properties"))); -const char* MSG_host_get_property_value(sg_host_t host, const char* name) - __attribute__((alias("sg_host_get_property_value"))); -void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value) - __attribute__((alias("sg_host_set_property_value"))); -void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto) __attribute__((alias("sg_host_get_actor_list"))); -sg_host_t MSG_host_self() __attribute__((alias("sg_host_self"))); - } // extern "C" diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 1138002e2f..2c020f2c40 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -447,6 +447,7 @@ set(MSG_SRC src/msg/msg_environment.cpp src/msg/msg_global.cpp src/msg/msg_gos.cpp + src/msg/msg_legacy.cpp src/msg/msg_mailbox.cpp src/msg/msg_process.cpp src/msg/msg_synchro.cpp