Replaced NETSIM macro with general (and now actually working) solution in Makefile.include.

This commit is contained in:
oliverschmidt 2008-11-17 22:52:10 +00:00
parent 7ac49a573b
commit 7cf3165155
13 changed files with 66 additions and 66 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: shell-rime-netcmd.c,v 1.4 2008/08/15 18:58:42 adamdunkels Exp $
* $Id: shell-rime-netcmd.c,v 1.5 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -54,9 +54,9 @@
#include "net/rime/timesynch.h"
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#include <stdio.h>
#ifndef HAVE_SNPRINTF

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: shell-rime.c,v 1.9 2008/08/16 10:04:55 adamdunkels Exp $
* $Id: shell-rime.c,v 1.10 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -54,9 +54,9 @@
#include "net/rime/timesynch.h"
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#include <stdio.h>
#ifndef HAVE_SNPRINTF

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: shell-sendtest.c,v 1.4 2008/11/09 10:53:25 adamdunkels Exp $
* $Id: shell-sendtest.c,v 1.5 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -45,9 +45,9 @@
#include <stdio.h>
#include <string.h>
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#ifndef HAVE_SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...);
#endif /* HAVE_SNPRINTF */
@ -66,14 +66,14 @@ static void
write_chunk(struct rucb_conn *c, int offset, int flag,
char *data, int datalen)
{
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[100];
printf("received %d; %d\n", offset, datalen);
sprintf(buf, "%lu%%", (100 * (offset + datalen)) / filesize);
ether_set_text(buf);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
/* printf("+");*/
}
static int

View file

