[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/ustutt/ncunit/java/net/tinyos/nesc/dump/xml
Xfield.java, NONE, 1.1 Xwiring.java, NONE, 1.1 Xcomponent.java,
NONE, 1.1 Xfunction.java, NONE, 1.1
Andreas Lachenmann
lachenmann at users.sourceforge.net
Tue Feb 20 04:33:07 PST 2007
Update of /cvsroot/tinyos/tinyos-1.x/contrib/ustutt/ncunit/java/net/tinyos/nesc/dump/xml
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4808/contrib/ustutt/ncunit/java/net/tinyos/nesc/dump/xml
Added Files:
Xfield.java Xwiring.java Xcomponent.java Xfunction.java
Log Message:
added files to repository
--- NEW FILE: Xfield.java ---
/*
* CVS Information
*
* File: $RCSfile: Xfield.java,v $
* Revision: $Revision: 1.1 $
* Author: $Author: lachenmann $
* Date: $Date: 2007/02/20 12:33:05 $
*/
package net.tinyos.nesc.dump.xml;
//$Id: Xfield.java,v 1.1 2007/02/20 12:33:05 lachenmann Exp $
/* tab:4
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
import net.tinyos.nesc.dump.*;
import org.xml.sax.*;
import java.util.*;
/**
* A field in a structure. Note: these are always defined.
*/
public class Xfield extends Definition
{
/**
* Name of the field. Note that it may not be unique (because of
* anonymous structs/unions collapsed into the containing struct).
*/
public String name;
/**
* Unique identifier for this field.
*/
public String ref;
/**
* Type of this field.
*/
public Type type;
/**
* Structure this field belongs to.
*/
public StructureDefinition container;
/**
* Offset in bits for this field from the start of the structure.
* Note that this may be an UnknownConstant or a NonConstant.
*/
public Constant bitOffset;
/**
* Size in bytes for this field. Note that this may be an
* UnknownConstant or a NonConstant.
*/
public Constant size;
/**
* For bitfields only: size in bits for this field. Note that
* this may be an UnknownConstant (within generic components).
*/
public Constant bitSize;
/**
* true if the gcc "packed" attribute was specified for this field.
*/
public boolean packed;
public void init(Attributes attrs) {
ref = attrs.getValue("ref");
name = attrs.getValue("name"); //AL bug fix, was "field"
}
public synchronized NDElement start(Attributes attrs) {
Xfield me = (Xfield)Xnesc.defsXfield.define(attrs.getValue("ref"), attrs, this);
me.bitOffset = Constant.decode(attrs.getValue("bit-offset"));
me.packed = boolDecode(attrs.getValue("packed"));
String s = attrs.getValue("size");
if (s != null)
me.size = Constant.decode(s);
s = attrs.getValue("bit-size");
if (s != null)
me.bitSize = Constant.decode(s);
return me;
}
static synchronized Definition lookup(NDReader reader, Attributes attrs) {
return Xnesc.defsXfield.lookup(reader, attrs.getValue("ref"), attrs, "field");
}
public void child(NDElement subElement) {
super.child(subElement);
if (subElement instanceof Type)
type = (Type)subElement;
}
}
--- NEW FILE: Xwiring.java ---
/*
* CVS Information
*
* File: $RCSfile: Xwiring.java,v $
* Revision: $Revision: 1.1 $
* Author: $Author: lachenmann $
* Date: $Date: 2007/02/20 12:33:05 $
*/
// $Id: Xwiring.java,v 1.1 2007/02/20 12:33:05 lachenmann Exp $
/* tab:4
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
package net.tinyos.nesc.dump.xml;
import java.util.Collection;
import java.util.HashSet;
import org.xml.sax.*;
/**
* Top-level wiring graph.
*/
public class Xwiring extends NDElement
{
/**
* The application's wiring graph
*/
public static WiringGraph wg = new WiringGraph();
public Collection wires = new HashSet();
public void child(NDElement subElement) {
wg.addEdge((Xwire)subElement);
wires.add(subElement);
}
}
--- NEW FILE: Xcomponent.java ---
/*
* CVS Information
*
* File: $RCSfile: Xcomponent.java,v $
* Revision: $Revision: 1.1 $
* Author: $Author: lachenmann $
* Date: $Date: 2007/02/20 12:33:05 $
*/
package net.tinyos.nesc.dump.xml;
//$Id: Xcomponent.java,v 1.1 2007/02/20 12:33:05 lachenmann Exp $
/* tab:4
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
import org.xml.sax.*;
/**
* A nesC component.
*/
public class Xcomponent extends NescDefinition implements Container
{
/**
* (definition only) For instances of generic components: what
* component this is an instance of, along with the instantiation
* arguments. Null for non-instance components.
*/
public Xinstance instance;
/**
* (definition only) For generic components: the parameters for
* this generic component. Null for non-generic components.
*/
public Xparameters parameters; /* present iff component is generic */
public Xwiring wiring;
/**
* (definition only) Implementation of this component.
*/
public Implementation implementation;
public void child(NDElement subElement) {
if (subElement instanceof Xinstance)
instance = (Xinstance)subElement;
if (subElement instanceof Xparameters)
parameters = (Xparameters)subElement;
if (subElement instanceof Implementation)
implementation = (Implementation)subElement;
if (subElement instanceof Xwiring) {
wiring = (Xwiring) subElement;
}
}
}
--- NEW FILE: Xfunction.java ---
// $Id: Xfunction.java,v 1.1 2007/02/20 12:33:05 lachenmann Exp $
/* tab:4
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
package net.tinyos.nesc.dump.xml;
import java.util.LinkedList;
import org.xml.sax.*;
/**
* A function.
*/
public class Xfunction extends DataDefinition implements Container
{
/**
* Parameters of the function.
*/
public LinkedList/*Variables*/ parameters = new LinkedList(); //AL, was missing
/**
* Non-null for commands and events of interfaces of components
* (but null for those representing the command and event
* definition in an interfacedef).
*/
public Xinterface intf;
/**
* true for functions that are commands.
*/
public boolean command;
/**
* true for functions that are events.
*/
public boolean event;
public Xfunction() {
super();
}
public NDElement start(Attributes attrs) {
Xfunction me = (Xfunction)super.start(attrs);
me.command = boolDecode(attrs.getValue("command"));
me.event = boolDecode(attrs.getValue("event"));
return me;
}
public void child(NDElement subElement) {
/* Intercept references to a containing interface before we call
super.child, as this is not the actual container for this
function (the container is the component, not the interface) */
if (subElement instanceof Xinterface)
intf = (Xinterface)intf;
else if (subElement instanceof Xparameters) //AL, was missing
parameters = ((Xparameters)subElement).l;
else
super.child(subElement);
}
}
More information about the Tinyos-contrib-commits
mailing list