home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / transput / 1425 < prev    next >
Encoding:
Text File  |  1993-01-26  |  1.8 KB  |  45 lines

  1. Path: sparky!uunet!math.fu-berlin.de!uni-paderborn.de!knut
  2. From: knut@uni-paderborn.de (Knut Menzel)
  3. Newsgroups: comp.sys.transputer
  4. Subject: Re: "Counted Array"
  5. Date: 26 Jan 1993 13:46:29 GMT
  6. Organization: University of Paderborn
  7. Lines: 31
  8. Distribution: world
  9. Message-ID: <1k3fblINNnjp@news.uni-paderborn.de>
  10. References: <19JAN199314153354@vxcrna.cern.ch>
  11. Reply-To: knut@uni-paderborn.de
  12. NNTP-Posting-Host: ruhr.uni-paderborn.de
  13.  
  14. |> Hi Netters
  15. |> I am shifting my focus from Occam to C now. The following question made 
  16. |> me confusing, i.e. how to implemente the counted array of Occam in C 
  17. |> efficiently?
  18. |> For example, we can replace 
  19. |> 
  20. |> Input ? Length :: Array -- In Occam, receiving the length and array together
  21. |> with two C channel statements
  22. |> 
  23. |> Len = ChanInInt(Input)     /* In C, the Length must be known in advance
  24. |> ChanIn(Input, Array, Length)
  25.  
  26. The normal way to implement the counted array of Occam in C efficiently
  27. is the same as in Occam. Use two channel statements...
  28.  
  29.     Len = ChanInInt(Input)    /* Receiving the length of the next stream */
  30.     ChanIn(Input, Array, Len) /* Receiving the data of size Len */
  31.  
  32. That's all. Instead of the first statement it is possible to send a header
  33. of constant length to the receiving node in order to present more information
  34. of the sender (function number, ID of sender,...) than just an integer.
  35.  
  36. -- Knut
  37. --------------------------------------------------------------------------
  38.  Knut Menzel                          University of Paderborn
  39.  email:   knut@uni-paderborn.de       Department of Computer Science FB17
  40.           ...!uunet!unido!pbinfo!knut Warburger Str. 100
  41.  Tel:     +49 5251 603325             D-4790 Paderborn
  42.  Telefax: +49 5251 603853
  43. --------------------------------------------------------------------------
  44.  
  45.