home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pop / 180 < prev    next >
Encoding:
Internet Message Format  |  1993-01-01  |  1.6 KB

  1. From: sfk@otter.hpl.hp.com (Steve Knight)
  2. Date: Fri, 1 Jan 1993 17:46:32 GMT
  3. Subject: Re: When the (Gibson) cat's away across the atlantic....
  4. Message-ID: <116670043@otter.hpl.hp.com>
  5. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  6. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!col.hp.com!news.dtc.hp.com!hpscit.sc.hp.com!hplextra!otter.hpl.hp.com!otter!sfk
  7. Newsgroups: comp.lang.pop
  8. References: <57967@dime.cs.umass.edu>
  9. Lines: 23
  10.  
  11. Robin Popplestone writes:
  12. > Needing to crunch a quarter of a million pixels in a hurry I have been
  13. > reduced to writing 600 lines of C. How, I wondered to let C report its
  14. > answers back to POP - these had to be line-segment records as well  as
  15. > an 512*512 array  (something like the  Ramsay and Barrett  line-finder
  16. > souped up) Now the array  was no problem - POP  knows how big it  will
  17. > be, and just gives  C the array vector.  Line segments, the number  of
  18. > which cannot be predicted, presented  a harder problem. I didn't  want
  19. > to use a call-back to the POPLOG allocator, for various reasons.  So I
  20. > made POP  hand C  a large  vector, which  C then  carves into  segment
  21. > records (using a segment-key handed in as an argument) and a left-over
  22. > vector.
  23.  
  24. While supporting Robin's request for suitable .h files to make this
  25. kind of programming safer, I am puzzled by the need for it here.
  26.  
  27. Why not pre-allocate all the line-segment records and stick them
  28. into a vector (null-terminated)?  This vector can then be passed to
  29. C with impunity.  It is admittedly slightly more space consuming 
  30. and likely to take more slightly time to preallocate.  But this
  31. seems like quite an acceptable cost to me.
  32.  
  33. Steve
  34.