home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Telnet 2.7b5 / source / tek / tekstor.c < prev    next >
Encoding:
Text File  |  1995-04-01  |  5.1 KB  |  45 lines  |  [TEXT/CWIE]

  1. /* This has been rewritten to use one damn handle to hold all of the data. -- JMB */
  2.  
  3. #ifdef MPW
  4. #pragma segment TEKMAIN
  5. #endif
  6.  
  7. #include "vgtek.proto.h"
  8. #include "rg0.proto.h"
  9. #include "rgmp.proto.h"
  10. #include "tekrgmac.proto.h"
  11. #include "tekdefs.h"    /* NCSA: sb - all defines are now here, for easy access */
  12. #include "tekstor.proto.h"
  13.  
  14. //    thiselnum runs from 0 to (handlesize-1), which is in accordance with C style
  15. //    arrays.  The handle is indexed 0...(handlesize-1) as well.  This is why you see
  16. //    the various +-1's. -- JMB 8/93
  17.  
  18. TEKSTOREP    newTEKstore(void)
  19. {
  20.     TEKSTOREP    s;
  21.     
  22.     s = (TEKSTOREP) myNewPtr(sizeof(TEKSTORE));
  23.     if (s == NULL) return (NULL);
  24.     
  25.     if (!(s->dataHandle = myNewHandle(0L)))
  26.         return (NULL);
  27.     
  28.     s->thiselnum = 0;
  29.     
  30.     return(s);
  31. }
  32.  
  33. void freeTEKstore(TEKSTOREP s)
  34. {
  35.     DisposeHandle(s->dataHandle);
  36.     DisposePtr((Ptr) s);
  37. }
  38.  
  39. short    addTEKstore(TEKSTOREP s, char d)
  40. {
  41.     Size    handlesize;
  42.     OSErr    memErr;
  43.     handlesize = GetHandleSize(s->dataHandle);
  44.     memErr = mySetHandleSize(s->dataHandle, ++handlesize);
  45.     if (m