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

  1. Path: sparky!uunet!noc.near.net!nic.umass.edu!dime!roo.cs.umass.edu!pop
  2. From: pop@cs.umass.edu ( Robin Popplestone )
  3. Newsgroups: comp.lang.pop
  4. Subject: When the (Gibson) cat's away across the atlantic....
  5. Keywords: vision, butchering-of-vectors danger
  6. Message-ID: <57967@dime.cs.umass.edu>
  7. Date: 23 Dec 92 14:10:39 GMT
  8. Sender: news@dime.cs.umass.edu
  9. Organization: University of Massachusetts, Amherst
  10. Lines: 25
  11. Originator: pop@roo.cs.umass.edu
  12.  
  13. Needing to crunch a quarter of a million pixels in a hurry I have been
  14. reduced to writing 600 lines of C. How, I wondered to let C report its
  15. answers back to POP - these had to be line-segment records as well  as
  16. an 512*512 array  (something like the  Ramsay and Barrett  line-finder
  17. souped up) Now the array  was no problem - POP  knows how big it  will
  18. be, and just gives  C the array vector.  Line segments, the number  of
  19. which cannot be predicted, presented  a harder problem. I didn't  want
  20. to use a call-back to the POPLOG allocator, for various reasons.  So I
  21. made POP  hand C  a large  vector, which  C then  carves into  segment
  22. records (using a segment-key handed in as an argument) and a left-over
  23. vector. This is safe (once I got the bugs out), provided the C program
  24. can't be interrupted by a signal (since C is left with no compromising
  25. pointers), but is clearly in danger of being upstaged by any change in
  26. POPLOG. It  is  also mostly  satisfactory,  in the  sense  that  store
  27. doesn't get fragmented, and the implementation is efficient.
  28.  
  29. I suppose my question is - might some conventions and .h files etc. be
  30. provided to allow one to do this kind of thing in a way that would  be
  31. proof against version change. [One of the main pains in this  exercise
  32. is that C  doesn't let  offset pointers  into structures  the way  POP
  33. does, so that there is  no neat solution to  being able to access  all
  34. the fields (including  the key)  while maintaining  the C  size =  the
  35. actual size of the POP record.].
  36.  
  37. Robin
  38.