iacbinary.c

Go to the documentation of this file.
00001 
00002 /*  $Id: iacbinary.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include "frontier.h"
00008 #include "standard.h"
00009 
00010 #include "iacinternal.h"
00011 #include "aeutils.h"
00012 
00013 #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
00014     #include "aeutils.h"
00015 #endif
00016 
00017 
00018 Boolean IACpushbinaryparam (Handle val, OSType binaryfieldtype, OSType keyword) {
00019 
00020     return (IACpushbinaryitem (IACglobals.event, val, binaryfieldtype, keyword));
00021     } /*IACpushbinaryparam*/
00022 
00023 
00024 Boolean IACreturnbinary (Handle x, OSType binaryfieldtype) {
00025     
00026     return (IACpushbinaryitem (IACglobals.reply, x, binaryfieldtype, keyDirectObject));
00027     } /*IACreturnbinary*/
00028     
00029     
00030 Boolean IACgetbinaryparam (OSType keyword, Handle *hbinary, OSType *binaryfieldtype) {
00031 
00032     if (!IACgetbinaryitem (IACglobals.event, keyword, hbinary, binaryfieldtype)) {
00033     
00034         IACparamerror (IACglobals.errorcode, "\pbinary", keyword);
00035         
00036         return (false);
00037         }
00038 
00039     IACglobals.nextparamoptional = false; /*must be reset for each param*/
00040     
00041     return (true);
00042     } /*IACgetbinaryparam*/
00043 
00044 
00045 Boolean IACgetbinaryitem (AEDescList *list, long n, Handle *val, OSType *binaryfieldtype) {
00046     
00047     OSErr ec;
00048     AEDesc desc;
00049     DescType key;
00050     
00051     if ((*list).descriptorType != typeAEList) {
00052     
00053         ec = AEGetKeyDesc (list, n, typeWildCard, &desc);
00054         
00055         if (ec != errAEDescNotFound)
00056             goto done;
00057         }
00058 
00059     ec = AEGetNthDesc (list, n, typeWildCard, &key, &desc);
00060     
00061     done:
00062     
00063     IACglobals.errorcode = ec;
00064     
00065     if (ec == noErr) {
00066     
00067         *binaryfieldtype = desc.descriptorType;
00068         
00069         #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
00070         
00071             copydatahandle (&desc, val);
00072             
00073         #else
00074         
00075             *val = desc.dataHandle; 
00076         
00077         #endif
00078         
00079         return (true);
00080         }
00081     else {
00082         *binaryfieldtype = 0L;
00083         
00084         *val = NULL;
00085         
00086         return (false);
00087         }
00088     } /*IACgetbinaryitem*/
00089 
00090 
00091 Boolean IACpushbinaryitem (AEDescList *list, Handle val, OSType binaryfieldtype, long n) {
00092     
00093     /*
00094         dmb 4.1: added IACglobals.dontdisposenextparam field
00095     */
00096         
00097     OSErr ec;
00098     AEDesc desc;
00099     
00100     desc.descriptorType = binaryfieldtype;
00101     
00102     #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
00103     
00104         newdescwithhandle (&desc, binaryfieldtype, val);
00105         
00106     #else
00107     
00108         desc.dataHandle = val;
00109     
00110     #endif
00111     
00112     if ((*list).descriptorType != typeAEList)
00113         
00114         ec = AEPutKeyDesc (list, n, &desc);
00115     else
00116         ec = AEPutDesc (list, n, &desc);
00117     
00118     IACglobals.errorcode = ec;
00119     
00120     if (IACglobals.dontdisposenextparam)
00121         IACglobals.dontdisposenextparam = false;
00122     else
00123         AEDisposeDesc (&desc);
00124     
00125     return (ec == noErr);
00126     } /*IACpushbinaryitem*/
00127 
00128 

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