bug-dezyne
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] wfc: Reject "external" and "injected" on provides port.


From: Jan (janneke) Nieuwenhuizen
Subject: [PATCH 1/2] wfc: Reject "external" and "injected" on provides port.
Date: Fri, 16 Sep 2022 15:14:37 +0200

Reported by Michiel Fortuin <mfortuin@kns.com> via bug-dezyne@nongnu.org.

* dzn/wfc.scm (wfc<port>): Return error for external or injected
provides port.
* doc/dezyne.texi (External): Explicitly mention that external is for
requires ports.
---
 doc/dezyne.texi | 8 ++++----
 dzn/wfc.scm     | 6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/dezyne.texi b/doc/dezyne.texi
index 71944a591..da7cc5915 100644
--- a/doc/dezyne.texi
+++ b/doc/dezyne.texi
@@ -4561,10 +4561,10 @@ ports.
 @subsubsection @code{external}
 
 @cindex external
-The @code{external} keyword specifies that communication over a port may
-experience a delay.  This may for instance be caused by the switch
-between execution contexts as in inter-process communication or the use
-of threads.
+The @code{external} keyword specifies that communication over a
+@code{requires} port may experience a delay.  This may for instance be
+caused by the switch between execution contexts as in inter-process
+communication or the use of threads.
 
 @example
 @b{requires} @b{external} itimer t;
diff --git a/dzn/wfc.scm b/dzn/wfc.scm
index 11c5186e4..509ae595d 100644
--- a/dzn/wfc.scm
+++ b/dzn/wfc.scm
@@ -173,6 +173,12 @@
 (define-method (wfc (o <port>))
   (append
    (re-definition o)
+   (if (and (ast:provides? o) (ast:external? o))
+       `(,(wfc-error o (format #f "provides port `~a' cannot be external" 
(.name o))))
+       '())
+   (if (and (ast:provides? o) (ast:injected? o))
+       `(,(wfc-error o (format #f "provides port `~a' cannot be injected" 
(.name o))))
+       '())
    (if (ast:name-equal? (.name (parent o <model>)) (.name o))
        `(,(wfc-error o (format #f "port `~a' must not have the same name as 
the model it is defined in" (.name o))))
        '())
-- 
2.35.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]