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_Pascal_callback.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  70 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. pascal void
  27. PXTCLEntry(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. extern pascal int XTCLCallBack(XTCLParmBlk *xpb, Handle sH, Handle rH, Handle oH);
  37.  
  38. #pragma unused (argc)
  39.  
  40.     xpb->result = TCL_OK;
  41.     
  42.     length = strlen(script);
  43.     sHandle = NewHandle(length+1);
  44.     rHandle = NewHandle(0);
  45.     
  46.     if (sHandle != NULL && rHandle != NULL) {
  47.         
  48.         strcpy(*sHandle, script);
  49.         result = XTCLCallBack(xpb, sHandle, rHandle, NULL);
  50.         /* result = (* xpb->eval)(xpb, sHandle, rHandle, NULL); */
  51.         
  52.         length = GetHandleSize(rHandle);
  53.         SetHandleSize(xpb->resultH, length + 1);
  54.         if (MemError() == noErr) {
  55.             memcpy(*xpb->resultH, *rHandle, GetHandleSize(rHandle));
  56.             * (*xpb->resultH + length) = '\0';
  57.             }
  58.         else
  59.             result = TCL_ERROR;
  60.         
  61.         xpb->result = result;
  62.         }
  63.     
  64.     if (sHandle != NULL)
  65.         DisposHandle(sHandle);
  66.     if (rHandle != NULL)
  67.         DisposHandle(rHandle);
  68.     }
  69.  
  70.