@ -36,7 +36,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: collect.c,v 1.14 2008/08/15 19:00:38 adamdunkels Exp $
* $Id: collect.c,v 1.15 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -54,7 +54,7 @@
#include "dev/radio-sensor.h"
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif
@ -135,7 +135,7 @@ update_rtmetric(struct collect_conn *tc)
}
/* DEBUG_PRINTF("%d: new rtmetric %d\n", node_id, rtmetric);*/
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[8];
if(tc->rtmetric == RTMETRIC_MAX) {
@ -214,9 +214,9 @@ node_packet_received(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno)
tc->forwarding = 1;
n = neighbor_best();
if(n != NULL) {
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_set_line(n->addr.u8[0], n->addr.u8[1]);
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
runicast_send(c, &n->addr, rimebuf_attr(RIMEBUF_ATTR_MAX_REXMIT));
}
return;
@ -339,9 +339,9 @@ collect_send(struct collect_conn *tc, int rexmits)
} else {
n = neighbor_best();
if(n != NULL) {
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_set_line(n->addr.u8[0], n->addr.u8[1]);
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
PRINTF("%d.%d: sending to %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1]);

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: neighbor-discovery.c,v 1.10 2008/08/15 19:00:38 adamdunkels Exp $
* $Id: neighbor-discovery.c,v 1.11 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -53,7 +53,7 @@
#include "lib/random.h"
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: queuebuf.c,v 1.12 2008/02/25 02:14:34 adamdunkels Exp $
* $Id: queuebuf.c,v 1.13 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -111,11 +111,11 @@ queuebuf_new_from_rimebuf(void)
if(rbuf != NULL) {
#if QUEUEBUF_STATS
++queuebuf_ref_len;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
/* node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);*/
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#endif /* QUEUEBUF_STATS */
rbuf->len = rimebuf_datalen();
rbuf->ref = rimebuf_reference_ptr();
@ -134,11 +134,11 @@ queuebuf_new_from_rimebuf(void)
queuebuf_len--;
return NULL;
}
#if NETSIM
#if CONTIKI_TARGET_NETSIM
/* node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);*/
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#endif /* QUEUEBUF_STATS */
buf->len = rimebuf_copyto(buf->data);
rimebuf_attr_copyto(buf->attrs, buf->addrs);
@ -156,21 +156,21 @@ queuebuf_free(struct queuebuf *buf)
memb_free(&bufmem, buf);
#if QUEUEBUF_STATS
--queuebuf_len;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
/* node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);*/
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#endif /* QUEUEBUF_STATS */
} else if(memb_inmemb(&refbufmem, buf)) {
memb_free(&refbufmem, buf);
#if QUEUEBUF_STATS
--queuebuf_ref_len;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
/* node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);*/
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#endif /* QUEUEBUF_STATS */
}
}

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: route-discovery.c,v 1.11 2008/07/03 22:02:10 adamdunkels Exp $
* $Id: route-discovery.c,v 1.12 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -63,7 +63,7 @@ struct rrep_hdr {
rimeaddr_t originator;
};
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif
@ -129,7 +129,7 @@ insert_route(rimeaddr_t *originator, rimeaddr_t *last_hop, uint8_t hops)
last_hop->u8[0], last_hop->u8[1],
hops);
route_add(originator, last_hop, hops, 0);
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_set_line(last_hop->u8[0], last_hop->u8[1]);
#endif

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: trickle.c,v 1.12 2008/08/15 19:28:33 adamdunkels Exp $
* $Id: trickle.c,v 1.13 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -46,7 +46,7 @@
#include "net/rime/trickle.h"
#include "lib/random.h"
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#endif
@ -153,9 +153,9 @@ recv(struct broadcast_conn *bc, rimeaddr_t *from)
c->interval_scaling = 0;
send(c);
} else { /* hdr->seqno > c->seqno */
#if NETSIM
#if CONTIKI_TARGET_NETSIM
/* ether_set_line(from->u8[0], from->u8[1]);*/
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
c->seqno = seqno;
/* Store the incoming data in the queuebuf */
if(c->q != NULL) {

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: example-rucb.c,v 1.4 2008/11/11 11:25:39 fros4943 Exp $
* $Id: example-rucb.c,v 1.5 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -51,10 +51,10 @@
#include <stdio.h>
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#include "node.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#define FILESIZE 40000
@ -71,14 +71,14 @@ static void
write_chunk(struct rucb_conn *c, int offset, int flag,
char *data, int datalen)
{
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[100];
printf("received %d; %d\n", offset, datalen);
sprintf(buf, "%d%%", (100 * (offset + datalen)) / FILESIZE);
ether_set_text(buf);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}
static int
@ -136,9 +136,9 @@ PROCESS_THREAD(example_rucb_process, ev, data)
start_time);*/
rucb_send(&rucb, &recv);
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}
while(1) {

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: example-rudolph1.c,v 1.2 2008/02/24 22:15:46 adamdunkels Exp $
* $Id: example-rudolph1.c,v 1.3 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -51,10 +51,10 @@
#include <stdio.h>
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#include "node.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#define FILESIZE 2000
@ -67,13 +67,13 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
uint8_t *data, int datalen)
{
int fd;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[100];
sprintf(buf, "%d%%", (100 * (offset + datalen)) / FILESIZE);
ether_set_text(buf);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
if(flag == RUDOLPH1_FLAG_NEWFILE) {
/*printf("+++ rudolph1 new file incoming at %lu\n", clock_time());*/
@ -109,7 +109,7 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
break;
}
}
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif
cfs_close(fd);
@ -138,14 +138,14 @@ static struct rudolph1_conn rudolph1;
static void
log_queuelen(struct rtimer *t, void *ptr)
{
#if NETSIM
#if CONTIKI_TARGET_NETSIM
extern uint8_t queuebuf_len, queuebuf_ref_len;
node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);
rtimer_set(t, RTIMER_TIME(t) + RTIMER_ARCH_SECOND, 1,
log_queuelen, ptr);
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}
/*---------------------------------------------------------------------------*/
@ -180,9 +180,9 @@ PROCESS_THREAD(example_rudolph1_process, ev, data)
cfs_close(fd);
}
rudolph1_send(&rudolph1, CLOCK_SECOND * 2);
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: example-rudolph2.c,v 1.1 2008/01/25 18:00:51 adamdunkels Exp $
* $Id: example-rudolph2.c,v 1.2 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -50,10 +50,10 @@
#include <stdio.h>
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#include "node.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#define FILESIZE 2000
@ -66,13 +66,13 @@ write_chunk(struct rudolph2_conn *c, int offset, int flag,
uint8_t *data, int datalen)
{
int fd;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[100];
sprintf(buf, "%d%%", (100 * (offset + datalen)) / FILESIZE);
ether_set_text(buf);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
if(flag == RUDOLPH2_FLAG_NEWFILE) {
/*printf("+++ rudolph2 new file incoming at %lu\n", clock_time());*/
@ -108,7 +108,7 @@ write_chunk(struct rudolph2_conn *c, int offset, int flag,
break;
}
}
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif
cfs_close(fd);
@ -163,9 +163,9 @@ PROCESS_THREAD(example_rudolph2_process, ev, data)
cfs_close(fd);
}
rudolph2_send(&rudolph2, CLOCK_SECOND * 2);
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: tcprudolph0.c,v 1.10 2008/02/24 22:16:32 adamdunkels Exp $
* @(#)$Id: tcprudolph0.c,v 1.11 2008/11/17 22:52:10 oliverschmidt Exp $
*/
#include <stdio.h>
@ -172,14 +172,14 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
ret = start_program();
#if NETSIM
#if CONTIKI_TARGET_NETSIM
rudolph0_send(&rudolph0, CLOCK_SECOND / 4);
#else /* NETSIM */
#else /* CONTIKI_TARGET_NETSIM */
if(ret == ELFLOADER_OK) {
/* Propagate program. */
rudolph0_send(&rudolph0, CLOCK_SECOND / 4);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
/* Return "ok" message. */
do {

View file

@ -26,7 +26,7 @@ CONTIKI_CPU=$(CONTIKI)/cpu/native
include $(CONTIKI)/cpu/native/Makefile.native
### Compiler definitions
CFLAGS += `gtk-config --cflags` -DNETSIM=1
CFLAGS += `gtk-config --cflags`
TARGET_LIBFILES = `gtk-config --libs`
ifeq ($(OS),Windows_NT)