[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
OPcopyM.nc, 1.3, 1.4 OPegetsetvar6.nc, 1.3,
1.4 OPegetsetvar6M.nc, 1.2, 1.3 OPgetsetvar4.nc, 1.3,
1.4 OPgetsetvar4M.nc, 1.3, 1.4 OPrtsM.nc, 1.13,
1.14 OPgetAgents.nc, 1.5, NONE OPgetAgentsCM.nc, 1.4,
NONE OPgetAgentsM.nc, 1.9, NONE OPgetClosestAgent.nc, 1.6,
NONE OPgetClosestAgentCM.nc, 1.4, NONE OPgetClosestAgentM.nc,
1.13, NONE OPgetNumAgents.nc, 1.3, NONE OPgetNumAgentsCM.nc,
1.3, NONE OPgetNumAgentsM.nc, 1.8, NONE OPgetlocation.nc, 1.8,
NONE OPgetlocationCM.nc, 1.5, NONE OPgetlocationM.nc, 1.13, NONE
Chien-Liang Fok
chien-liang at users.sourceforge.net
Thu May 25 19:58:23 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29615/contrib/wustl/apps/Agilla/opcodes
Modified Files:
OPcopyM.nc OPegetsetvar6.nc OPegetsetvar6M.nc OPgetsetvar4.nc
OPgetsetvar4M.nc OPrtsM.nc
Removed Files:
OPgetAgents.nc OPgetAgentsCM.nc OPgetAgentsM.nc
OPgetClosestAgent.nc OPgetClosestAgentCM.nc
OPgetClosestAgentM.nc OPgetNumAgents.nc OPgetNumAgentsCM.nc
OPgetNumAgentsM.nc OPgetlocation.nc OPgetlocationCM.nc
OPgetlocationM.nc
Log Message:
Removed clustering components.
Index: OPcopyM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPcopyM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPcopyM.nc 23 May 2006 21:05:59 -0000 1.3
--- OPcopyM.nc 26 May 2006 02:58:20 -0000 1.4
***************
*** 1,134 ****
! // $Id$
!
! /* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
! * By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
! * as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
! * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
! *
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
! *
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
! *
! * See the GNU Lesser General Public License for more details, which can
! * be found here: http://www.gnu.org/copyleft/lesser.html
! */
!
! /* tab:4
! *
! *
! * "Copyright (c) 2000-2002 The Regents of the University of California.
! * All rights reserved.
! *
! * Permission to use, copy, modify, and distribute this software and
! * its documentation for any purpose, without fee, and without written
! * agreement is hereby granted, provided that the above copyright
! * notice, the following two paragraphs and the author appear in all
! * copies of this software.
! *
! * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
! * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
! * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
! * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
! * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
! * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
! * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
! * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
! * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
! *
! */
! /* tab:4
! *
! * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
! * By downloading, copying, installing or using the software you
! * agree to this license. If you do not agree to this license, do
! * not download, install, copy or use the software.
! *
! * Intel Open Source License
! *
! * Copyright (c) 2002 Intel Corporation
! * All rights reserved.
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions are
! * met:
! *
! * Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! * Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in the
! * documentation and/or other materials provided with the distribution.
! * Neither the name of the Intel Corporation nor the names of its
! * contributors may be used to endorse or promote products derived from
! * this software without specific prior written permission.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
! * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
! * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
! * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
! * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
! * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
! * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
! * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
! * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! *
! */
!
! /*
! * Authors: Philip Levis <pal at cs.berkeley.edu>
! * History: Apr 13, 2003 Inception.
! *
! */
!
! /**
! * @author Philip Levis <pal at cs.berkeley.edu>
! * @author Chien-Liang Fok <liangfok at wustl.edu>
! */
!
!
! includes Agilla;
!
! module OPcopyM {
! provides interface BytecodeI;
! uses interface OpStackI as Stacks;
! }
! implementation {
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context) {
! AgillaVariable arg;
! if (call Stacks.popOperand(context, &arg)) {
! dbg(DBG_USR1, "VM (%i:%i): Executing copy.\n", context->id.id, context->pc-1);
! call Stacks.pushOperand(context, &arg);
! call Stacks.pushOperand(context, &arg);
! dbg(DBG_USR1, "VM (%i:%i): Done executing copy.\n", context->id.id, context->pc-1);
! return SUCCESS;
! }
! return FAIL;
! }
! }
--- 1,134 ----
! // $Id$
!
! /* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
! * By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
! * as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
! * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
! *
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
! *
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
! *
! * See the GNU Lesser General Public License for more details, which can
! * be found here: http://www.gnu.org/copyleft/lesser.html
! */
!
! /* tab:4
! *
! *
! * "Copyright (c) 2000-2002 The Regents of the University of California.
! * All rights reserved.
! *
! * Permission to use, copy, modify, and distribute this software and
! * its documentation for any purpose, without fee, and without written
! * agreement is hereby granted, provided that the above copyright
! * notice, the following two paragraphs and the author appear in all
! * copies of this software.
! *
! * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
! * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
! * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
! * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
! * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
! * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
! * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
! * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
! * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
! *
! */
! /* tab:4
! *
! * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
! * By downloading, copying, installing or using the software you
! * agree to this license. If you do not agree to this license, do
! * not download, install, copy or use the software.
! *
! * Intel Open Source License
! *
! * Copyright (c) 2002 Intel Corporation
! * All rights reserved.
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions are
! * met:
! *
! * Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! * Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in the
! * documentation and/or other materials provided with the distribution.
! * Neither the name of the Intel Corporation nor the names of its
! * contributors may be used to endorse or promote products derived from
! * this software without specific prior written permission.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
! * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
! * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
! * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
! * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
! * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
! * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
! * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
! * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! *
! */
!
! /*
! * Authors: Philip Levis <pal at cs.berkeley.edu>
! * History: Apr 13, 2003 Inception.
! *
! */
!
! /**
! * @author Philip Levis <pal at cs.berkeley.edu>
! * @author Chien-Liang Fok <liangfok at wustl.edu>
! */
!
!
! includes Agilla;
!
! module OPcopyM {
! provides interface BytecodeI;
! uses interface OpStackI as Stacks;
! }
! implementation {
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context) {
! AgillaVariable arg;
! if (call Stacks.popOperand(context, &arg)) {
! dbg(DBG_USR1, "VM (%i:%i): Executing copy.\n", context->id.id, context->pc-1);
! call Stacks.pushOperand(context, &arg);
! call Stacks.pushOperand(context, &arg);
! //dbg(DBG_USR1, "VM (%i:%i): Done executing copy.\n", context->id.id, context->pc-1);
! return SUCCESS;
! }
! return FAIL;
! }
! }
Index: OPegetsetvar6.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPegetsetvar6.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPegetsetvar6.nc 18 May 2006 19:58:41 -0000 1.3
--- OPegetsetvar6.nc 26 May 2006 02:58:20 -0000 1.4
***************
*** 121,129 ****
implementation {
components OPegetsetvar6M, OpStackC;
! components ErrorMgrProxy;
BytecodeI = OPegetsetvar6M;
! OPegetsetvar6M.Stacks -> OpStackC;
! OPegetsetvar6M.Error -> ErrorMgrProxy;
}
--- 121,130 ----
implementation {
components OPegetsetvar6M, OpStackC;
! components ErrorMgrProxy, VarUtilC;
BytecodeI = OPegetsetvar6M;
! OPegetsetvar6M.OpStackI -> OpStackC;
! OPegetsetvar6M.ErrorMgrI -> ErrorMgrProxy;
! OPegetsetvar6M.VarUtilI -> VarUtilC;
}
Index: OPegetsetvar6M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPegetsetvar6M.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OPegetsetvar6M.nc 18 May 2006 19:58:41 -0000 1.2
--- OPegetsetvar6M.nc 26 May 2006 02:58:20 -0000 1.3
***************
*** 122,127 ****
uses
{
! interface ErrorMgrI as Error;
! interface OpStackI as Stacks;
}
}
--- 122,128 ----
uses
{
! interface ErrorMgrI;
! interface OpStackI;
! interface VarUtilI;
}
}
***************
*** 135,139 ****
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Heap Index out of range %i.\n", context->id.id, context->pc-1, arg);
! call Error.error(context, AGILLA_ERROR_INDEX_OUT_OF_BOUNDS);
return FAIL;
}
--- 136,140 ----
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Heap Index out of range %i.\n", context->id.id, context->pc-1, arg);
! call ErrorMgrI.error(context, AGILLA_ERROR_INDEX_OUT_OF_BOUNDS);
return FAIL;
}
***************
*** 142,154 ****
{
AgillaVariable var;
! if (call Stacks.popOperand(context, &var))
{
if (!(var.vtype & AGILLA_VAR_ASRTVL))
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Top of stack not an agentid, name, reading, type, or value.\n", context->id.id, context->pc-1);
! call Error.errord(context, AGILLA_ERROR_INVALID_TYPE, 0x0c);
return FAIL;
}
! dbg(DBG_USR1, "VM (%i:%i): Executing esetvar %i, vtype = %i.\n", context->id.id, context->pc-1, arg, var.vtype);
context->heap.pos[arg] = var;
return SUCCESS;
--- 143,155 ----
{
AgillaVariable var;
! if (call OpStackI.popOperand(context, &var))
{
if (!(var.vtype & AGILLA_VAR_ASRTVL))
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Top of stack not an agentid, name, reading, type, or value.\n", context->id.id, context->pc-1);
! call ErrorMgrI.errord(context, AGILLA_ERROR_INVALID_TYPE, 0x0c);
return FAIL;
}
! dbg(DBG_USR1, "VM (%i:%i): Executing esetvar %i, vtype = %s.\n", context->id.id, context->pc-1, arg, call VarUtilI.typeToString(var.vtype));
context->heap.pos[arg] = var;
return SUCCESS;
***************
*** 165,169 ****
{
context->condition = 1;
! call Stacks.pushOperand(context, &context->heap.pos[arg]);
}
return SUCCESS;
--- 166,170 ----
{
context->condition = 1;
! call OpStackI.pushOperand(context, &context->heap.pos[arg]);
}
return SUCCESS;
Index: OPgetsetvar4.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetsetvar4.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPgetsetvar4.nc 18 May 2006 19:58:41 -0000 1.3
--- OPgetsetvar4.nc 26 May 2006 02:58:20 -0000 1.4
***************
*** 121,129 ****
implementation {
components OPgetsetvar4M, OpStackC;
! components ErrorMgrProxy;
BytecodeI = OPgetsetvar4M;
! OPgetsetvar4M.Stacks -> OpStackC;
! OPgetsetvar4M.Error -> ErrorMgrProxy;
}
--- 121,130 ----
implementation {
components OPgetsetvar4M, OpStackC;
! components ErrorMgrProxy, VarUtilC;
BytecodeI = OPgetsetvar4M;
! OPgetsetvar4M.OpStackI -> OpStackC;
! OPgetsetvar4M.ErrorMgrI -> ErrorMgrProxy;
! OPgetsetvar4M.VarUtilI -> VarUtilC;
}
Index: OPgetsetvar4M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetsetvar4M.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPgetsetvar4M.nc 18 May 2006 19:58:41 -0000 1.3
--- OPgetsetvar4M.nc 26 May 2006 02:58:20 -0000 1.4
***************
*** 120,125 ****
uses
{
! interface ErrorMgrI as Error;
! interface OpStackI as Stacks;
}
}
--- 120,126 ----
uses
{
! interface ErrorMgrI;
! interface OpStackI;
! interface VarUtilI;
}
}
***************
*** 133,137 ****
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Heap Index out of range %i.\n", context->id.id, context->pc-1, arg);
! call Error.error(context, AGILLA_ERROR_INDEX_OUT_OF_BOUNDS);
return FAIL;
}
--- 134,138 ----
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Heap Index out of range %i.\n", context->id.id, context->pc-1, arg);
! call ErrorMgrI.error(context, AGILLA_ERROR_INDEX_OUT_OF_BOUNDS);
return FAIL;
}
***************
*** 140,152 ****
{
AgillaVariable var;
! if (call Stacks.popOperand(context, &var))
{
if (!(var.vtype & AGILLA_VAR_ASRTVL))
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Top of stack not an agentid, name, reading, type, or value.\n", context->id.id, context->pc-1);
! call Error.errord(context, AGILLA_ERROR_INVALID_TYPE, 0x0c);
return FAIL;
}
! dbg(DBG_USR1, "VM (%i:%i): Executing setvar %i, vtype = %i.\n", context->id.id, context->pc-1, arg, var.vtype);
context->heap.pos[arg] = var;
return SUCCESS;
--- 141,154 ----
{
AgillaVariable var;
! if (call OpStackI.popOperand(context, &var))
{
if (!(var.vtype & AGILLA_VAR_ASRTVL))
{
dbg(DBG_USR1, "VM (%i:%i): ERROR: Top of stack not an agentid, name, reading, type, or value.\n", context->id.id, context->pc-1);
! call ErrorMgrI.errord(context, AGILLA_ERROR_INVALID_TYPE, 0x0c);
return FAIL;
}
! dbg(DBG_USR1, "VM (%i:%i): Executing setvar %i, vtype = %s.\n", context->id.id, context->pc-1, arg,
! call VarUtilI.typeToString(var.vtype));
context->heap.pos[arg] = var;
return SUCCESS;
***************
*** 163,167 ****
{
context->condition = 1;
! call Stacks.pushOperand(context, &context->heap.pos[arg]);
}
return SUCCESS;
--- 165,169 ----
{
context->condition = 1;
! call OpStackI.pushOperand(context, &context->heap.pos[arg]);
}
return SUCCESS;
Index: OPrtsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPrtsM.nc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** OPrtsM.nc 23 May 2006 21:05:59 -0000 1.13
--- OPrtsM.nc 26 May 2006 02:58:20 -0000 1.14
***************
*** 1,409 ****
! // $Id$
!
! /* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, Washington University in Saint Louis
! * By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
! * as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
! * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
! *
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
! *
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
! *
! * See the GNU Lesser General Public License for more details, which can
! * be found here: http://www.gnu.org/copyleft/lesser.html
! */
!
! includes Agilla;
! includes AgillaOpcodes;
! includes TupleSpace;
!
! /**
! * Handles the initiation and termination of a remote tuple space
! * operation.
! *
! * @author Chien-Liang Fok
! */
! module OPrtsM {
! provides {
! interface BytecodeI;
! interface StdControl;
! }
! uses {
! interface NeighborListI;
! interface LocationMgrI;
! interface RemoteTSOpMgrI;
! interface AgentMgrI;
! interface TupleUtilI;
! interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
! interface Leds; // debug
! }
! }
! implementation {
!
! /**
! * Only one agent per mote can issue a remote tuple space
! * operation, _currAgent is a pointer to this agent's context.
! * If another agent attempts to perform a remote tuple space
! * operation while the _currAgent is waiting for results,
! * it's context is stored in the waitQueue and resumed when
! * the current agent finishes.
! */
! AgillaAgentContext* _currAgent;
!
! /**
! * Holds pending agents that are waiting for the current agent
! * to finish.
! */
! Queue waitQueue;
!
! /**
! * The instruction.
! */
! uint16_t _instr;
!
! /**
! * Remembers which neighbor we are dealing with. Used by
! * instruction routgs.
! */
! uint16_t _cNbrIndex;
!
! /**
! * The tuple or template parameter.
! */
! AgillaTuple tuple;
!
! task void doOProutgs();
! task void doOPrrdpgs();
!
! command result_t StdControl.init()
! {
! _currAgent = NULL;
! call QueueI.init(&waitQueue, OP_RTS_M);
! //call QueueI.init(&waitQueue, );
! //dbg(DBG_USR1, "OPrtsM queue is at address %i\n", (int)&waitQueue);
! return SUCCESS;
! }
!
! command result_t StdControl.start() {
! return SUCCESS;
! }
!
! command result_t StdControl.stop() {
! return SUCCESS;
! }
!
! inline result_t finish(result_t success)
! {
! _currAgent->condition = (uint16_t)success;
! call AgentMgrI.run(_currAgent);
! _currAgent = NULL;
!
! // If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
! }
! return SUCCESS;
! }
!
!
! event result_t RemoteTSOpMgrI.done(AgillaAgentContext* agent,
! uint16_t dest, result_t success)
! {
! if (_instr == IOProutgs)
! {
! if (post doOProutgs())
! return SUCCESS;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: RemoteTSOpMgrI.done(): ERROR: Could not post doOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! } else if (_instr == IOPrrdpgs)
! {
! if (success)
! {
! AgillaTuple buff;
! AgillaLocation loc;
!
! // remove the tuple from the agent's stack
! call TupleUtilI.getTuple(agent, &buff);
!
! // get the destination's location
! if (call LocationMgrI.getLocation(dest, &loc))
! {
! agent->heap.pos[0].value.value++; // update number of results
! agent->heap.pos[agent->heap.pos[0].value.value].vtype = AGILLA_TYPE_LOCATION;
! agent->heap.pos[agent->heap.pos[0].value.value].loc = loc;
!
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: OPrrdpgs: Saved location (%i, %i) onto heap[%i].\n",
! agent->heap.pos[agent->heap.pos[0].value.value].loc.x,
! agent->heap.pos[agent->heap.pos[0].value.value].loc.y,
! agent->heap.pos[0].value.value);
! #endif
! }
! }
!
! if (post doOPrrdpgs())
! return SUCCESS;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: RemoteTSOpMgrI.done(): ERROR: Could not post doOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! } else
! return finish(success);
! }
!
! /**
! * For debugging purposes.
! */
! inline void printDebug(AgillaAgentContext* context, uint8_t instr)
! {
! switch(instr) // print debug message
! {
! case IOProut:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProut.\n", context->id.id, context->pc-1);
! break;
! case IOPrinp:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrinp.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdp:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdp.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdpg:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdpg.\n", context->id.id, context->pc-1);
! break;
! case IOProutg:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProutg.\n", context->id.id, context->pc-1);
! break;
! case IOProutgs:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProutgs.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdpgs:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdpgs.\n", context->id.id, context->pc-1);
! break;
! }
! } // printDebug()
!
! /**
! * Execute a remote tuple space operation.
! *
! * @param instr The remote tuple space operation instruction.
! * @param context The agent performing the operation.
! * @return SUCCESS If the operation is being perfomed.
! */
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
! // Change the context's state to WAITING. This prevents the VM
! // from continuing to execute the agent.
! context->state = AGILLA_STATE_WAITING;
!
! // Mutual Exclusion. Only allow one agent to perform
! // a remote tuple space operation at a time.
! if (_currAgent != NULL)
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: execute(): Another agent is performing remote TS Op, waiting...\n");
! #endif
!
! context->pc--;
! return call QueueI.enqueue(context, &waitQueue, context);
! } else
! {
! uint16_t dest;
! _instr = instr;
!
! _currAgent = context;
!
! printDebug(context, instr);
!
! // Get the final destination address
! if (instr == IOPrrdpg || instr == IOProutg || instr == IOProutgs || instr == IOPrrdpgs)
! dest = TOS_BCAST_ADDR;
! else
! {
! AgillaVariable destV;
! if (call OpStackI.popOperand(_currAgent, &destV))
! {
! if (destV.vtype & AGILLA_VAR_V)
! dest = destV.value.value;
! else if (destV.vtype & AGILLA_VAR_L)
! dest = call LocationMgrI.getAddress(&destV.loc); // convert location to address
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Invalid destination type [%i].\n",
! _currAgent->id.id, _currAgent->pc-1, destV.vtype);
! call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x11, destV.vtype);
! return finish(FAIL);
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Could not pop destination off stack.\n",
! _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! }
!
! #if DEBUG_OP_RTS
! if (instr == IOProutgs || instr == IOPrrdpgs)
! dbg(DBG_USR1, "OPrtsM: final destination = every neighbor\n");
! else {
! dbg(DBG_USR1, "OPrtsM: final destination = %i\n", dest);
! }
! #endif
!
! // Get the template or tuple
! if(!call TupleUtilI.getTuple(_currAgent, &tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Could not get tuple.\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL); // could not get tuple
! } else
! {
! #if DEBUG_OP_RTS
! call TupleUtilI.printTuple(&tuple);
! #endif
! }
!
! if (instr == IOProutgs)
! {
! _cNbrIndex = 0;
! if (!post doOProutgs())
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() could not post dOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: posted task dOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! return SUCCESS;
! }
! }
!
! else if (instr == IOPrrdpgs)
! {
! _cNbrIndex = 0;
!
! // initialize the number of results
! _currAgent->heap.pos[0].vtype = AGILLA_TYPE_VALUE;
! _currAgent->heap.pos[0].value.value = 0;
!
! if (!post doOPrrdpgs())
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() could not post dOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: posted task dOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! return SUCCESS;
! }
! }
!
! else
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, instr, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! return SUCCESS;
! }
! }
! } // BytecodeI.execute
!
!
! task void doOProutgs()
! {
! if (call NeighborListI.numNeighbors() > _cNbrIndex)
! {
! uint16_t dest;
! if (call NeighborListI.getNeighbor(_cNbrIndex++, &dest))
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, IOProut, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: performing rout on node %i.\n", _currAgent->id.id, _currAgent->pc-1, dest);
! #endif
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: Could not get neighbor %i.\n", _currAgent->id.id, _currAgent->pc-1, _cNbrIndex-1);
! post doOProutgs();
! }
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: done performing routgs.\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! finish(SUCCESS);
! }
! }
!
! task void doOPrrdpgs()
! {
! if (call NeighborListI.numNeighbors() > _cNbrIndex)
! {
! uint16_t dest;
! if (call NeighborListI.getNeighbor(_cNbrIndex++, &dest))
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, IOPrrdp, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOPrrdpgs(): ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: performing rrdp on node %i.\n", _currAgent->id.id, _currAgent->pc-1, dest);
! #endif
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: Could not get neighbor %i.\n", _currAgent->id.id, _currAgent->pc-1, _cNbrIndex-1);
! post doOProutgs();
! }
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: done performing rrdpgs.\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! finish(SUCCESS);
! }
! }
! }
--- 1,409 ----
! // $Id$
!
! /* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, Washington University in Saint Louis
! * By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
! * as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
! * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
! *
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
! *
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
! *
! * See the GNU Lesser General Public License for more details, which can
! * be found here: http://www.gnu.org/copyleft/lesser.html
! */
!
! includes Agilla;
! includes AgillaOpcodes;
! includes TupleSpace;
!
! /**
! * Handles the initiation and termination of a remote tuple space
! * operation.
! *
! * @author Chien-Liang Fok
! */
! module OPrtsM {
! provides {
! interface BytecodeI;
! interface StdControl;
! }
! uses {
! interface NeighborListI;
! interface LocationMgrI;
! interface RemoteTSOpMgrI;
! interface AgentMgrI;
! interface TupleUtilI;
! interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
! interface Leds; // debug
! }
! }
! implementation {
!
! /**
! * Only one agent per mote can issue a remote tuple space
! * operation, _currAgent is a pointer to this agent's context.
! * If another agent attempts to perform a remote tuple space
! * operation while the _currAgent is waiting for results,
! * it's context is stored in the waitQueue and resumed when
! * the current agent finishes.
! */
! AgillaAgentContext* _currAgent;
!
! /**
! * Holds pending agents that are waiting for the current agent
! * to finish.
! */
! Queue waitQueue;
!
! /**
! * The instruction.
! */
! uint16_t _instr;
!
! /**
! * Remembers which neighbor we are dealing with. Used by
! * instruction routgs.
! */
! uint16_t _cNbrIndex;
!
! /**
! * The tuple or template parameter.
! */
! AgillaTuple tuple;
!
! task void doOProutgs();
! task void doOPrrdpgs();
!
! command result_t StdControl.init()
! {
! _currAgent = NULL;
! call QueueI.init(&waitQueue, OP_RTS_M);
! //call QueueI.init(&waitQueue, );
! //dbg(DBG_USR1, "OPrtsM queue is at address %i\n", (int)&waitQueue);
! return SUCCESS;
! }
!
! command result_t StdControl.start() {
! return SUCCESS;
! }
!
! command result_t StdControl.stop() {
! return SUCCESS;
! }
!
! inline result_t finish(result_t success)
! {
! _currAgent->condition = (uint16_t)success;
! call AgentMgrI.run(_currAgent);
! _currAgent = NULL;
!
! // If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
! }
! return SUCCESS;
! }
!
!
! event result_t RemoteTSOpMgrI.done(AgillaAgentContext* agent,
! uint16_t dest, result_t success)
! {
! if (_instr == IOProutgs)
! {
! if (post doOProutgs())
! return SUCCESS;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: RemoteTSOpMgrI.done(): ERROR: Could not post doOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! } else if (_instr == IOPrrdpgs)
! {
! if (success)
! {
! AgillaTuple buff;
! AgillaLocation loc;
!
! // remove the tuple from the agent's stack
! call TupleUtilI.getTuple(agent, &buff);
!
! // get the destination's location
! if (call LocationMgrI.getLocation(dest, &loc))
! {
! agent->heap.pos[0].value.value++; // update number of results
! agent->heap.pos[agent->heap.pos[0].value.value].vtype = AGILLA_TYPE_LOCATION;
! agent->heap.pos[agent->heap.pos[0].value.value].loc = loc;
!
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: OPrrdpgs: Saved location (%i, %i) onto heap[%i].\n",
! agent->heap.pos[agent->heap.pos[0].value.value].loc.x,
! agent->heap.pos[agent->heap.pos[0].value.value].loc.y,
! agent->heap.pos[0].value.value);
! #endif
! }
! }
!
! if (post doOPrrdpgs())
! return SUCCESS;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: RemoteTSOpMgrI.done(): ERROR: Could not post doOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! } else
! return finish(success);
! }
!
! /**
! * For debugging purposes.
! */
! inline void printDebug(AgillaAgentContext* context, uint8_t instr)
! {
! switch(instr) // print debug message
! {
! case IOProut:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProut.\n", context->id.id, context->pc-1);
! break;
! case IOPrinp:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrinp.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdp:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdp.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdpg:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdpg.\n", context->id.id, context->pc-1);
! break;
! case IOProutg:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProutg.\n", context->id.id, context->pc-1);
! break;
! case IOProutgs:
! dbg(DBG_USR1, "VM (%i:%i): Executing OProutgs.\n", context->id.id, context->pc-1);
! break;
! case IOPrrdpgs:
! dbg(DBG_USR1, "VM (%i:%i): Executing OPrrdpgs.\n", context->id.id, context->pc-1);
! break;
! }
! } // printDebug()
!
! /**
! * Execute a remote tuple space operation.
! *
! * @param instr The remote tuple space operation instruction.
! * @param context The agent performing the operation.
! * @return SUCCESS If the operation is being perfomed.
! */
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
! // Change the context's state to WAITING. This prevents the VM
! // from continuing to execute the agent.
! context->state = AGILLA_STATE_WAITING;
!
! // Mutual Exclusion. Only allow one agent to perform
! // a remote tuple space operation at a time.
! if (_currAgent != NULL)
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "OPrtsM: execute(): Another agent is performing remote TS Op, waiting...\n");
! #endif
!
! context->pc--;
! return call QueueI.enqueue(context, &waitQueue, context);
! } else
! {
! uint16_t dest;
! _instr = instr;
!
! _currAgent = context;
!
! printDebug(context, instr);
!
! // Get the final destination address
! if (instr == IOPrrdpg || instr == IOProutg || instr == IOProutgs || instr == IOPrrdpgs)
! dest = TOS_BCAST_ADDR;
! else
! {
! AgillaVariable destV;
! if (call OpStackI.popOperand(_currAgent, &destV))
! {
! if (destV.vtype & AGILLA_VAR_V)
! dest = destV.value.value;
! else if (destV.vtype & AGILLA_VAR_L)
! dest = call LocationMgrI.getAddress(&destV.loc); // convert location to address
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Invalid destination type [%i].\n",
! _currAgent->id.id, _currAgent->pc-1, destV.vtype);
! call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x11, destV.vtype);
! return finish(FAIL);
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Could not pop destination off stack.\n",
! _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! }
! }
!
! #if DEBUG_OP_RTS
! if (instr == IOProutgs || instr == IOPrrdpgs) {
! dbg(DBG_USR1, "OPrtsM: final destination = every neighbor\n");
! } else {
! dbg(DBG_USR1, "OPrtsM: final destination = %i\n", dest);
! }
! #endif
!
! // Get the template or tuple
! if(!call TupleUtilI.getTuple(_currAgent, &tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: Could not get tuple.\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL); // could not get tuple
! } else
! {
! #if DEBUG_OP_RTS
! call TupleUtilI.printTuple(&tuple);
! #endif
! }
!
! if (instr == IOProutgs)
! {
! _cNbrIndex = 0;
! if (!post doOProutgs())
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() could not post dOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: posted task dOProutgs().\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! return SUCCESS;
! }
! }
!
! else if (instr == IOPrrdpgs)
! {
! _cNbrIndex = 0;
!
! // initialize the number of results
! _currAgent->heap.pos[0].vtype = AGILLA_TYPE_VALUE;
! _currAgent->heap.pos[0].value.value = 0;
!
! if (!post doOPrrdpgs())
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() could not post dOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: posted task dOPrrdpgs().\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! return SUCCESS;
! }
! }
!
! else
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, instr, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! return finish(FAIL);
! } else
! return SUCCESS;
! }
! }
! } // BytecodeI.execute
!
!
! task void doOProutgs()
! {
! if (call NeighborListI.numNeighbors() > _cNbrIndex)
! {
! uint16_t dest;
! if (call NeighborListI.getNeighbor(_cNbrIndex++, &dest))
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, IOProut, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: performing rout on node %i.\n", _currAgent->id.id, _currAgent->pc-1, dest);
! #endif
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: Could not get neighbor %i.\n", _currAgent->id.id, _currAgent->pc-1, _cNbrIndex-1);
! post doOProutgs();
! }
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: done performing routgs.\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! finish(SUCCESS);
! }
! }
!
! task void doOPrrdpgs()
! {
! if (call NeighborListI.numNeighbors() > _cNbrIndex)
! {
! uint16_t dest;
! if (call NeighborListI.getNeighbor(_cNbrIndex++, &dest))
! {
! if (!call RemoteTSOpMgrI.execute(_currAgent, IOPrrdp, dest, tuple))
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOPrrdpgs(): ERROR: RemoteTSOpMgrI.execute() returned fail.\n", _currAgent->id.id, _currAgent->pc-1);
! finish(FAIL);
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: performing rrdp on node %i.\n", _currAgent->id.id, _currAgent->pc-1, dest);
! #endif
! }
! } else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM.doOProutgs(): ERROR: Could not get neighbor %i.\n", _currAgent->id.id, _currAgent->pc-1, _cNbrIndex-1);
! post doOProutgs();
! }
! } else
! {
! #if DEBUG_OP_RTS
! dbg(DBG_USR1, "VM (%i:%i): OPrtsM: done performing rrdpgs.\n", _currAgent->id.id, _currAgent->pc-1);
! #endif
! finish(SUCCESS);
! }
! }
! }
--- OPgetAgents.nc DELETED ---
--- OPgetAgentsCM.nc DELETED ---
--- OPgetAgentsM.nc DELETED ---
--- OPgetClosestAgent.nc DELETED ---
--- OPgetClosestAgentCM.nc DELETED ---
--- OPgetClosestAgentM.nc DELETED ---
--- OPgetNumAgents.nc DELETED ---
--- OPgetNumAgentsCM.nc DELETED ---
--- OPgetNumAgentsM.nc DELETED ---
--- OPgetlocation.nc DELETED ---
--- OPgetlocationCM.nc DELETED ---
--- OPgetlocationM.nc DELETED ---
More information about the Tinyos-contrib-commits
mailing list