/** * Called by the {@link ASporadicStm} node from {@link ASporadicStm#apply(IAnalysis)}. * @param node the calling {@link ASporadicStm} node */ public void caseASporadicStm(ASporadicStm node, Q question) throws AnalysisException { _visitedNodes.add(node); inASporadicStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getOpname() != null ) { node.getOpname().apply(this, question); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outASporadicStm(node, question); }
/** * Creates a new tree field only constructor {@code ASporadicStm TAG=sporadic} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param opname_ the {@link ILexNameToken} node for the {@code opname} child of this {@link ASporadicStm} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ASporadicStm} node */ public ASporadicStm(ILexLocation location_, ILexNameToken opname_, List<? extends PExp> args_) { super(location_,null); this.setOpname(opname_); this.setArgs(args_); this.setMinDelay(0L); this.setMaxDelay(0L); this.setOffset(0L); }
List<PExp> args = node.getArgs(); TypeCheckerErrors.report(3287, "Sporadic thread must have 3 arguments", node.getLocation(), node); } else ILexNameToken opname = node.getOpname(); opname.setTypeQualifier(new LinkedList<PType>()); opname.getLocation().hit(); TypeCheckerErrors.report(3228, opname + " is not in scope", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); AOperationType expected = AstFactory.newAOperationType(node.getLocation(), new Vector<PType>(), AstFactory.newAVoidType(node.getLocation())); opdef = question.assistantFactory.createPDefinitionAssistant().deref(opdef); + " should have no parameters or return type", node.getLocation(), node); TypeCheckerErrors.detail("Actual", def.getType()); TypeCheckerErrors.report(3347, "Cannot have a pure operation as the body of a thread", node.getLocation(), node); TypeCheckerErrors.report(3230, opname + " is implicit", node.getLocation(), node); + " should have no parameters or return type", node.getLocation(), node); TypeCheckerErrors.detail("Actual", def.getType()); TypeCheckerErrors.report(3347, "Cannot have a pure operation as the body of a thread", node.getLocation(), node); TypeCheckerErrors.report(3232, opname + " is not an operation name", node.getLocation(), node);
final int OFFSET = 2; node.setMinDelay(0L); node.setMaxDelay(0L); node.setOffset(0L); for (PExp arg : node.getArgs()) VdmRuntimeError.abort(node.getLocation(), 4157, "Expecting +ive integer in sporadic argument " + (i + 1) + ", was " + value, ctxt); node.setMinDelay(value); } else if (i == MAXDELAY) node.setMaxDelay(value); } else if (i == OFFSET) node.setOffset(value); VdmRuntimeError.abort(node.getLocation(), 4157, "Expecting +ive integer in sporadic argument " + (i + 1) + ", was " + argval, ctxt);
ss.apply(VdmRuntime.getStatementEvaluator(), pctxt); // Ignore return value } finally OperationValue pop = pctxt.lookup(ss.getOpname()).operationValue(pctxt); long delay = ss.getMinDelay(); long jitter = ss.getMaxDelay(); // Jitter used for maximum delay long offset = ss.getOffset(); long period = 0;
@Override public LexNameSet caseASporadicStm(ASporadicStm node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); for (PExp arg: node.getArgs()) { names.addAll(arg.apply(this, info)); } return names; }
/** * Called by the {@link ASporadicStm} node from {@link ASporadicStm#apply(IAnalysis)}. * @param node the calling {@link ASporadicStm} node */ public void caseASporadicStm(ASporadicStm node) throws AnalysisException { _visitedNodes.add(node); inASporadicStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getOpname() != null ) { node.getOpname().apply(this); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outASporadicStm(node); }
/** * Creates a new complete constructor {@code ASporadicStm} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param opname_ the {@link ILexNameToken} node for the {@code opname} child of this {@link ASporadicStm} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ASporadicStm} node * @param minDelay_ the {@link Long} <b>graph</a> node for the {@code minDelay} child of this {@link ASporadicStm} node. * <i>The parent of this {@code minDelay } will not be changed by adding it to this node.</i> * @param maxDelay_ the {@link Long} <b>graph</a> node for the {@code maxDelay} child of this {@link ASporadicStm} node. * <i>The parent of this {@code maxDelay } will not be changed by adding it to this node.</i> * @param offset_ the {@link Long} <b>graph</a> node for the {@code offset} child of this {@link ASporadicStm} node. * <i>The parent of this {@code offset } will not be changed by adding it to this node.</i> */ public ASporadicStm(ILexLocation location_, PType type_, ILexNameToken opname_, List<? extends PExp> args_, Long minDelay_, Long maxDelay_, Long offset_) { super(location_,type_); this.setOpname(opname_); this.setArgs(args_); this.setMinDelay(minDelay_); this.setMaxDelay(maxDelay_); this.setOffset(offset_); }
/** * Called by the {@link ASporadicStm} node from {@link ASporadicStm#apply(IPOFAnalysis)}. * @param node the calling {@link ASporadicStm} node */ public void caseASporadicStm(ASporadicStm node) throws AnalysisException { _visitedNodes.add(node); inASporadicStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getOpname() != null ) { node.getOpname().apply(this); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outASporadicStm(node); }
/** * Called by the {@link ASporadicStm} node from {@link ASporadicStm#apply(IAnalysis)}. * @param node the calling {@link ASporadicStm} node */ public A caseASporadicStm(ASporadicStm node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inASporadicStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getOpname() != null ) { mergeReturns(retVal,node.getOpname().apply(this)); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } mergeReturns(retVal,outASporadicStm(node)); return retVal; }
/** * Called by the {@link ASporadicStm} node from {@link ASporadicStm#apply(IAnalysis)}. * @param node the calling {@link ASporadicStm} node */ public A caseASporadicStm(ASporadicStm node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inASporadicStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getOpname() != null ) { mergeReturns(retVal,node.getOpname().apply(this, question)); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } mergeReturns(retVal,outASporadicStm(node, question)); return retVal; }