~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Frontier Kernel
Frontier/Common/source/aeutils.c

Version: ~ [ 10.0 ] ~

** Warning: Cannot open xref database.

1 2 /* $Id: aeutils.c,v 1.4 2005/01/11 22:48:04 andreradke Exp $ */ 3 4 /****************************************************************************** 5 6 UserLand Frontier(tm) -- High performance Web content management, 7 object database, system-level and Internet scripting environment, 8 including source code editing and debugging. 9 10 Copyright (C) 1992-2004 UserLand Software, Inc. 11 12 This program is free software; you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation; either version 2 of the License, or 15 (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 26 ******************************************************************************/ 27 28 #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/ 29 30 #include "frontier.h" 31 #include "standard.h" 32 33 #include "aeutils.h" 34 #include "memory.h" 35 36 37 static boolean getdescdata (AEDesc *desc, Handle *h) { 38 39 /* 40 PBS 03/14/02: get data from AEDesc's data handle as 41 a handle. The handle is allocated here. Caller 42 will dispose of handle, unless this function returns false. 43 */ 44 45 Size len; 46 47 len = AEGetDescDataSize (desc); 48 49 if (len < 1) { 50 51 *h = nil; 52 53 return (false); 54 } 55 56 if (!newclearhandle (len, h)) { 57 58 *h = nil; 59 60 return (false); 61 } 62 63 lockhandle (*h); 64 65 if (AEGetDescData (desc, **h, len) != noErr) { 66 67 disposehandle (*h); 68 69 *h = nil; 70 71 return (false); 72 } /*if*/ 73 74 unlockhandle (*h); 75 76 return (true); 77 } /*getdescdata*/ 78 79 80 OSErr putdescdatapointer (AEDesc *desc, DescType typeCode, ptrvoid pvoid, long len) { 81 82 /* 83 PBS 03/14/02: put data into the datahandle. 84 */ 85 86 return (AEReplaceDescData (typeCode, pvoid, len, desc) == noErr); 87 } /*putdescdatapointer*/ 88 89 90 boolean putdeschandle (AEDesc *desc, DescType typeCode, Handle h) { 91 92 /* 93 PBS 03/14/02: set a datahandle from a handle. 94 */ 95 96 OSErr err = noErr; 97 98 lockhandle (h); 99 100 err = AEReplaceDescData (typeCode, *h, gethandlesize (h), desc); 101 102 unlockhandle (h); 103 104 return (err != noErr); 105 } /*putdeschandle*/ 106 107 108 /*boolean newdescnull (AEDesc *desc) { 109 110 AEInitializeDescInline (desc); 111 112 return (AECreateDesc (typeNull, nil, 0, desc) != noErr); 113 } #*newdescnull*/ 114 boolean newdescnull (AEDesc *desc, DescType typeCode) { // MJL 08/12/03: Broken boolean obj spec fix 115 AEInitializeDescInline (desc); 116 return (AECreateDesc (typeCode, nil, 0, desc) != noErr); 117 } /*newdescnull*/ 118 119 120 boolean nildatahandle (AEDesc *desc) { 121 122 AEInitializeDescInline (desc); 123 return (true); 124 //return (AEReplaceDescData (typeNull, nil, 0, desc) == noErr); 125 } /*nildatahandle*/ 126 127 128 boolean newdescwithhandle (AEDesc *desc, DescType typeCode, Handle h) { 129 130 /* 131 PBS 03/14/02: Create a new AEDesc with the given type and value. 132 */ 133 134 OSErr err = noErr; 135 long len = gethandlesize (h); 136 137 AEInitializeDescInline (desc); 138 139 if (h == nil) 140 141 err = AECreateDesc (typeCode, nil, 0, desc); 142 143 else { 144 145 lockhandle (h); 146 147 err = AECreateDesc (typeCode, *h, len, desc); 148 149 unlockhandle (h); 150 } /*else*/ 151 152 return (err == noErr); 153 } /*newdescwithhandle*/ 154 155 156 boolean datahandletostring (AEDesc *desc, bigstring bs) { 157 158 /* 159 PBS 03/14/02: get data from AEDesc's data handle as 160 a bigstring. 161 162 2002-10-13 AR: Removed variable len to eliminate compiler warning 163 about unused variables 164 */ 165 166 Handle h; 167 168 if (!getdescdata (desc, &h)) 169 return (false); 170 171 texthandletostring (h, bs); 172 173 disposehandle (h); 174 175 return (true); 176 } /*datahandletostring*/ 177 178 179 boolean copydatahandle (AEDesc *desc, Handle *h) { 180 181 /* 182 PBS 03/14/02: copy the datahandle to another handle. 183 */ 184 185 return (getdescdata (desc, h)); 186 } /*copydatahandle*/ 187 188 189 #endif

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.