home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Tickle-4.0.sit.hqx / Tickle-4.0 / src / XTCL_callback.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  68 lines

  1. /*
  2. ** This source code was written by Tim Endres
  3. ** Email: time@ice.com.
  4. ** USMail: 8840 Main Street, Whitmore Lake, MI  48189
  5. **
  6. ** Some portions of this application utilize sources
  7. ** that are copyrighted by ICE Engineering, Inc., and
  8. ** ICE Engineering retains all rights to those sources.
  9. **
  10. ** Neither ICE Engineering, Inc., nor Tim Endres, 
  11. ** warrants this source code for any reason, and neither
  12. ** party assumes any responsbility for the use of these
  13. ** sources, libraries, or applications. The user of these
  14. ** sources and binaries assumes all responsbilities for
  15. ** any resulting consequences.
  16. */
  17.  
  18. #include <Types.h>
  19. #include <Resources.h>
  20. #include <QuickDraw.h>
  21. #include <Windows.h>
  22. #include <Memory.h>
  23. #include "tcl.h"
  24. #include "xtcl.h"
  25.  
  26. void
  27. XTCLEntry(argc, argv, xpb)
  28. int            argc;
  29. char        **argv;
  30. XTCLParmBlk    *xpb;
  31. {
  32. long    length;
  33. int        result;
  34. Handle    rHandle, sHandle;
  35. char    *script = argv[1];
  36.  
  37. #pragma unused (argc)
  38.  
  39.     xpb->result = TCL_OK;
  40.     
  41.     length = strlen(script);
  42.     sHandle = NewHandle(length+1);
  43.     rHandle = NewHandle(0);
  44.     
  45.     if (sHandle != NULL && rHandle != NULL) {
  46.         
  47.         strcpy(*sHandle, script);
  48.         result = (* xpb->eval)(xpb, sHandle, rHandle, NULL);
  49.         
  50.         length = GetHandleSize(rHandle);
  51.         SetHandleSize(xpb->resultH, length + 1);
  52.         if (MemError() == noErr) {
  53.             memcpy(*xpb->resultH, *rHandle, GetHandleSize(rHandle));
  54.             * (*xpb->resultH + length) = '\0';
  55.             }
  56.         else
  57.             result = TCL_ERROR;
  58.         
  59.         xpb->result = result;
  60.         }
  61.     
  62.     if (sHandle != NULL)
  63.         DisposHandle(sHandle);
  64.     if (rHandle != NULL)
  65.         DisposHandle(rHandle);
  66.     }
  67.  
  68.