iacops.c

Go to the documentation of this file.
00001 
00002 /*  $Id: iacops.c 1198 2006-04-05 22:03:52Z karstenw $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 /*
00008 7/16/94 dmb: Updated for Univeral Headers, PowerPC
00009 */
00010 
00011 
00012 #include "frontier.h"
00013 #include "standard.h"
00014 
00015 #include "iacinternal.h"
00016 
00017 
00018 AEIdleUPP IACwaitroutineUPP = nil;
00019 
00020 
00021 void IACcopystring (void *source, void *dest) {
00022 
00023     /*
00024     create a copy of source in dest.  copy the length byte and
00025     all the characters in the source string.
00026 
00027     assume the strings are pascal strings, with the length byte in
00028     the first character of the string.
00029     */
00030     
00031     char *s = source, *d = dest;
00032     short i, len;
00033     
00034     len = (short) s [0];
00035     
00036     for (i = 0; i <= len; i++) 
00037         *d++ = *s++;
00038     } /*IACcopystring*/
00039 
00040 
00041 Boolean IACpushstring (void *source, void *dest) {
00042 
00043     /*
00044     insert the source string at the end of the destination string.
00045     
00046     assume the strings are pascal strings, with the length byte in
00047     the first character of the string.
00048     */
00049     
00050     char *s = source, *d = dest;
00051     short lensource = s [0];
00052     short lendest = d [0];
00053     short newlen = lensource + lendest;
00054     
00055     if (newlen > 255)
00056         return (false);
00057         
00058     d [0] = (char) newlen;
00059     
00060     d += (char) lendest + 1; /*point at the position we're copying into*/
00061     
00062     s++; /*point at 1st char after length byte*/
00063     
00064     while (lensource--) 
00065         *d++ = *s++;
00066     
00067     return (true);
00068     } /*IACpushstring*/
00069     
00070     
00071 Boolean IACgetlongattr (AppleEvent *event, AEKeyword key, DescType type, long *pattr) {
00072     
00073     OSErr ec;
00074     Size actualsize;
00075     
00076     ec = AEGetAttributePtr (event, key, type, &type, (Ptr) pattr, sizeof (long), &actualsize);
00077     
00078     IACglobals.errorcode = ec;
00079     
00080     return (ec == noErr);
00081     } /*IACgetlongattr*/
00082 
00083 
00084 Boolean IACbreakembrace (void) {
00085     
00086     /*
00087     return true if the user is holding down the cmd, option and shift keys.
00088     */
00089     
00090     Ptr p;
00091     KeyMap keys;
00092     
00093     GetKeys (keys);
00094     
00095     p = (Ptr) keys; 
00096     
00097     return (BitTst (p, 63) && BitTst (p, 48) && BitTst (p, 61));
00098     } /*IACbreakembrace*/
00099 
00100 
00101 pascal short IACwaitroutine (EventRecord *ev, long *sleep, RgnHandle *mousergn) {
00102 #pragma unused(sleep, mousergn)
00103 
00104     /*
00105     called by the AppleEvent manager during AESend to give the user a chance to 
00106     break out of a wait loop.
00107     */
00108     
00109     if (IACbreakembrace ()) /*user holding down cmd, option and shift keys*/
00110         return (-1); /*stop waiting*/
00111     
00112     if (IACglobals.waitroutine == nil) /*keep waiting*/
00113         return (0);
00114     
00115     return ((*IACglobals.waitroutine) (ev));
00116     } /*IACwaitroutine*/
00117 
00118 
00119 
00120 

Generated on Wed May 31 18:19:48 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6