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 / PROC_AEVTtcl1eval.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  89 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 <AppleEvents.h>
  24. #include <Aliases.h>
  25. #include "tcl.h"
  26. #include "xproc.h"
  27.  
  28. pascal OSErr
  29. PROCEntry(message, reply, refcon)
  30. AppleEvent        *message;
  31. AppleEvent        *reply;
  32. long            refcon;
  33. {
  34. int            myerr, result = noErr;
  35. long        length;
  36. AEDesc        theDesc;
  37. Handle        rHandle;
  38. XPROCPBPtr    cbpb;
  39.  
  40.     cbpb = (XPROCPBPtr) refcon;
  41.     dprintf("AEVT: class 'tcl1' event 'eval' ");
  42.     
  43.     myerr = AEGetParamDesc(message, keyDirectObject, typeChar, &theDesc);
  44.     if (myerr != noErr) {
  45.         result = myerr;
  46.         dprintf("GetParamDesc error %d in AEVT-source", myerr);
  47.         }
  48.     else
  49.         {
  50.         length = GetHandleSize(theDesc.dataHandle);
  51.         SetHandleSize(theDesc.dataHandle, length + 1);
  52.         if (MemError() == noErr)
  53.             {
  54.             * (*theDesc.dataHandle + length) = '\0';
  55.             rHandle = NewHandle(0);
  56.             
  57.             if (rHandle != NULL) {
  58.             
  59.                 result = (* cbpb->eval)(cbpb, theDesc.dataHandle, rHandle, NULL);
  60.                 
  61.                 length = GetHandleSize(rHandle);
  62.                 if (result == TCL_OK)
  63.                     {
  64.                     HLock(rHandle);
  65.                     myerr = AEPutParamPtr(reply, keyDirectObject, typeChar,
  66.                                             *rHandle, length);
  67.                     HUnlock(rHandle);
  68.                     }
  69.                 else if (length > 0)
  70.                     {
  71.                     HLock(rHandle);
  72.                     myerr = AEPutParamPtr(reply, keyErrorString, typeChar,
  73.                                             *rHandle, length);
  74.                     HUnlock(rHandle);
  75.                     }
  76.                 
  77.                 DisposHandle(rHandle);
  78.                 }
  79.             else
  80.                 result = MemError();
  81.             }
  82.         
  83.         AEDisposeDesc(&theDesc);
  84.         }
  85.     
  86.     return result;
  87.     }
  88.  
  89.