Specifying extern "C" at declaration in header files should be sufficient.
33 files changed:
-/* Copyright (c) 2008-2017. The SimGrid Team.
+/* Copyright (c) 2008-2018. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
"Logging specific to MC (memory)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
"Logging specific to MC (memory)");
/* Initialize the model-checker memory subsystem */
/* It creates the two heap regions: std_heap and mc_heap */
void MC_memory_init()
/* Initialize the model-checker memory subsystem */
/* It creates the two heap regions: std_heap and mc_heap */
void MC_memory_init()
if (not malloc_use_mmalloc())
xbt_die("Model-checking support is not enabled: run with simgrid-mc.");
}
if (not malloc_use_mmalloc())
xbt_die("Model-checking support is not enabled: run with simgrid-mc.");
}
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
using simgrid::mc::remote;
using simgrid::mc::remote;
/** @brief Restore a snapshot of a region
*
* If possible, the restoration will be incremental
/** @brief Restore a snapshot of a region
*
* If possible, the restoration will be incremental
mc_restore_page_snapshot_region(process,
(void*) reg->permanent_address().address(), reg->page_data());
}
mc_restore_page_snapshot_region(process,
(void*) reg->permanent_address().address(), reg->page_data());
}
#include "src/mc/mc_private.hpp"
#include "src/mc/mc_snapshot.hpp"
#include "src/mc/mc_private.hpp"
#include "src/mc/mc_snapshot.hpp"
/** @brief Find the snapshoted region from a pointer
*
* @param addr Pointer
/** @brief Find the snapshoted region from a pointer
*
* @param addr Pointer
namespace simgrid {
namespace mc {
namespace simgrid {
namespace mc {
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2018. 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. */
/* 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. */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
void MSG_action_init()
{
MSG_function_register_default(simgrid::xbt::replay_runner);
void MSG_action_init()
{
MSG_function_register_default(simgrid::xbt::replay_runner);
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2018. 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"
/* 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"
/** \ingroup msg_simulation
* \brief An application deployer.
*
/** \ingroup msg_simulation
* \brief An application deployer.
*
{
SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);
}
{
SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);
}
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2018. 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. */
/* 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 <lualib.h>
#endif
#include <lualib.h>
#endif
/********************************* MSG **************************************/
/** \ingroup msg_simulation
/********************************* MSG **************************************/
/** \ingroup msg_simulation
{
SIMIX_create_environment(file);
}
{
SIMIX_create_environment(file);
}
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2018. 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. */
/* 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. */
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
MSG_Global_t msg_global = nullptr;
static void MSG_exit();
MSG_Global_t msg_global = nullptr;
static void MSG_exit();
{
return msg_global->sent_msg;
}
{
return msg_global->sent_msg;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)");
/** \ingroup msg_task_usage
* \brief Executes a task and waits for its termination.
*
/** \ingroup msg_task_usage
* \brief Executes a task and waits for its termination.
*
{
return task->category;
}
{
return task->category;
}
#define MSG_CALL(type, oldname, args)
#define MSG_CALL(type, oldname, args)
/* ************************** Actors *************************** */
int MSG_process_get_PID(sg_actor_t actor)
{
/* ************************** Actors *************************** */
int MSG_process_get_PID(sg_actor_t actor)
{
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2008-2018. 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. */
/* 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. */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
/** \ingroup msg_mailbox_management
* \brief Set the mailbox to receive in asynchronous mode
*
/** \ingroup msg_mailbox_management
* \brief Set the mailbox to receive in asynchronous mode
*
simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self());
XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
}
simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self());
XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
/** @addtogroup m_process_management
*
* Processes (#msg_process_t) are independent agents that can do stuff on their own. They are in charge of executing
/** @addtogroup m_process_management
*
* Processes (#msg_process_t) are independent agents that can do stuff on their own. They are in charge of executing
xbt_free(argv);
return res;
}
xbt_free(argv);
return res;
}
msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
std::map<std::string, std::string>* properties)
msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
std::map<std::string, std::string>* properties)
return process->ciface();
}
return process->ciface();
}
/* Become a process in the simulation
*
* Currently this can only be called by the main thread (once) and only work with some thread factories
/* Become a process in the simulation
*
* Currently this can only be called by the main thread (once) and only work with some thread factories
{
intrusive_ptr_release(process);
}
{
intrusive_ptr_release(process);
}
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2018. 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. */
/* 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/simix/smx_private.hpp"
#include <algorithm>
#include "src/simix/smx_private.hpp"
#include <algorithm>
/** @addtogroup m_task_management
*
* Since most scheduling algorithms rely on a concept of task that can be either <em>computed</em> locally or
/** @addtogroup m_task_management
*
* Since most scheduling algorithms rely on a concept of task that can be either <em>computed</em> locally or
if (task->simdata->compute)
simcall_execution_set_bound(task->simdata->compute, task->simdata->bound);
}
if (task->simdata->compute)
simcall_execution_set_bound(task->simdata->compute, task->simdata->bound);
}
}
/* **************************** Public interface *************************** */
}
/* **************************** Public interface *************************** */
void sg_storage_file_system_init()
{
if (not FileSystemStorageExt::EXTENSION_ID.valid()) {
void sg_storage_file_system_init()
{
if (not FileSystemStorageExt::EXTENSION_ID.valid()) {
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2018. 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. */
/* 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. */
static void onVirtualMachineShutdown(simgrid::s4u::VirtualMachine* vm)
{
if (vm->getImpl()->isMigrating) {
static void onVirtualMachineShutdown(simgrid::s4u::VirtualMachine* vm)
{
if (vm->getImpl()->isMigrating) {
vm->getImpl()->isMigrating = false;
}
vm->getImpl()->isMigrating = false;
}
/* **************************** Public C interface *************************** */
/* **************************** Public C interface *************************** */
/** @brief Create a new VM object with the default parameters
* A VM is treated as a host. The name of the VM must be unique among all hosts.
*/
/** @brief Create a new VM object with the default parameters
* A VM is treated as a host. The name of the VM must be unique among all hosts.
*/
} // namespace simgrid
/* **************************** Public C interface *************************** */
} // namespace simgrid
/* **************************** Public C interface *************************** */
/** \ingroup m_actor_management
* \brief Returns the process ID of \a actor.
*
/** \ingroup m_actor_management
* \brief Returns the process ID of \a actor.
*
{
actor->setKillTime(kill_time);
}
{
actor->setKillTime(kill_time);
}
const char* sg_link_name(sg_link_t link)
{
return link->getCname();
const char* sg_link_name(sg_link_t link)
{
return link->getCname();
{
simgrid::surf::LinkImpl::linksExit();
}
{
simgrid::surf::LinkImpl::linksExit();
}
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2018. 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. */
/* 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. */
} // namespace simgrid
/* **************************** Public C interface *************************** */
} // namespace simgrid
/* **************************** Public C interface *************************** */
sg_netzone_t sg_zone_get_root()
{
return simgrid::s4u::Engine::getInstance()->getNetRoot();
sg_netzone_t sg_zone_get_root()
{
return simgrid::s4u::Engine::getInstance()->getNetRoot();
for (auto const& host : hosts)
xbt_dynar_push(whereto, &host);
}
for (auto const& host : hosts)
xbt_dynar_push(whereto, &host);
}
} /* namespace simgrid */
/* **************************** Public C interface *************************** */
} /* namespace simgrid */
/* **************************** Public C interface *************************** */
/** @addtogroup sg_storage_management
* (#sg_storage_t) and the functions for managing it.
*/
/** @addtogroup sg_storage_management
* (#sg_storage_t) and the functions for managing it.
*/
{
return storage->write(size);
}
{
return storage->write(size);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
#include "dax_dtd.h"
#include "dax_dtd.c"
#include "dax_dtd.h"
#include "dax_dtd.c"
/* Ensure that transfer tasks have unique names even though a file is used several times */
void uniq_transfer_task_name(SD_task_t task)
/* Ensure that transfer tasks have unique names even though a file is used several times */
void uniq_transfer_task_name(SD_task_t task)
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
size_t sg_host_count()
{
return simgrid::s4u::Engine::getInstance()->getHostCount();
size_t sg_host_count()
{
return simgrid::s4u::Engine::getInstance()->getHostCount();
smx_actor_t process = SIMIX_process_self();
return (process == nullptr) ? nullptr : process->host;
}
smx_actor_t process = SIMIX_process_self();
return (process == nullptr) ? nullptr : process->host;
}
* \param properties the properties of the process
* \param auto_restart either it is autorestarting or not.
*/
* \param properties the properties of the process
* \param auto_restart either it is autorestarting or not.
*/
-extern "C" smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host,
- int argc, char** argv, std::map<std::string, std::string>* properties)
+smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc,
+ char** argv, std::map<std::string, std::string>* properties)
{
if (name == nullptr)
name = "";
{
if (name == nullptr)
name = "";
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017, 2018. 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. */
/* 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. */
vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->untrack(exec);
}
vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->untrack(exec);
}
void sg_vm_dirty_page_tracking_init()
{
if (not simgrid::vm::VmDirtyPageTrackingExt::EXTENSION_ID.valid()) {
void sg_vm_dirty_page_tracking_init()
{
if (not simgrid::vm::VmDirtyPageTrackingExt::EXTENSION_ID.valid()) {
{
return vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->getMaxDowntime();
}
{
return vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->getMaxDowntime();
}
}
/* **************************** Public interface *************************** */
}
/* **************************** Public interface *************************** */
/** \ingroup SURF_plugin_load
* \brief Initializes the HostDvfs plugin
/** \ingroup SURF_plugin_load
* \brief Initializes the HostDvfs plugin
xbt_cfg_register_string(property_governor, "performance", nullptr,
"Which Governor should be used that adapts the CPU frequency?");
}
xbt_cfg_register_string(property_governor, "performance", nullptr,
"Which Governor should be used that adapts the CPU frequency?");
}
}
/* **************************** Public interface *************************** */
}
/* **************************** Public interface *************************** */
/** \ingroup plugin_energy
* \brief Enable host energy plugin
/** \ingroup plugin_energy
* \brief Enable host energy plugin
"The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getCurrentWattsValue();
}
"The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getCurrentWattsValue();
}
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2018. 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. */
/* 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. */
}
/* **************************** Public interface *************************** */
}
/* **************************** Public interface *************************** */
/** \ingroup plugin_load
* \brief Initializes the HostLoad plugin
/** \ingroup plugin_load
* \brief Initializes the HostLoad plugin
host->extension<HostLoad>()->reset();
}
host->extension<HostLoad>()->reset();
}
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017, 2018. 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. */
/* 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. */
XBT_INFO("Total energy over all links: %f", total_energy);
}
/* **************************** Public interface *************************** */
XBT_INFO("Total energy over all links: %f", total_energy);
}
/* **************************** Public interface *************************** */
int sg_link_energy_is_inited()
{
return LinkEnergy::EXTENSION_ID.valid();
int sg_link_energy_is_inited()
{
return LinkEnergy::EXTENSION_ID.valid();
{
return link->extension<LinkEnergy>()->getConsumedEnergy();
}
{
return link->extension<LinkEnergy>()->getConsumedEnergy();
}
#include "src/surf/xml/platf_private.hpp"
#if SIMGRID_HAVE_LUA
#include "src/surf/xml/platf_private.hpp"
#if SIMGRID_HAVE_LUA
#include "src/bindings/lua/simgrid_lua.hpp"
#include <lua.h> /* Always include this when calling Lua */
#include <lauxlib.h> /* Always include this when calling Lua */
#include <lualib.h> /* Prototype for luaL_openlibs(), */
#include "src/bindings/lua/simgrid_lua.hpp"
#include <lua.h> /* Always include this when calling Lua */
#include <lauxlib.h> /* Always include this when calling Lua */
#include <lualib.h> /* Prototype for luaL_openlibs(), */
#endif
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
#endif
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_bw;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_bw;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
{
xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
{
xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
if (parse_status)
surf_parse_error(std::string("Parse error in ") + file);
}
if (parse_status)
surf_parse_error(std::string("Parse error in ") + file);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
#include "simgrid_dtd.c"
static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
#include "simgrid_dtd.c"
static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
{
static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
{
static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
{
return surf_parse_lex();
}
{
return surf_parse_lex();
}
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2005-2018. 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. */
/* 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/internal_config.h"
#include "src/internal_config.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
static bool startWith(std::string str, const char* prefix)
{
return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
static bool startWith(std::string str, const char* prefix)
{
return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
memcpy(dst, elm, dynar->elmsize);
}
memcpy(dst, elm, dynar->elmsize);
}
-extern "C" void xbt_dynar_dump(xbt_dynar_t dynar)
+void xbt_dynar_dump(xbt_dynar_t dynar)
{
XBT_INFO("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
dynar->size, dynar->used, dynar->elmsize, dynar->data, dynar->free_f);
{
XBT_INFO("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
dynar->size, dynar->used, dynar->elmsize, dynar->data, dynar->free_f);
* Creates a new dynar. If a free_func is provided, the elements have to be pointer of pointer. That is to say that
* dynars can contain either base types (int, char, double, etc) or pointer of pointers (struct **).
*/
* Creates a new dynar. If a free_func is provided, the elements have to be pointer of pointer. That is to say that
* dynars can contain either base types (int, char, double, etc) or pointer of pointers (struct **).
*/
-extern "C" xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
+xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
{
xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
{
xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
/** @brief Initialize a dynar structure that was not malloc'ed
* This can be useful to keep temporary dynars on the stack
*/
/** @brief Initialize a dynar structure that was not malloc'ed
* This can be useful to keep temporary dynars on the stack
*/
-extern "C" void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
+void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
{
dynar->size = 0;
dynar->used = 0;
{
dynar->size = 0;
dynar->used = 0;
}
/** @brief Destroy a dynar that was created with xbt_dynar_init */
}
/** @brief Destroy a dynar that was created with xbt_dynar_init */
-extern "C" void xbt_dynar_free_data(xbt_dynar_t dynar)
+void xbt_dynar_free_data(xbt_dynar_t dynar)
{
xbt_dynar_reset(dynar);
if (dynar)
{
xbt_dynar_reset(dynar);
if (dynar)
* kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content is not touched (the \a free_f function
* is not used)
*/
* kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content is not touched (the \a free_f function
* is not used)
*/
-extern "C" void xbt_dynar_free_container(xbt_dynar_t* dynar)
+void xbt_dynar_free_container(xbt_dynar_t* dynar)
{
if (dynar && *dynar) {
xbt_dynar_t d = *dynar;
{
if (dynar && *dynar) {
xbt_dynar_t d = *dynar;
*
* \param dynar who to squeeze
*/
*
* \param dynar who to squeeze
*/
-extern "C" void xbt_dynar_reset(xbt_dynar_t const dynar)
+void xbt_dynar_reset(xbt_dynar_t const dynar)
{
_sanity_check_dynar(dynar);
{
_sanity_check_dynar(dynar);
* \param d1 dynar to keep
* \param d2 dynar to merge into d1. This dynar is free at end.
*/
* \param d1 dynar to keep
* \param d2 dynar to merge into d1. This dynar is free at end.
*/
-extern "C" void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
+void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
{
if((*d1)->elmsize != (*d2)->elmsize)
xbt_die("Element size must are not equal");
{
if((*d1)->elmsize != (*d2)->elmsize)
xbt_die("Element size must are not equal");
* Set \a empty_slots_wanted to zero to reduce the dynar internal array as much as possible.
* Note that if \a empty_slots_wanted is greater than the array size, the internal array is expanded instead of shrunk.
*/
* Set \a empty_slots_wanted to zero to reduce the dynar internal array as much as possible.
* Note that if \a empty_slots_wanted is greater than the array size, the internal array is expanded instead of shrunk.
*/
-extern "C" void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
+void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
{
_xbt_dynar_resize(dynar, dynar->used + empty_slots_wanted);
}
{
_xbt_dynar_resize(dynar, dynar->used + empty_slots_wanted);
}
*
* kilkil a dynar and its content
*/
*
* kilkil a dynar and its content
*/
-extern "C" void xbt_dynar_free(xbt_dynar_t* dynar)
+void xbt_dynar_free(xbt_dynar_t* dynar)
{
if (dynar && *dynar) {
xbt_dynar_reset(*dynar);
{
if (dynar && *dynar) {
xbt_dynar_reset(*dynar);
}
/** \brief free a dynar passed as void* (handy to store dynar in dynars or dict) */
}
/** \brief free a dynar passed as void* (handy to store dynar in dynars or dict) */
-extern "C" void xbt_dynar_free_voidp(void* d)
+void xbt_dynar_free_voidp(void* d)
{
xbt_dynar_t dynar = (xbt_dynar_t)d;
xbt_dynar_free(&dynar);
{
xbt_dynar_t dynar = (xbt_dynar_t)d;
xbt_dynar_free(&dynar);
*
* \param dynar the dynar we want to mesure
*/
*
* \param dynar the dynar we want to mesure
*/
-extern "C" unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
+unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
{
return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
}
{
return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
}
*
*\param dynar the dynat we want to check
*/
*
*\param dynar the dynat we want to check
*/
-extern "C" int xbt_dynar_is_empty(const xbt_dynar_t dynar)
+int xbt_dynar_is_empty(const xbt_dynar_t dynar)
{
return (xbt_dynar_length(dynar) == 0);
}
{
return (xbt_dynar_length(dynar) == 0);
}
* \param idx index of the slot we want to retrieve
* \param[out] dst where to put the result to.
*/
* \param idx index of the slot we want to retrieve
* \param[out] dst where to put the result to.
*/
-extern "C" void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
+void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
{
_sanity_check_dynar(dynar);
_check_inbound_idx(dynar, idx);
{
_sanity_check_dynar(dynar);
_check_inbound_idx(dynar, idx);
* \warning The returned value is the actual content of the dynar.
* Make a copy before fooling with it.
*/
* \warning The returned value is the actual content of the dynar.
* Make a copy before fooling with it.
*/
-extern "C" void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
{
void *res;
_sanity_check_dynar(dynar);
{
void *res;
_sanity_check_dynar(dynar);
-extern "C" void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
{
_sanity_check_dynar(dynar);
{
_sanity_check_dynar(dynar);
*
* If you want to free the previous content, use xbt_dynar_replace().
*/
*
* If you want to free the previous content, use xbt_dynar_replace().
*/
-extern "C" void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
+void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
{
memcpy(xbt_dynar_set_at_ptr(dynar, idx), src, dynar->elmsize);
}
{
memcpy(xbt_dynar_set_at_ptr(dynar, idx), src, dynar->elmsize);
}
* Set the Nth element of a dynar, expanding the dynar if needed, AND DO free the previous value at this position. If
* you don't want to free the previous content, use xbt_dynar_set().
*/
* Set the Nth element of a dynar, expanding the dynar if needed, AND DO free the previous value at this position. If
* you don't want to free the previous content, use xbt_dynar_set().
*/
-extern "C" void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
+void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
{
_sanity_check_dynar(dynar);
{
_sanity_check_dynar(dynar);
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_insert_at_as() does.
*/
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_insert_at_as() does.
*/
-extern "C" void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
+void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
{
void *res;
unsigned long old_used;
{
void *res;
unsigned long old_used;
* Set the Nth element of a dynar, expanding the dynar if needed, and moving the previously existing value and all
* subsequent ones to one position right in the dynar.
*/
* Set the Nth element of a dynar, expanding the dynar if needed, and moving the previously existing value and all
* subsequent ones to one position right in the dynar.
*/
-extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
+void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
{
/* checks done in xbt_dynar_insert_at_ptr */
memcpy(xbt_dynar_insert_at_ptr(dynar, idx), src, dynar->elmsize);
{
/* checks done in xbt_dynar_insert_at_ptr */
memcpy(xbt_dynar_insert_at_ptr(dynar, idx), src, dynar->elmsize);
* If the object argument of this function is a non-null pointer, the removed element is copied to this address. If not,
* the element is freed using the free_f function passed at dynar creation.
*/
* If the object argument of this function is a non-null pointer, the removed element is copied to this address. If not,
* the element is freed using the free_f function passed at dynar creation.
*/
-extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
+void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
{
_sanity_check_dynar(dynar);
_check_inbound_idx(dynar, idx);
{
_sanity_check_dynar(dynar);
_check_inbound_idx(dynar, idx);
*
* Each of the removed elements is freed using the free_f function passed at dynar creation.
*/
*
* Each of the removed elements is freed using the free_f function passed at dynar creation.
*/
-extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
+void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
* Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use
* #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found.
*/
* Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use
* #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found.
*/
-extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
+unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
* Note that usually, the dynar indices are unsigned integers. If you have more than 2 million elements in your dynar,
* this very function will not work (but the other will).
*/
* Note that usually, the dynar indices are unsigned integers. If you have more than 2 million elements in your dynar,
* this very function will not work (but the other will).
*/
-extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
+signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
* Beware that if your dynar contains pointed values (such as strings) instead of scalar, this function is probably not
* what you want. Check the documentation of xbt_dynar_search() for more info.
*/
* Beware that if your dynar contains pointed values (such as strings) instead of scalar, this function is probably not
* what you want. Check the documentation of xbt_dynar_search() for more info.
*/
-extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
+int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_push_as() does.
*/
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_push_as() does.
*/
-extern "C" void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
{
return xbt_dynar_insert_at_ptr(dynar, dynar->used);
}
/** @brief Add an element at the end of the dynar */
{
return xbt_dynar_insert_at_ptr(dynar, dynar->used);
}
/** @brief Add an element at the end of the dynar */
-extern "C" void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
{
/* checks done in xbt_dynar_insert_at_ptr */
memcpy(xbt_dynar_insert_at_ptr(dynar, dynar->used), src, dynar->elmsize);
{
/* checks done in xbt_dynar_insert_at_ptr */
memcpy(xbt_dynar_insert_at_ptr(dynar, dynar->used), src, dynar->elmsize);
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_pop_as() does.
*/
* You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
* xbt_dynar_pop_as() does.
*/
-extern "C" void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
{
_check_populated_dynar(dynar);
XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
{
_check_populated_dynar(dynar);
XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
}
/** @brief Get and remove the last element of the dynar */
}
/** @brief Get and remove the last element of the dynar */
-extern "C" void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
{
/* sanity checks done by remove_at */
XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
{
/* sanity checks done by remove_at */
XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
*
* This is less efficient than xbt_dynar_push()
*/
*
* This is less efficient than xbt_dynar_push()
*/
-extern "C" void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
{
/* sanity checks done by insert_at */
xbt_dynar_insert_at(dynar, 0, src);
{
/* sanity checks done by insert_at */
xbt_dynar_insert_at(dynar, 0, src);
*
* This is less efficient than xbt_dynar_pop()
*/
*
* This is less efficient than xbt_dynar_pop()
*/
-extern "C" void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
{
/* sanity checks done by remove_at */
xbt_dynar_remove_at(dynar, 0, dst);
{
/* sanity checks done by remove_at */
xbt_dynar_remove_at(dynar, 0, dst);
*
* The mapped function may change the value of the element itself, but should not mess with the structure of the dynar.
*/
*
* The mapped function may change the value of the element itself, but should not mess with the structure of the dynar.
*/
-extern "C" void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
+void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
{
char *const data = (char *) dynar->data;
const unsigned long elmsize = dynar->elmsize;
{
char *const data = (char *) dynar->data;
const unsigned long elmsize = dynar->elmsize;
*
* This function can be used while traversing without problem.
*/
*
* This function can be used while traversing without problem.
*/
-extern "C" void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
{
xbt_dynar_remove_at(dynar, *cursor, nullptr);
*cursor -= 1;
{
xbt_dynar_remove_at(dynar, *cursor, nullptr);
*cursor -= 1;
* \param dynar the dynar to sort
* \param compar_fn comparison function of type (int (compar_fn*) (const void*) (const void*)).
*/
* \param dynar the dynar to sort
* \param compar_fn comparison function of type (int (compar_fn*) (const void*) (const void*)).
*/
-extern "C" void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
+void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
{
if (dynar->data != nullptr)
qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
{
if (dynar->data != nullptr)
qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
}
/** @brief Sorts a dynar of strings (ie, char* data) */
}
/** @brief Sorts a dynar of strings (ie, char* data) */
-extern "C" xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
+xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
{
xbt_dynar_sort(dynar, strcmp_voidp);
return dynar; // to enable functional uses
{
xbt_dynar_sort(dynar, strcmp_voidp);
return dynar; // to enable functional uses
*
* Note: The dynar won't be usable afterwards.
*/
*
* Note: The dynar won't be usable afterwards.
*/
-extern "C" void* xbt_dynar_to_array(xbt_dynar_t dynar)
+void* xbt_dynar_to_array(xbt_dynar_t dynar)
{
void *res;
xbt_dynar_shrink(dynar, 1);
{
void *res;
xbt_dynar_shrink(dynar, 1);
* considered equal, and a value different of zero when they are considered different. Finally, d2 is destroyed
* afterwards.
*/
* considered equal, and a value different of zero when they are considered different. Finally, d2 is destroyed
* afterwards.
*/
-extern "C" int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
+int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
#include <xbt/log.h>
#include <xbt/log.hpp>
#include <xbt/log.h>
#include <xbt/log.hpp>
XBT_LOG_EXTERNAL_CATEGORY(xbt);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
XBT_LOG_EXTERNAL_CATEGORY(xbt);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
namespace simgrid {
namespace xbt {
namespace simgrid {
namespace xbt {
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2008-2018. 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. */
/* 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 "memory_map.hpp"
#include "memory_map.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_memory_map, xbt, "Logging specific to algorithms for memory_map");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_memory_map, xbt, "Logging specific to algorithms for memory_map");
namespace simgrid {
namespace xbt {
namespace simgrid {
namespace xbt {