iacstring.c

Go to the documentation of this file.
00001 
00002 /*  $Id: iacstring.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 
00012     
00013 Boolean IACpushstringparam (StringPtr val, OSType keyword) {
00014         
00015     return (IACpushstringitem (IACglobals.event, val, keyword));
00016     } /*IACpushstringparam*/
00017 
00018 
00019 Boolean IACreturnstring (StringPtr x) {
00020     
00021     return (IACpushstringitem (IACglobals.reply, x, keyDirectObject));
00022     } /*IACreturnstring*/
00023 
00024 
00025 Boolean IACgetstringparam (OSType keyword, StringPtr val) {
00026     
00027     if (!IACgetstringitem (IACglobals.event, keyword, val)) {
00028 
00029         IACparamerror (IACglobals.errorcode, "\pstring", keyword);
00030         
00031         return (false);
00032         }
00033     
00034     IACglobals.nextparamoptional = false; /*must be reset for each param*/
00035     
00036     return (true);
00037     } /*IACgetstringparam*/
00038 
00039 
00040 Boolean IACgetstringitem (AEDescList *list, long n, StringPtr val) {
00041     
00042     register OSErr ec;
00043     DescType key;
00044     DescType typeCode;
00045     Size actualSize;
00046     
00047     if ((*list).descriptorType != typeAEList) {
00048     
00049         ec = AEGetKeyPtr (list, n, typeChar, &typeCode, (Ptr)&val[1], (Size)255, &actualSize);
00050 
00051         if (ec != errAEDescNotFound)
00052             goto finishString;
00053         }
00054 
00055     ec = AEGetNthPtr (list, n, typeChar, &key, &typeCode, (Ptr)&val[1], (Size)255, &actualSize);
00056 
00057     finishString:
00058     
00059     if (actualSize > 255)
00060         val[0] = 255;
00061     else
00062         val[0] = actualSize;
00063     
00064     IACglobals.errorcode = ec;
00065     
00066     return (ec == noErr);
00067     } /*IACgetstringitem*/
00068 
00069 
00070 Boolean IACpushstringitem (AEDescList *list, StringPtr val, long n) {
00071     
00072     register OSErr ec;
00073     
00074     if ((*list).descriptorType != typeAEList)
00075         ec = AEPutKeyPtr (list, n, typeChar, (Ptr)&val[1], (Size)val[0]);
00076     else
00077         ec = AEPutPtr (list, n, typeChar, (Ptr)&val[1], (Size)val[0]);
00078     
00079     IACglobals.errorcode = ec;
00080     
00081     return (ec == noErr);
00082     } /*IACpushstringitem*/
00083 
00084 

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