XML

kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for delay

2011

Question 46 (2011):

Submission reference: IN2079

I get:

    Error-occ21-q7.occ(40)- cannot open file "time.module"

I've looked in lib and sure enough it isn't there...

Answer 46:

This looks like a response to the answer in Question 43 (2011). It looks like the search path set up for you on the Transterpreter doesn't reach all the libraries – which would be our fault.

However, that question was seeking a delay process and I'm assuming that that is what you are still seeking? The function of delay in the "time.module" is, as its documentation says, identical to the pause process given in your starter files for q1, q2, q3 and q4 (and e1). Just copy and use that – it's only these 7 lines of code:

    PROC pause (VAL INT delay)
      TIMER tim:
      INT t:
      SEQ
        tim ? t
        tim ? AFTER t PLUS delay
    :

Keywords: q7 , delay , timers


Question 43 (2011):

Submission reference: IN2077

I get:

    Error-occ21-q7.occ(133)- delay is not declared

I looked at the occam documentation and it is there! What am I doing wrong?

Answer 43:

Indeed it is: delay. However, if you scroll up from this documentation, you will see that it's in the module time. To use this, you will need the line:

    #INCLUDE "time.module"

somewhere before you use delay in your code (next to the #INCLUDE line for "course.module").

We did not put the delay in the course module. It seemed too simple and you have been using it in many of your provious assignments (where its code was given in the starter files). We did not put it in the starter file for the Dining Philosophers' animation, since many solutions would use TIMERs directly.

POSTSCRIPT: apologies, I was confused by the incosistency in the names we chose! The starter files for q1..q4 have a delay process called pause. This has the same functionality as the delay process called delay in the "time.module".

Keywords: q7 , delay , timers

Referrers: Question 46 (2011)

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:26 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.