lib/sema.txt
author mjsousa
Sun, 13 Jul 2014 13:47:16 +0100
changeset 910 a0518971127d
parent 251 5e7457efbb8f
permissions -rw-r--r--
Narrow array subscripts correctly, even in the presence of other datatype errors (so we do not generate error messages for array subscripts that do not contain errors).
(*
 * (c) 2011 Edouard Tisserant
 *
 * Fake semaphore support, for non preemptive implementation.
 *
 *)


FUNCTION_BLOCK SEMA
  VAR_INPUT
    CLAIM : BOOL;
    RELEASE : BOOL;
  END_VAR
  VAR_OUTPUT
    BUSY : BOOL;
  END_VAR
  VAR
    Q_INTERNAL : BOOL;
  END_VAR

  Q_INTERNAL := CLAIM OR ( Q_INTERNAL AND (NOT RELEASE));
  BUSY := Q_INTERNAL;

END_FUNCTION_BLOCK