summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5a275f1)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5004
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
41 files changed:
-# From configure.ac Revision: 4930 .
+# From configure.ac Revision: 4976 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for simgrid 3.3-svn.
#
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for simgrid 3.3-svn.
#
double *bw_sat;
/* iterators */
double *bw_sat;
/* iterators */
xbt_peer_t h1,h2,h3,h4;
/* Init the group */
xbt_peer_t h1,h2,h3,h4;
/* Init the group */
int sender (int argc,char *argv[]) {
int sender (int argc,char *argv[]) {
+ unsigned int iter; /* iterator */
char *data; /* data exchanged */
int datasize; /* size of message */
xbt_peer_t h; /* iterator */
char *data; /* data exchanged */
int datasize; /* size of message */
xbt_peer_t h; /* iterator */
gras_init(&argc,argv);
/* Get the node location from argc/argv */
gras_init(&argc,argv);
/* Get the node location from argc/argv */
- for (i=1; i<argc-1; i++){
- xbt_peer_t peer = xbt_peer_from_string(argv[i]);
+ for (iter=1; iter<argc-1; iter++){
+ xbt_peer_t peer = xbt_peer_from_string(argv[iter]);
xbt_dynar_push(peers,&peer);
}
xbt_dynar_push(peers,&peer);
}
/* write to the receivers */
/* write to the receivers */
- xbt_dynar_foreach(peers,i,h) {
+ xbt_dynar_foreach(peers,iter,h) {
connected = 0;
while (!connected) {
xbt_ex_t e;
connected = 0;
while (!connected) {
xbt_ex_t e;
/* XML processor/application API for surf/surfxml.dtd.
/* XML processor/application API for surf/surfxml.dtd.
- * Generated 2007/10/31 10:34:28.
+ * Generated 2007/11/08 11:56:21.
*
* This program was generated with the FleXML XML processor generator.
* FleXML is Copyright (C) 1999-2005 Kristoffer Rose. All rights reserved.
* FleXML is Copyright (C) 2003-2006 Martin Quinson. All rights reserved.
*
* This program was generated with the FleXML XML processor generator.
* FleXML is Copyright (C) 1999-2005 Kristoffer Rose. All rights reserved.
* FleXML is Copyright (C) 2003-2006 Martin Quinson. All rights reserved.
- * (Id: flexml.pl,v 1.61 2006/09/13 16:34:33 wdowling Exp).
+ * (Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp).
*
* There are two, intertwined parts to this program, part A and part B.
*
*
* There are two, intertwined parts to this program, part A and part B.
*
- XBT_PUBLIC(void) _xbt_dynar_cursor_first (const xbt_dynar_t dynar, int * const cursor);
- XBT_PUBLIC(void) _xbt_dynar_cursor_step (const xbt_dynar_t dynar, int * const cursor);
- XBT_PUBLIC(int) _xbt_dynar_cursor_get (const xbt_dynar_t dynar, int * const cursor,
+ XBT_PUBLIC(void) _xbt_dynar_cursor_first (const xbt_dynar_t dynar, unsigned int * const cursor);
+ XBT_PUBLIC(void) _xbt_dynar_cursor_step (const xbt_dynar_t dynar, unsigned int * const cursor);
+ XBT_PUBLIC(int) _xbt_dynar_cursor_get (const xbt_dynar_t dynar, unsigned int * const cursor,
void *whereto);
XBT_PUBLIC(void) xbt_dynar_cursor_rm(xbt_dynar_t dynar,
void *whereto);
XBT_PUBLIC(void) xbt_dynar_cursor_rm(xbt_dynar_t dynar,
+ unsigned int *const cursor);
XBT_PUBLIC(void) xbt_dynar_cursor_unlock(xbt_dynar_t dynar);
/** @brief Iterates over the whole dynar.
XBT_PUBLIC(void) xbt_dynar_cursor_unlock(xbt_dynar_t dynar);
/** @brief Iterates over the whole dynar.
* \note An example of usage:
* \code
xbt_dynar_t dyn;
* \note An example of usage:
* \code
xbt_dynar_t dyn;
string *str;
xbt_dynar_foreach (dyn,cpt,str) {
printf("Seen %s\n",str);
string *str;
xbt_dynar_foreach (dyn,cpt,str) {
printf("Seen %s\n",str);
/* construction of matrices for bandwith and latency */
/* construction of matrices for bandwith and latency */
- int i,j,len=xbt_dynar_length(peers);
+ unsigned int i,j;
+ int len=xbt_dynar_length(peers);
double *matrix_res = xbt_new0(double, len*len);
xbt_peer_t p1,p2;
double *matrix_res = xbt_new0(double, len*len);
xbt_peer_t p1,p2;
xbt_peer_t dude = xbt_peer_new(gras_socket_peer_name(exp),
gras_socket_peer_port(exp));
xbt_peer_t dude = xbt_peer_new(gras_socket_peer_name(exp),
gras_socket_peer_port(exp));
xbt_peer_t peer_it;
xbt_dynar_foreach(group, cpt, peer_it) {
xbt_peer_t peer_it;
xbt_dynar_foreach(group, cpt, peer_it) {
amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
xbt_dynar_t group = xbt_dict_get(g->groups, group_name);
amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
xbt_dynar_t group = xbt_dict_get(g->groups, group_name);
xbt_peer_t peer_it;
xbt_dynar_foreach(group, cpt, peer_it) {
xbt_peer_t peer_it;
xbt_dynar_foreach(group, cpt, peer_it) {
/* GENERATED FILE, DO NOT EDIT */
/*******************************/
/* GENERATED FILE, DO NOT EDIT */
/*******************************/
#include "xbt.h"
#include "xbt/ex.h"
#include "xbt.h"
#include "xbt/ex.h"
XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
/* Vars_decl [doxygen cruft] */
xbt_dynar_t d;
XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
/* Vars_decl [doxygen cruft] */
xbt_dynar_t d;
+ int i,cpt;
+ unsigned int cursor;
int *iptr;
xbt_test_add0("==== Traverse the empty dynar");
int *iptr;
xbt_test_add0("==== Traverse the empty dynar");
/*******************************************************************************/
XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
xbt_dynar_t d;
/*******************************************************************************/
XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
xbt_dynar_t d;
+ int cpt;
+ unsigned int cursor;
double d1,d2;
xbt_test_add0("==== Traverse the empty dynar");
double d1,d2;
xbt_test_add0("==== Traverse the empty dynar");
XBT_TEST_UNIT("string",test_dynar_string,"Dyars of strings") {
xbt_dynar_t d;
int cpt;
XBT_TEST_UNIT("string",test_dynar_string,"Dyars of strings") {
xbt_dynar_t d;
int cpt;
char buf[1024];
char *s1,*s2;
xbt_test_add0("==== Traverse the empty dynar");
d=xbt_dynar_new(sizeof(char *),&free_string);
char buf[1024];
char *s1,*s2;
xbt_test_add0("==== Traverse the empty dynar");
d=xbt_dynar_new(sizeof(char *),&free_string);
- xbt_dynar_foreach(d,cpt,s1){
+ xbt_dynar_foreach(d,iter,s1){
xbt_test_assert0(FALSE,
"Damnit, there is something in the empty dynar");
}
xbt_test_assert0(FALSE,
"Damnit, there is something in the empty dynar");
}
xbt_dynar_unshift(d,&s1);
}
/* 2. Traverse the dynar with the macro */
xbt_dynar_unshift(d,&s1);
}
/* 2. Traverse the dynar with the macro */
- xbt_dynar_foreach(d,cpt,s1) {
- sprintf(buf,"%d",NB_ELEM - cpt -1);
+ xbt_dynar_foreach(d,iter,s1) {
+ sprintf(buf,"%d",NB_ELEM - iter -1);
xbt_test_assert2 (!strcmp(buf,s1),
"The retrieved value is not the same than the injected one (%s!=%s)",
buf,s1);
xbt_test_assert2 (!strcmp(buf,s1),
"The retrieved value is not the same than the injected one (%s!=%s)",
buf,s1);
/* GENERATED FILE, DO NOT EDIT */
/*******************************/
/* GENERATED FILE, DO NOT EDIT */
/*******************************/
#include <stdio.h>
#include "xbt/ex.h"
#include <stdio.h>
#include "xbt/ex.h"
gras_cbps_block_end(gras_cbps_t ps) {
xbt_dynar_t frame = NULL;
gras_cbps_block_end(gras_cbps_t ps) {
xbt_dynar_t frame = NULL;
+ unsigned int cursor = 0;
char *name = NULL;
xbt_assert0(xbt_dynar_length(ps->frames),
char *name = NULL;
xbt_assert0(xbt_dynar_length(ps->frames),
* For debugging purpose
*/
void gras_datadesc_type_dump(const gras_datadesc_type_t ddt){
* For debugging purpose
*/
void gras_datadesc_type_dump(const gras_datadesc_type_t ddt){
printf("DataDesc dump:");
if(!ddt) {
printf("DataDesc dump:");
if(!ddt) {
xbt_dynar_t field_array;
gras_dd_cat_field_t field=NULL;
xbt_dynar_t field_array;
gras_dd_cat_field_t field=NULL;
+ unsigned int field_num;
if (type->category_code == e_gras_datadesc_type_cat_union) {
field_array = type->category.union_data.fields;
if (type->category_code == e_gras_datadesc_type_cat_union) {
field_array = type->category.union_data.fields;
*/
int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
const gras_datadesc_type_t d2) {
*/
int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
const gras_datadesc_type_t d2) {
+ int ret;
+ unsigned int cpt;
gras_dd_cat_field_t field1,field2;
gras_datadesc_type_t field_desc_1,field_desc_2;
gras_dd_cat_field_t field1,field2;
gras_datadesc_type_t field_desc_1,field_desc_2;
"scalar", "struct", "union", "ref", "array", "ignored",
"invalid"};
"scalar", "struct", "union", "ref", "array", "ignored",
"invalid"};
-static gras_datadesc_type_t int_type = NULL;
+static gras_datadesc_type_t uint_type = NULL;
static gras_datadesc_type_t pointer_type = NULL;
static XBT_INLINE void
static gras_datadesc_type_t pointer_type = NULL;
static XBT_INLINE void
-gras_dd_send_int(gras_socket_t sock,int *i, int stable) {
+gras_dd_send_uint(gras_socket_t sock,unsigned int *i, int stable) {
- if (!int_type) {
- int_type = gras_datadesc_by_name("int");
- xbt_assert(int_type);
+ if (!uint_type) {
+ uint_type = gras_datadesc_by_name("unsigned int");
+ xbt_assert(uint_type);
- DEBUG1("send_int(%d)",*i);
- gras_trp_send(sock, (char*)i, int_type->size[GRAS_THISARCH], stable);
+ DEBUG1("send_uint(%u)",*i);
+ gras_trp_send(sock, (char*)i, uint_type->size[GRAS_THISARCH], stable);
-gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
+gras_dd_recv_uint(gras_socket_t sock, int r_arch, unsigned int *i) {
- if (!int_type) {
- int_type = gras_datadesc_by_name("int");
- xbt_assert(int_type);
+ if (!uint_type) {
+ uint_type = gras_datadesc_by_name("unsigned int");
+ xbt_assert(uint_type);
- if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
- gras_trp_recv(sock, (char*)i, int_type->size[r_arch]);
+ if (uint_type->size[GRAS_THISARCH] >= uint_type->size[r_arch]) {
+ gras_trp_recv(sock, (char*)i, uint_type->size[r_arch]);
if (r_arch != GRAS_THISARCH)
if (r_arch != GRAS_THISARCH)
- gras_dd_convert_elm(int_type,1,r_arch, i,i);
+ gras_dd_convert_elm(uint_type,1,r_arch, i,i);
- void *ptr = xbt_malloc(int_type->size[r_arch]);
+ void *ptr = xbt_malloc(uint_type->size[r_arch]);
- gras_trp_recv(sock, (char*)ptr, int_type->size[r_arch]);
+ gras_trp_recv(sock, (char*)ptr, uint_type->size[r_arch]);
if (r_arch != GRAS_THISARCH)
if (r_arch != GRAS_THISARCH)
- gras_dd_convert_elm(int_type,1,r_arch, ptr,i);
+ gras_dd_convert_elm(uint_type,1,r_arch, ptr,i);
- DEBUG1("recv_int(%d)",*i);
+ DEBUG1("recv_uint(%u)",*i);
gras_datadesc_type_t sub_type; /* type on which we recurse */
int count = 0;
gras_datadesc_type_t sub_type; /* type on which we recurse */
int count = 0;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
+ unsigned int field_num;
union_data = type->category.union_data;
union_data = type->category.union_data;
"union field selector of %s gave a negative value",
type->name);
"union field selector of %s gave a negative value",
type->name);
- xbt_assert3(field_num < (int)xbt_dynar_length(union_data.fields),
+ xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
"union field selector of %s returned %d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
"union field selector of %s returned %d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
int detect_cycle) {
xbt_ex_t e;
int detect_cycle) {
xbt_ex_t e;
gras_datadesc_type_t sub_type; /* type on which we recurse */
VERB2("Send a %s (%s)",
gras_datadesc_type_t sub_type; /* type on which we recurse */
VERB2("Send a %s (%s)",
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
+ unsigned int field_num;
union_data = type->category.union_data;
union_data = type->category.union_data;
"union field selector of %s gave a negative value",
type->name);
"union field selector of %s gave a negative value",
type->name);
- xbt_assert3(field_num < (int)xbt_dynar_length(union_data.fields),
+ xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
"union field selector of %s returned %d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
/* Send the field number */
"union field selector of %s returned %d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
/* Send the field number */
- gras_dd_send_int(sock, &field_num, 0 /* not stable */);
+ gras_dd_send_uint(sock, &field_num, 0 /* not stable */);
/* Send the content */
field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
/* Send the content */
field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
sub_type = ref_data.type;
if (sub_type == NULL) {
sub_type = (*ref_data.selector)(type,state,data);
sub_type = ref_data.type;
if (sub_type == NULL) {
sub_type = (*ref_data.selector)(type,state,data);
- gras_dd_send_int(sock, (int*) &(sub_type->code),1 /*stable*/);
+ gras_dd_send_uint(sock, &(sub_type->code),1 /*stable*/);
}
/* Send the actual value of the pointer for cycle handling */
}
/* Send the actual value of the pointer for cycle handling */
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
char *ptr=data;
long int elm_size;
char *ptr=data;
long int elm_size;
count = array_data.dynamic_size(type,state,data);
xbt_assert1(count >=0,
"Invalid (negative) array size for type %s",type->name);
count = array_data.dynamic_size(type,state,data);
xbt_assert1(count >=0,
"Invalid (negative) array size for type %s",type->name);
- gras_dd_send_int(sock, &count, 0/*non-stable*/);
+ gras_dd_send_uint(sock, &count, 0/*non-stable*/);
int subsize,
int detect_cycle) {
int subsize,
int detect_cycle) {
gras_datadesc_type_t sub_type;
xbt_ex_t e;
gras_datadesc_type_t sub_type;
xbt_ex_t e;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
+ unsigned int field_num;
union_data = type->category.union_data;
union_data = type->category.union_data;
"Please call gras_datadesc_declare_union_close on %s before receiving it",
type->name);
/* retrieve the field number */
"Please call gras_datadesc_declare_union_close on %s before receiving it",
type->name);
/* retrieve the field number */
- gras_dd_recv_int(sock, r_arch, &field_num);
+ gras_dd_recv_uint(sock, r_arch, &field_num);
if (field_num < 0)
THROW1(mismatch_error,0,
"Received union field for %s is negative", type->name);
if (field_num < 0)
THROW1(mismatch_error,0,
"Received union field for %s is negative", type->name);
- if (field_num > (int)xbt_dynar_length(union_data.fields))
+ if (field_num > xbt_dynar_length(union_data.fields))
THROW3(mismatch_error,0,
"Received union field for %s is said to be #%d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
THROW3(mismatch_error,0,
"Received union field for %s is said to be #%d but there is only %lu fields",
type->name, field_num, xbt_dynar_length(union_data.fields));
/* Get the referenced type locally or from peer */
sub_type = ref_data.type;
if (sub_type == NULL) {
/* Get the referenced type locally or from peer */
sub_type = ref_data.type;
if (sub_type == NULL) {
- int ref_code;
- gras_dd_recv_int(sock, r_arch, &ref_code);
+ unsigned int ref_code;
+ gras_dd_recv_uint(sock, r_arch, &ref_code);
sub_type = gras_datadesc_by_id(ref_code);
}
sub_type = gras_datadesc_by_id(ref_code);
}
}
if (reference_is_to_recv) {
}
if (reference_is_to_recv) {
+ unsigned int subsubcount = 0;
void *l_referenced=NULL;
VERB2("Receiving a ref to '%s', remotely @%p",
void *l_referenced=NULL;
VERB2("Receiving a ref to '%s', remotely @%p",
subsubcount = array_data.fixed_size;
if (subsubcount == 0)
subsubcount = array_data.fixed_size;
if (subsubcount == 0)
- gras_dd_recv_int(sock, r_arch, &subsubcount);
+ gras_dd_recv_uint(sock, r_arch, &subsubcount);
subsub_type = array_data.type;
subsub_type = array_data.type;
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
char *ptr;
long int elm_size;
char *ptr;
long int elm_size;
if (count == 0)
count = subsize;
if (count == 0)
if (count == 0)
count = subsize;
if (count == 0)
- gras_dd_recv_int(sock, r_arch, &count);
+ gras_dd_recv_uint(sock, r_arch, &count);
if (count == 0)
THROW1(mismatch_error,0,
"Invalid (=0) array size for type %s",type->name);
if (count == 0)
THROW1(mismatch_error,0,
"Invalid (=0) array size for type %s",type->name);
xbt_dynar_t identifiers;
s_identifier_t field;
xbt_dynar_t identifiers;
s_identifier_t field;
int done;
xbt_dynar_t fields_to_push;
int done;
xbt_dynar_t fields_to_push;
DEBUG1("This statement contained %lu identifiers",xbt_dynar_length(identifiers));
/* append the identifiers we've found */
DEBUG1("This statement contained %lu identifiers",xbt_dynar_length(identifiers));
/* append the identifiers we've found */
- xbt_dynar_foreach(identifiers,i, field) {
+ xbt_dynar_foreach(identifiers,iter, field) {
if (field.tm.is_ref)
PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name,field.tm.is_ref);
if (field.tm.is_ref)
PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name,field.tm.is_ref);
DEBUG1("struct_type=%p",(void*)struct_type);
/* Make sure that all fields declaring a size push it into the cbps */
DEBUG1("struct_type=%p",(void*)struct_type);
/* Make sure that all fields declaring a size push it into the cbps */
- xbt_dynar_foreach(fields_to_push,i, name) {
+ xbt_dynar_foreach(fields_to_push,iter, name) {
DEBUG1("struct_type=%p",(void*)struct_type);
if (name[0] == '*') {
VERB2("Push field '%s' as a multiplier into size stack of %p",
DEBUG1("struct_type=%p",(void*)struct_type);
if (name[0] == '*') {
VERB2("Push field '%s' as a multiplier into size stack of %p",
double start, now;
gras_msg_procdata_t pd=
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
double start, now;
gras_msg_procdata_t pd=
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
xbt_assert0(msg_got,"msg_got is an output parameter");
xbt_assert0(msg_got,"msg_got is an output parameter");
int volatile ran_ok;
s_gras_msg_t msg;
int volatile ran_ok;
s_gras_msg_t msg;
gras_msg_procdata_t pd=
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
gras_cblist_t *list=NULL;
gras_msg_procdata_t pd=
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
gras_cblist_t *list=NULL;
DEBUG2("Register %p as callback to '%s'",cb,msgtype->name);
DEBUG2("Register %p as callback to '%s'",cb,msgtype->name);
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
gras_cblist_t *list;
gras_msg_cb_t cb_cpt;
(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
gras_cblist_t *list;
gras_msg_cb_t cb_cpt;
int found = 0;
/* search the list of cb for this message on this host */
int found = 0;
/* search the list of cb for this message on this host */
unsigned long int ID= *(unsigned long int*)ctx;
int res = msg->ID == ID &&
(msg->kind == e_gras_msg_kind_rpcanswer || msg->kind == e_gras_msg_kind_rpcerror);
unsigned long int ID= *(unsigned long int*)ctx;
int res = msg->ID == ID &&
(msg->kind == e_gras_msg_kind_rpcanswer || msg->kind == e_gras_msg_kind_rpcerror);
gras_msg_cb_ctx_t rpc_ctx;
gras_msg_cb_ctx_t rpc_ctx;
/** @brief Cancel a delayed task */
void gras_timer_cancel_delay(double interval, void_f_void_t action) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
/** @brief Cancel a delayed task */
void gras_timer_cancel_delay(double interval, void_f_void_t action) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
+ unsigned int cursor;
+ int found;
s_gras_timer_t timer;
found = FALSE;
s_gras_timer_t timer;
found = FALSE;
/** @brief Cancel a repetitive task */
void gras_timer_cancel_repeat(double interval, void_f_void_t action) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
/** @brief Cancel a repetitive task */
void gras_timer_cancel_repeat(double interval, void_f_void_t action) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
+ unsigned int cursor;
+ int found;
s_gras_timer_t timer;
found = FALSE;
s_gras_timer_t timer;
found = FALSE;
/** @brief Cancel all delayed tasks */
void gras_timer_cancel_delay_all(void) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
/** @brief Cancel all delayed tasks */
void gras_timer_cancel_delay_all(void) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
+ unsigned int cursor;
+ int found;
s_gras_timer_t timer;
found = FALSE;
s_gras_timer_t timer;
found = FALSE;
/** @brief Cancel all repetitive tasks */
void gras_timer_cancel_repeat_all(void){
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
/** @brief Cancel all repetitive tasks */
void gras_timer_cancel_repeat_all(void){
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
+ unsigned int cursor;
+ int found;
s_gras_timer_t timer;
found = FALSE;
s_gras_timer_t timer;
found = FALSE;
/* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
double gras_msg_timer_handle(void) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
/* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
double gras_msg_timer_handle(void) {
gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
gras_timer_t timer;
double now=gras_os_time();
double untilnext = -1.0;
gras_timer_t timer;
double now=gras_os_time();
double untilnext = -1.0;
- for (cursor=0; cursor < (int)xbt_dynar_length(pd->timers); cursor++) {
+ for (cursor=0; cursor < xbt_dynar_length(pd->timers); cursor++) {
double untilthis;
timer = xbt_dynar_get_ptr (pd->timers, cursor);
double untilthis;
timer = xbt_dynar_get_ptr (pd->timers, cursor);
static int fd_setsize=-1; /* FD_SETSIZE not always defined. Get this portably */
gras_socket_t sock_iter; /* iterating over all sockets */
static int fd_setsize=-1; /* FD_SETSIZE not always defined. Get this portably */
gras_socket_t sock_iter; /* iterating over all sockets */
- int cursor; /* iterating over all sockets */
+ unsigned int cursor; /* iterating over all sockets */
/* Check whether there is more data to read from the socket we selected last time.
This can happen with tcp buffered sockets since we try to get as much data as we can for them */
/* Check whether there is more data to read from the socket we selected last time.
This can happen with tcp buffered sockets since we try to get as much data as we can for them */
gras_socket_t active_socket = NULL;
gras_trp_sg_sock_data_t *active_socket_data;
gras_socket_t sock_iter; /* iterating over all sockets */
gras_socket_t active_socket = NULL;
gras_trp_sg_sock_data_t *active_socket_data;
gras_socket_t sock_iter; /* iterating over all sockets */
DEBUG3("select on %s@%s with timeout=%f",
SIMIX_process_get_name(SIMIX_process_self()),
DEBUG3("select on %s@%s with timeout=%f",
SIMIX_process_get_name(SIMIX_process_self()),
void gras_socket_close(gras_socket_t sock) {
xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
gras_socket_t sock_iter = NULL;
void gras_socket_close(gras_socket_t sock) {
xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
gras_socket_t sock_iter = NULL;
XBT_IN;
VERB1("Close %p",sock);
XBT_IN;
VERB1("Close %p",sock);
if (sock) {
/* FIXME: Cannot get the dynar mutex, because it can be already locked */
// _xbt_dynar_foreach(sockets,cursor,sock_iter) {
if (sock) {
/* FIXME: Cannot get the dynar mutex, because it can be already locked */
// _xbt_dynar_foreach(sockets,cursor,sock_iter) {
- for (cursor=0; cursor< (int)xbt_dynar_length(sockets); cursor++) {
+ for (cursor=0; cursor< xbt_dynar_length(sockets); cursor++) {
_xbt_dynar_cursor_get(sockets,&cursor,&sock_iter);
if (sock == sock_iter) {
DEBUG2("remove sock cursor %d dize %lu\n",cursor,xbt_dynar_length(sockets));
_xbt_dynar_cursor_get(sockets,&cursor,&sock_iter);
if (sock == sock_iter) {
DEBUG2("remove sock cursor %d dize %lu\n",cursor,xbt_dynar_length(sockets));
gras_trp_procdata_t procdata =
(gras_trp_procdata_t)gras_libdata_by_id(gras_trp_libdata_id);
gras_trp_procdata_t procdata =
(gras_trp_procdata_t)gras_libdata_by_id(gras_trp_libdata_id);
gras_socket_t s;
INFO1("** Dump the socket set %s",name);
gras_socket_t s;
INFO1("** Dump the socket set %s",name);
***/
static void find_port(gras_hostdata_t *hd, int port,
gras_sg_portrec_t *hpd) {
***/
static void find_port(gras_hostdata_t *hd, int port,
gras_sg_portrec_t *hpd) {
gras_sg_portrec_t pr;
xbt_assert0(hd,"Please run gras_process_init on each process");
gras_sg_portrec_t pr;
xbt_assert0(hd,"Please run gras_process_init on each process");
void gras_trp_sg_socket_close(gras_socket_t sock){
gras_hostdata_t *hd=(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
void gras_trp_sg_socket_close(gras_socket_t sock){
gras_hostdata_t *hd=(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
gras_sg_portrec_t pr;
XBT_IN1(" (sock=%p)",sock);
gras_sg_portrec_t pr;
XBT_IN1(" (sock=%p)",sock);
gras_procdata_t *pd=gras_procdata_get();
s_gras_procdata_fabric_t fab;
gras_procdata_t *pd=gras_procdata_get();
s_gras_procdata_fabric_t fab;
xbt_ex_t e;
xbt_set_elm_t elem;
xbt_ex_t e;
xbt_set_elm_t elem;
xbt_dynar_foreach(_gras_procdata_fabrics,cursor,fab){
volatile int found = 0;
xbt_dynar_foreach(_gras_procdata_fabrics,cursor,fab){
volatile int found = 0;
- if (cursor+1 <= (int)xbt_set_length(pd->libdata)) {
+ if (cursor+1 <= xbt_set_length(pd->libdata)) {
DEBUG2("Skip fabric %d: there is already %ld libdata",
cursor, xbt_set_length(pd->libdata));
continue; /* allow to recall this function to get recently added fabrics */
DEBUG2("Skip fabric %d: there is already %ld libdata",
cursor, xbt_set_length(pd->libdata));
continue; /* allow to recall this function to get recently added fabrics */
gras_process_exit() {
xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets;
gras_socket_t sock_iter;
gras_process_exit() {
xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets;
gras_socket_t sock_iter;
gras_hostdata_t *hd=
(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
gras_procdata_t *pd=
gras_hostdata_t *hd=
(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
gras_procdata_t *pd=
XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_add_trace(tmgr_history_t history,
tmgr_trace_t trace,
XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_add_trace(tmgr_history_t history,
tmgr_trace_t trace,
- double start_time, int offset,
+ double start_time, unsigned int offset,
void *model);
/* Access functions */
void *model);
/* Access functions */
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
if (!control_string)
return;
if (!control_string)
return;
SD_task_t *changed_tasks = NULL;
int changed_task_number = 0;
int changed_task_capacity = sd_global->task_number + 1;
SD_task_t *changed_tasks = NULL;
int changed_task_number = 0;
int changed_task_capacity = sd_global->task_number + 1;
static int first_time = 1;
SD_CHECK_INIT_DONE();
static int first_time = 1;
SD_CHECK_INIT_DONE();
total_time += elapsed_time;
/* let's see which tasks are done */
total_time += elapsed_time;
/* let's see which tasks are done */
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
while ((action = xbt_swag_extract(model->common_public->
states.done_action_set))) {
task = action->data;
while ((action = xbt_swag_extract(model->common_public->
states.done_action_set))) {
task = action->data;
}
/* we must reset every task->state_changed */
}
/* we must reset every task->state_changed */
- i = 0;
- while (changed_tasks[i] != NULL) {
- changed_tasks[i]->state_changed = 0;
- i++;
+ iter = 0;
+ while (changed_tasks[iter] != NULL) {
+ changed_tasks[iter]->state_changed = 0;
+ iter++;
}
INFO0("Simulation finished");
}
INFO0("Simulation finished");
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
if (!control_string)
return;
if (!control_string)
return;
{
smx_process_t process = NULL;
{
smx_process_t process = NULL;
double elapsed_time = 0.0;
static int state_modifications = 1;
static int first = 1;
double elapsed_time = 0.0;
static int state_modifications = 1;
static int first = 1;
void *fun = NULL;
void *arg = NULL;
void *fun = NULL;
void *arg = NULL;
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
if (xbt_swag_size(model->common_public->states.failed_action_set)
|| xbt_swag_size(model->common_public->states.
done_action_set)) {
if (xbt_swag_size(model->common_public->states.failed_action_set)
|| xbt_swag_size(model->common_public->states.
done_action_set)) {
}
/* Wake up all process waiting for the action finish */
}
/* Wake up all process waiting for the action finish */
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
while ((action =
xbt_swag_extract(model->common_public->states.
failed_action_set))) {
while ((action =
xbt_swag_extract(model->common_public->states.
failed_action_set))) {
static char *path_name = NULL;
FILE *surf_fopen(const char *name, const char *mode)
{
static char *path_name = NULL;
FILE *surf_fopen(const char *name, const char *mode)
{
char *path = NULL;
FILE *file = NULL;
unsigned int path_name_len = 0; /* don't count '\0' */
char *path = NULL;
FILE *file = NULL;
unsigned int path_name_len = 0; /* don't count '\0' */
path_name = xbt_new0(char, path_name_len + 1);
}
path_name = xbt_new0(char, path_name_len + 1);
}
- xbt_dynar_foreach(surf_path, i, path) {
+ xbt_dynar_foreach(surf_path, iter, path) {
if (path_name_len < strlen(path) + strlen(name) + 1) {
path_name_len = strlen(path) + strlen(name) + 1; /* plus '/' */
path_name = xbt_realloc(path_name, path_name_len + 1);
if (path_name_len < strlen(path) + strlen(name) + 1) {
path_name_len = strlen(path) + strlen(name) + 1; /* plus '/' */
path_name = xbt_realloc(path_name, path_name_len + 1);
surf_model_t model = NULL;
surf_model_t model = NULL;
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
model->common_private->finalize();
}
model->common_private->finalize();
}
surf_model_object_t model_obj = NULL;
surf_model_t model = NULL;
tmgr_trace_event_t event = NULL;
surf_model_object_t model_obj = NULL;
surf_model_t model = NULL;
tmgr_trace_event_t event = NULL;
update_resource_state(model_obj, event, value);
}
}
update_resource_state(model_obj, event, value);
}
}
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
model->common_private->update_actions_state(NOW, 0.0);
}
first_run = 0;
model->common_private->update_actions_state(NOW, 0.0);
}
first_run = 0;
min = -1.0;
DEBUG0("Looking for next action end");
min = -1.0;
DEBUG0("Looking for next action end");
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
DEBUG1("Running for Resource [%s]", model->common_public->name);
model_next_action_end =
model->common_private->share_resources(NOW);
DEBUG1("Running for Resource [%s]", model->common_public->name);
model_next_action_end =
model->common_private->share_resources(NOW);
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
model->common_private->update_actions_state(NOW, min);
}
model->common_private->update_actions_state(NOW, min);
}
static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
{
static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
{
void_f_void_t fun;
xbt_dynar_foreach(cb_list, iterator, fun){
DEBUG2("call %p %p",fun,*fun);
void_f_void_t fun;
xbt_dynar_foreach(cb_list, iterator, fun){
DEBUG2("call %p %p",fun,*fun);
tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
tmgr_trace_t trace,
tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
tmgr_trace_t trace,
- double start_time, int offset,
+ double start_time, unsigned int offset,
void *model)
{
tmgr_trace_event_t trace_event = NULL;
void *model)
{
tmgr_trace_event_t trace_event = NULL;
trace_event->idx = offset;
trace_event->model = model;
trace_event->idx = offset;
trace_event->model = model;
- xbt_assert0((trace_event->idx < (int)xbt_dynar_length(trace->event_list)),
+ xbt_assert0((trace_event->idx < xbt_dynar_length(trace->event_list)),
"You're refering to an event that does not exist!");
xbt_heap_push(h->heap, trace_event, start_time);
"You're refering to an event that does not exist!");
xbt_heap_push(h->heap, trace_event, start_time);
*value = event->value;
*model = trace_event->model;
*value = event->value;
*model = trace_event->model;
- if (trace_event->idx < (int)xbt_dynar_length(trace->event_list) - 1) {
+ if (trace_event->idx < xbt_dynar_length(trace->event_list) - 1) {
xbt_heap_push(h->heap, trace_event, event_date + event->delta);
trace_event->idx++;
} else if (event->delta > 0) { /* Last element, checking for periodicity */
xbt_heap_push(h->heap, trace_event, event_date + event->delta);
trace_event->idx++;
} else if (event->delta > 0) { /* Last element, checking for periodicity */
typedef struct tmgr_trace_event {
tmgr_trace_t trace;
typedef struct tmgr_trace_event {
tmgr_trace_t trace;
void *model;
} s_tmgr_trace_event_t;
void *model;
} s_tmgr_trace_event_t;
/* convenient function */
static void __update_cpu_usage(cpu_KCCFLN05_t cpu)
{
/* convenient function */
static void __update_cpu_usage(cpu_KCCFLN05_t cpu)
{
surf_action_workstation_KCCFLN05_t action = NULL;
if ((!xbt_dynar_length(cpu->incomming_communications)) &&
(!xbt_dynar_length(cpu->outgoing_communications))) {
surf_action_workstation_KCCFLN05_t action = NULL;
if ((!xbt_dynar_length(cpu->incomming_communications)) &&
(!xbt_dynar_length(cpu->outgoing_communications))) {
static int action_free(surf_action_t action)
{
static int action_free(surf_action_t action)
{
surf_action_t act = NULL;
cpu_KCCFLN05_t src = ((surf_action_workstation_KCCFLN05_t) action)->src;
cpu_KCCFLN05_t dst = ((surf_action_workstation_KCCFLN05_t) action)->dst;
surf_action_t act = NULL;
cpu_KCCFLN05_t src = ((surf_action_workstation_KCCFLN05_t) action)->src;
cpu_KCCFLN05_t dst = ((surf_action_workstation_KCCFLN05_t) action)->dst;
void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
xbt_cfgelm_t variable;
void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
xbt_cfgelm_t variable;
+ unsigned int cpt;
+ int seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
xbt_cfgelm_t variable;
void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
xbt_cfgelm_t variable;
double seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
double seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
void
xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
xbt_cfgelm_t variable;
void
xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
xbt_cfgelm_t variable;
char *seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
char *seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
void
xbt_cfg_rm_peer(xbt_cfg_t cfg,const char*name, const char *peer,int port) {
xbt_cfgelm_t variable;
void
xbt_cfg_rm_peer(xbt_cfg_t cfg,const char*name, const char *peer,int port) {
xbt_cfgelm_t variable;
xbt_peer_t seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
xbt_peer_t seen;
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
if (variable) {
if (variable->cb_rm) {
if (variable) {
if (variable->cb_rm) {
void *ignored;
xbt_dynar_foreach(variable->content,cpt,ignored) {
(*variable->cb_rm)(name, cpt);
void *ignored;
xbt_dynar_foreach(variable->content,cpt,ignored) {
(*variable->cb_rm)(name, cpt);
static void xbt_test_test_dump(xbt_test_test_t test){
if (test) {
xbt_test_log_t log;
static void xbt_test_test_dump(xbt_test_test_t test){
if (test) {
xbt_test_log_t log;
fprintf(stderr," test %p(%s:%d)=%s (%s)\n",
test,test->file,test->line,test->title,
test->failed?"failed":"not failed");
fprintf(stderr," test %p(%s:%d)=%s (%s)\n",
test,test->file,test->line,test->title,
test->failed?"failed":"not failed");
static void xbt_test_unit_dump(xbt_test_unit_t unit) {
if (unit) {
xbt_test_test_t test;
static void xbt_test_unit_dump(xbt_test_unit_t unit) {
if (unit) {
xbt_test_test_t test;
fprintf(stderr," UNIT %s: %s (%s)\n",
unit->name,unit->title,
(unit->enabled?"enabled":"disabled"));
fprintf(stderr," UNIT %s: %s (%s)\n",
unit->name,unit->title,
(unit->enabled?"enabled":"disabled"));
/** @brief retrieve a testsuite from name, or create a new one */
xbt_test_suite_t xbt_test_suite_by_name(const char *name,const char *fmt, ...) {
xbt_test_suite_t suite;
/** @brief retrieve a testsuite from name, or create a new one */
xbt_test_suite_t xbt_test_suite_by_name(const char *name,const char *fmt, ...) {
xbt_test_suite_t suite;
char *bufname;
va_list ap;
char *bufname;
va_list ap;
void xbt_test_suite_dump(xbt_test_suite_t suite) {
if (suite) {
xbt_test_unit_t unit;
void xbt_test_suite_dump(xbt_test_suite_t suite) {
if (suite) {
xbt_test_unit_t unit;
fprintf(stderr,"TESTSUITE %s: %s (%s)\n",
suite->name, suite->title,
suite->enabled?"enabled":"disabled");
fprintf(stderr,"TESTSUITE %s: %s (%s)\n",
suite->name, suite->title,
suite->enabled?"enabled":"disabled");
const char *file;
int line;
char *cp;
const char *file;
int line;
char *cp;
- int it_unit,it_test,it_log;
+ unsigned int it_unit,it_test,it_log;
int first=1; /* for result pretty printing */
int first=1; /* for result pretty printing */
suite_title[40 + (suite_len+5)/2] = '=';
if (!suite->enabled)
sprintf(suite_title+ 70," DISABLED ");
suite_title[40 + (suite_len+5)/2] = '=';
if (!suite->enabled)
sprintf(suite_title+ 70," DISABLED ");
- fprintf(stderr, "\n%s",suite_title);
+ fprintf(stderr, "\n%s\n",suite_title);
int done = 0;
char dir[1024]; /* the directive */
/* iterators */
int done = 0;
char dir[1024]; /* the directive */
/* iterators */
xbt_test_suite_t suite;
xbt_test_unit_t unit;
xbt_test_suite_t suite;
xbt_test_unit_t unit;
char suitename[512];
char unitname[512];
char suitename[512];
char unitname[512];
apply_selection(selection);
if (_xbt_test_suites) {
apply_selection(selection);
if (_xbt_test_suites) {
xbt_test_suite_t suite;
xbt_dynar_foreach(_xbt_test_suites,it_suite,suite)
xbt_test_suite_t suite;
xbt_dynar_foreach(_xbt_test_suites,it_suite,suite)
apply_selection(selection);
if (_xbt_test_suites) {
apply_selection(selection);
if (_xbt_test_suites) {
xbt_test_suite_t suite;
int first=1;
xbt_test_suite_t suite;
int first=1;
void * const object) {
_dynar_lock(dynar);
void * const object) {
_dynar_lock(dynar);
- _xbt_dynar_remove_at(dynar, idx, object);
+ _xbt_dynar_remove_at(dynar, idx, object);
*/
void
_xbt_dynar_cursor_first(const xbt_dynar_t dynar,
*/
void
_xbt_dynar_cursor_first(const xbt_dynar_t dynar,
+ unsigned int * const cursor) {
_dynar_lock(dynar);
DEBUG1("Set cursor on %p to the first position",(void*)dynar);
_dynar_lock(dynar);
DEBUG1("Set cursor on %p to the first position",(void*)dynar);
*/
void
_xbt_dynar_cursor_step(const xbt_dynar_t dynar,
*/
void
_xbt_dynar_cursor_step(const xbt_dynar_t dynar,
+ unsigned int * const cursor) {
*/
int
_xbt_dynar_cursor_get(const xbt_dynar_t dynar,
*/
int
_xbt_dynar_cursor_get(const xbt_dynar_t dynar,
+ unsigned int * const cursor,
void * const dst) {
_sanity_check_dynar(dynar);
void * const dst) {
_sanity_check_dynar(dynar);
* This function can be used while traversing without problem.
*/
void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
* This function can be used while traversing without problem.
*/
void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
+ unsigned int * const cursor) {
_xbt_dynar_remove_at(dynar,(*cursor)--,NULL);
}
_xbt_dynar_remove_at(dynar,(*cursor)--,NULL);
}
XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
/* Vars_decl [doxygen cruft] */
xbt_dynar_t d;
XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
/* Vars_decl [doxygen cruft] */
xbt_dynar_t d;
+ int i,cpt;
+ unsigned int cursor;
int *iptr;
xbt_test_add0("==== Traverse the empty dynar");
int *iptr;
xbt_test_add0("==== Traverse the empty dynar");
/*******************************************************************************/
XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
xbt_dynar_t d;
/*******************************************************************************/
XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
xbt_dynar_t d;
+ int cpt;
+ unsigned int cursor;
double d1,d2;
xbt_test_add0("==== Traverse the empty dynar");
double d1,d2;
xbt_test_add0("==== Traverse the empty dynar");
XBT_TEST_UNIT("string",test_dynar_string,"Dyars of strings") {
xbt_dynar_t d;
int cpt;
XBT_TEST_UNIT("string",test_dynar_string,"Dyars of strings") {
xbt_dynar_t d;
int cpt;
char buf[1024];
char *s1,*s2;
xbt_test_add0("==== Traverse the empty dynar");
d=xbt_dynar_new(sizeof(char *),&free_string);
char buf[1024];
char *s1,*s2;
xbt_test_add0("==== Traverse the empty dynar");
d=xbt_dynar_new(sizeof(char *),&free_string);
- xbt_dynar_foreach(d,cpt,s1){
+ xbt_dynar_foreach(d,iter,s1){
xbt_test_assert0(FALSE,
"Damnit, there is something in the empty dynar");
}
xbt_test_assert0(FALSE,
"Damnit, there is something in the empty dynar");
}
xbt_dynar_unshift(d,&s1);
}
/* 2. Traverse the dynar with the macro */
xbt_dynar_unshift(d,&s1);
}
/* 2. Traverse the dynar with the macro */
- xbt_dynar_foreach(d,cpt,s1) {
- sprintf(buf,"%d",NB_ELEM - cpt -1);
+ xbt_dynar_foreach(d,iter,s1) {
+ sprintf(buf,"%d",NB_ELEM - iter -1);
xbt_test_assert2 (!strcmp(buf,s1),
"The retrieved value is not the same than the injected one (%s!=%s)",
buf,s1);
xbt_test_assert2 (!strcmp(buf,s1),
"The retrieved value is not the same than the injected one (%s!=%s)",
buf,s1);
for (i=0; environ[i]; i++) {
if (!strncmp("PATH=",environ[i], 5)) {
xbt_dynar_t path=xbt_str_split(environ[i] + 5, ":");
for (i=0; environ[i]; i++) {
if (!strncmp("PATH=",environ[i], 5)) {
xbt_dynar_t path=xbt_str_split(environ[i] + 5, ":");
char *data;
xbt_dynar_foreach(path, cpt, data) {
if (binary_name)
char *data;
xbt_dynar_foreach(path, cpt, data) {
if (binary_name)
xbt_edge_t xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst)
{
xbt_edge_t edge;
xbt_edge_t xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst)
{
xbt_edge_t edge;
xbt_dynar_foreach(src->out, cursor, edge) {
DEBUG3("%p = %p--%p",edge,edge->src,edge->dst);
xbt_dynar_foreach(src->out, cursor, edge) {
DEBUG3("%p = %p--%p",edge,edge->src,edge->dst);
void_f_pvoid_t edge_free_function,
void_f_pvoid_t graph_free_function)
{
void_f_pvoid_t edge_free_function,
void_f_pvoid_t graph_free_function)
{
+ unsigned int cursor = 0;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
{
unsigned long nbr;
unsigned long i;
{
unsigned long nbr;
unsigned long i;
+ unsigned int cursor = 0;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
void_f_pvoid_t free_function)
{
int idx;
void_f_pvoid_t free_function)
{
int idx;
+ unsigned int cursor = 0;
xbt_edge_t edge = NULL;
if ((free_function) && (e->data))
xbt_edge_t edge = NULL;
if ((free_function) && (e->data))
int __xbt_find_in_dynar(xbt_dynar_t dynar, void *p)
{
int __xbt_find_in_dynar(xbt_dynar_t dynar, void *p)
{
+ unsigned int cursor = 0;
void *tmp = NULL;
xbt_dynar_foreach(dynar, cursor, tmp) {
void *tmp = NULL;
xbt_dynar_foreach(dynar, cursor, tmp) {
*/
double *xbt_graph_get_length_matrix(xbt_graph_t g)
{
*/
double *xbt_graph_get_length_matrix(xbt_graph_t g)
{
- int cursor = 0;
- int in_cursor = 0;
+ unsigned int cursor = 0;
+ unsigned int in_cursor = 0;
unsigned long idx, i;
unsigned long n;
xbt_edge_t edge = NULL;
unsigned long idx, i;
unsigned long n;
xbt_edge_t edge = NULL;
xbt_node_t node = NULL;
xbt_dynar_t edge_list = NULL;
xbt_heap_t heap = xbt_heap_new(10, NULL);
xbt_node_t node = NULL;
xbt_dynar_t edge_list = NULL;
xbt_heap_t heap = xbt_heap_new(10, NULL);
xbt_assert0(!(g->directed),
"Spanning trees do not make sense on directed graphs");
xbt_assert0(!(g->directed),
"Spanning trees do not make sense on directed graphs");
+ unsigned int cursor;
+ int idx;
xbt_node_t node;
unsigned long n;
xbt_node_t node;
unsigned long n;
void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n,
xbt_node_t * sorted, int *idx)
{
void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n,
xbt_node_t * sorted, int *idx)
{
xbt_edge_t edge;
if (*((int *) (n->xbtdata)) == ALREADY_EXPLORED)
xbt_edge_t edge;
if (*((int *) (n->xbtdata)) == ALREADY_EXPLORED)
const char *(node_name) (xbt_node_t),
const char *(edge_name) (xbt_edge_t))
{
const char *(node_name) (xbt_node_t),
const char *(edge_name) (xbt_edge_t))
{
+ unsigned int cursor = 0;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
FILE *file = NULL;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
FILE *file = NULL;
const char *(node_data_print) (void *),
const char *(edge_data_print) (void *))
{
const char *(node_data_print) (void *),
const char *(edge_data_print) (void *))
{
+ unsigned int cursor = 0;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
FILE *file = NULL;
xbt_node_t node = NULL;
xbt_edge_t edge = NULL;
FILE *file = NULL;
*/
int _xbt_log_cat_init(xbt_log_category_t category,
e_xbt_log_priority_t priority) {
*/
int _xbt_log_cat_init(xbt_log_category_t category,
e_xbt_log_priority_t priority) {
xbt_log_setting_t setting=NULL;
int found = 0;
s_xbt_log_event_t _log_ev;
xbt_log_setting_t setting=NULL;
int found = 0;
s_xbt_log_event_t _log_ev;
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
/* To split the string in commands, and the cursors */
xbt_dynar_t set_strings;
char *str;
if (!control_string)
return;
if (!control_string)
return;
char *xbt_str_join(xbt_dynar_t dyn, const char*sep) {
int len=1,dyn_len=xbt_dynar_length(dyn);
char *xbt_str_join(xbt_dynar_t dyn, const char*sep) {
int len=1,dyn_len=xbt_dynar_length(dyn);
char *cursor;
char *res,*p;
char *cursor;
char *res,*p;
surf_solve(); /* Takes traces into account. Returns 0.0 */
do {
surf_action_t action = NULL;
surf_solve(); /* Takes traces into account. Returns 0.0 */
do {
surf_action_t action = NULL;
surf_model_t model = NULL;
now = surf_get_clock();
DEBUG1("Next Event : " "%g" "\n", now);
surf_model_t model = NULL;
now = surf_get_clock();
DEBUG1("Next Event : " "%g" "\n", now);
- xbt_dynar_foreach(model_list, i, model) {
+ xbt_dynar_foreach(model_list, iter, model) {
DEBUG1("\t %s actions\n", model->common_public->name);
while ((action =
xbt_swag_extract(model->common_public->states.
DEBUG1("\t %s actions\n", model->common_public->name);
while ((action =
xbt_swag_extract(model->common_public->states.