|
From: <cre...@us...> - 2006-06-25 09:25:59
|
Revision: 1415 Author: creecode Date: 2006-06-25 02:25:52 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1415&view=rev Log Message: ----------- FSRef-ized Modified Paths: -------------- Frontier/branches/FSRef_Migration/Common/headers/langsystem7.h Frontier/branches/FSRef_Migration/Common/headers/launch.h Frontier/branches/FSRef_Migration/Common/source/langipc.c Frontier/branches/FSRef_Migration/Common/source/langpack.c Frontier/branches/FSRef_Migration/Common/source/langsystypes.c Frontier/branches/FSRef_Migration/Common/source/langvalue.c Modified: Frontier/branches/FSRef_Migration/Common/headers/langsystem7.h =================================================================== --- Frontier/branches/FSRef_Migration/Common/headers/langsystem7.h 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/headers/langsystem7.h 2006-06-25 09:25:52 UTC (rev 1415) @@ -45,7 +45,7 @@ #ifdef MACVERSION - #define filespecsize(fs) (sizeof (tyfilespec) - sizeof (Str63) + stringsize ((fs).name)) + #define filespecsize(fs) (sizeof (tyfilespec)) // - sizeof (CFStringRef) + stringsize ((fs).name)) #endif #ifdef WIN95VERSION @@ -58,11 +58,11 @@ /*prototypes*/ -extern boolean filespectoalias (const tyfilespec *, boolean, AliasHandle *); /*landsystem7.c*/ +extern boolean filespectoalias (const ptrfilespec , boolean, AliasHandle *); /*landsystem7.c*/ extern boolean aliastostring (Handle, bigstring); -extern boolean aliastofilespec (AliasHandle, tyfilespec *); +extern boolean aliastofilespec (AliasHandle, ptrfilespec ); extern boolean coercetoalias (tyvaluerecord *); Modified: Frontier/branches/FSRef_Migration/Common/headers/launch.h =================================================================== --- Frontier/branches/FSRef_Migration/Common/headers/launch.h 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/headers/launch.h 2006-06-25 09:25:52 UTC (rev 1415) @@ -48,7 +48,7 @@ /*prototypes*/ -extern boolean launchapplication (const tyfilespec *, const tyfilespec *, boolean flbringtofront); +extern boolean launchapplication (const ptrfilespec, const ptrfilespec, boolean flbringtofront); extern boolean findrunningapplication (OSType *, bigstring, typrocessid *); @@ -60,7 +60,7 @@ extern boolean getnthapplication (short, bigstring); -extern boolean getapplicationfilespec (bigstring, tyfilespec *); +extern boolean getapplicationfilespec ( bigstring, ptrfilespec ); extern boolean executeresource (ResType, short, bigstring); Modified: Frontier/branches/FSRef_Migration/Common/source/langipc.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/langipc.c 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/source/langipc.c 2006-06-25 09:25:52 UTC (rev 1415) @@ -1628,16 +1628,17 @@ static pascal boolean langipchandleverb (hdlverbrecord hverb) { - /* - 10/29/91 dmb: let traps have a chance at runscripttoken before executing - built-in code + // + // 2006-06-25 creedon: FSRef-ized + // + // 4.1b7 dmb: allow a specific root file to be targed with the "subject" + // event attribute. Bug: right now, langipcfindhandler doesn't have this + // logic. So if an event doesn't have a handler in this root, landsystem7 + // will return eventnothandled even if the target root does have a handler. + // + // 1991-10-29 dmb: let traps have a chance at runscripttoken before executing built-in code + // - 4.1b7 dmb: allow a specific root file to be targed with the "subject" - event attribute. Bug: right now, langipcfindhandler doesn't have this - logic. So if an event doesn't have a handler in this root, landsystem7 - will return eventnothandled even if the target root does have a handler. - */ - boolean fl; boolean flfoundhandler; AEDesc subject; @@ -1647,25 +1648,19 @@ if (landgetverbattr (hverb, 'subj', typeFSS, &subject) == noErr) { /*4.1b7 dmb*/ - #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/ + FSSpec fs; + Handle h; + tyfilespec fst; - FSSpec fs; - - Handle h; - - copydatahandle (&subject, &h); - - fs = **(FSSpec **) h; - - disposehandle (h); + copydatahandle (&subject, &h); - #else + fs = **(FSSpec **) h; - FSSpec fs = **(FSSpec **) subject.dataHandle; + disposehandle (h); - #endif + FSpMakeFSRef ( &fs, &fst.fsref ); - wroot = shellfindfilewindow (&fs); + wroot = shellfindfilewindow ( &fst ); if (wroot == nil) { @@ -1893,14 +1888,16 @@ static boolean getipcaddressvalue (hdltreenode hparam1, short pnum, tyipcaddress *ipcaddress) { - /* - 2/12/93 dmb: always use landglobals for find our own application id + // + // 2006-06-25 creedon: FSRef-ized + // + // 5.0d19 dmb: handle 'psn ' binary address values + // + // 1993-04-09 dmb: if the address parameter is zero, send to self + // + // 1993-02-12 dmb: always use landglobals for find our own application id + // - 4/9/93 dmb: if the address parameter is zero, send to self - - 5.0d19 dmb: handle 'psn ' binary address values - */ - register tyipcaddress *padr = ipcaddress; tyvaluerecord val; @@ -2002,12 +1999,16 @@ if (val.valuetype == filespecvaluetype) { /*4.1b7 dmb: send to another open root*/ - FSSpec fs = **val.data.filespecvalue; + tyfilespec fs = **val.data.filespecvalue; if (shellfindfilewindow (&fs) == nil) { + + bigstring bs; - langparamerror (dbnotopenederror, fs.name); + getfsfile ( &fs, bs ); + langparamerror (dbnotopenederror, bs ); + return (false); } @@ -2866,7 +2867,7 @@ if (ipcaddress.flrootval) { /*4.1b7 dmb*/ - FSSpec fs = **ipcaddress.val.data.filespecvalue; + tyfilespec fs = **ipcaddress.val.data.filespecvalue; landsetverbattr (hv, 'subj', typeFSS, &fs, sizeof (fs)); } @@ -4132,8 +4133,16 @@ static pascal OSErr langipcopendocroutine (FSSpec *fs) { + + // + // 2006-06-25 creedon: FSRef=ized + // + + tyfilespec fst; - if (!shellopenfile (fs, false, nil)) + FSpMakeFSRef ( fs, &fst.fsref ); + + if (!shellopenfile ( &fst, false, nil)) return (getoserror ()); return (noErr); Modified: Frontier/branches/FSRef_Migration/Common/source/langpack.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/langpack.c 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/source/langpack.c 2006-06-25 09:25:52 UTC (rev 1415) @@ -42,8 +42,12 @@ #include "tablestructure.h" #include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */ +#ifdef MACVERSION + #include "MoreFilesX.h" +#endif + #define ctsigbytes 19 /*length of string + 1 byte for length*/ #define signaturestring (ptrstring) "\x12" "packed binary data" @@ -816,6 +820,10 @@ boolean langunpackwindowverb (hdltreenode hparam1, tyvaluerecord *vreturned) { + // + // 2006-06-24 creedon: FSRef-ized + // + tyvaluerecord val; tyfilespec fspec; ptrfilespec fs; @@ -843,10 +851,10 @@ fs = &fspec; - if (isemptystring (fsname (fs))) + if ( FSRefValid ( &( *fs ).fsref ) ) + langexternalsetdirty ((hdlexternalhandle) val.data.externalvalue, false); + else fs = nil; - else - langexternalsetdirty ((hdlexternalhandle) val.data.externalvalue, false); if (!langexternalzoomfilewindow (&val, fs, true)) { Modified: Frontier/branches/FSRef_Migration/Common/source/langsystypes.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/langsystypes.c 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/source/langsystypes.c 2006-06-25 09:25:52 UTC (rev 1415) @@ -508,19 +508,21 @@ static boolean stringtoalias (tyvaluerecord *val) { - /* - 10/7/91 dmb: make sure we're actually passing a full path to the NewAlias routine + // + // 2006-06-24 creedon: FSRef-ized + // + // 2.1b2 dmb: try converting to a filespec first to ensure that partial path or + // drive number if processed properly. also, in the filespec case, the alias isn't + // minimal + // + // 1992-07-23 dmb: OK, try to getfullfilepath, but with errors disabled + // + // 1992-07-02 dmb: don't call getfullfilepath; makes it impossible to create aliases of + // not-yet-existing files, or offline volumes + // + // 1991-10-07 dmb: make sure we're actually passing a full path to the NewAlias routine + // - 7/2/92 dmb: don't call getfullfilepath; makes it impossible to create aliases of - not-yet-existing files, or offline volumes - - 7/23/92 dmb: OK, try to getfullfilepath, but with errors disabled - - 2.1b2 dmb: try converting to a filespec first to ensure that partial path or - drive number if processed properly. also, in the filespec case, the alias isn't - minimal - */ - register Handle htext; bigstring bspath; tyfilespec fs; @@ -536,7 +538,7 @@ texthandletostring (htext, bspath); if (pathtofilespec (bspath, &fs) && fileexists (&fs, &flfolder)) - errcode = NewAlias (nil, &fs, &halias); + errcode = FSNewAlias (nil, &fs.fsref, &halias); else errcode = NewAliasMinimalFromFullPath (stringlength (bspath), bspath + 1, nil, nil, &halias); @@ -553,56 +555,78 @@ #endif -boolean filespectoalias (const tyfilespec *fs, boolean flminimal, AliasHandle *halias) { +boolean filespectoalias (const ptrfilespec fs, boolean flminimal, AliasHandle *halias) { + + // + // 2006-06-24 creedon: for Mac, FSRef-ized + // -#ifdef MACVERSION - bigstring bs; - OSErr err; - - if (flminimal) - err = NewAliasMinimal (fs, halias); - else - err = NewAlias (nil, fs, halias); - - if (err == fnfErr) { /*alias manager isn't friendly enough to do anything for us here*/ + #ifdef MACVERSION + + boolean flcreatefrompath = FALSE; + // bigstring bs; + OSErr err; - if (filespectopath (fs, bs)) - err = NewAliasMinimalFromFullPath (stringlength (bs), bs + 1, nil, nil, halias); - } + if ( ( *fs ).path == NULL ) { + + if (flminimal) + err = FSNewAliasMinimal ( &( *fs ).fsref, halias); + else + err = FSNewAlias (nil, &( *fs ).fsref, halias); + } + else + flcreatefrompath = true; + + if ( ( err == fnfErr ) || flcreatefrompath ) { // alias manager isn't friendly enough to do anything for us here + + HFSUniStr255 name; + + CFStringRefToHFSUniStr255 ( ( *fs ).path, &name ); + + err = FSNewAliasMinimalUnicode ( &( *fs ).fsref, name.length, name.unicode, halias, NULL ); + } + + if (err == noErr) + return (true); + + if (langerrorenabled ()) { + + setfserrorparam ( fs ); + + oserror (err); + } + + return (false); + + #endif + + #ifdef WIN95VERSION - if (err == noErr) - return (true); - - if (langerrorenabled ()) { + langparamerror (unimplementedverberror, bsfunctionname); - setoserrorparam ((ptrstring) (*fs).name); + return (false); - oserror (err); - } + #endif - return (false); -#endif + } // filespectoalias -#ifdef WIN95VERSION - langparamerror (unimplementedverberror, bsfunctionname); - - return (false); -#endif - } /*filespectoalias*/ - #ifdef MACVERSION static boolean filespecvaltoalias (tyvaluerecord *val) { + + // + // 2006-06-24 creedon: FSRef-ized + // - register FSSpecHandle hfs; - FSSpec fs; + register hdlfilespec hfs; + tyfilespec fs; AliasHandle halias; if (!langcanusealiases ()) return (false); - hfs = (FSSpecHandle) (*val).data.filespecvalue; + hfs = (hdlfilespec) (*val).data.filespecvalue; fs = **hfs; @@ -624,20 +648,21 @@ #ifdef MACVERSION - /* - 10/4/91 dmb: if alias can't be resolved, just say what volume it's on. + // + // 2006-06-24 creedon: FSRef-ized + // + // 1996-04-26 dmb: restored FollowFinderAlias code; must use if we get fnfErr. + // + // 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during alias resolution + // + // 1993-04-12 dmb: accept fnfErr result from ResolveAlias + // + // 1991-10-04 dmb: if alias can't be resolved, just say what volume it's on. + // - 4/12/93 dmb: accept fnfErr result from ResolveAlias - - 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during - alias resolution - - 4.0b6 4/26/96 dmb: restored FollowFinderAlias code; must use if we get fnfErr. - */ - register AliasHandle h = (AliasHandle) halias; short flchanged; - FSSpec fs; + tyfilespec fs; bigstring bsinfo; AliasInfoType ix = asiAliasName; OSErr err; @@ -645,12 +670,12 @@ if (!langcanusealiases ()) return (false); - err = FollowFinderAlias (nil, h, false, &fs, (Boolean *) &flchanged); + err = FSFollowFinderAlias (nil, h, false, &fs.fsref, (Boolean *) &flchanged); if ((err == noErr) /*|| (err == fnfErr)*/ ) { if (flchanged) - UpdateAlias (nil, &fs, h, (Boolean *) &flchanged); + FSUpdateAlias (nil, &fs.fsref, h, (Boolean *) &flchanged); return (filespectopath (&fs, bs)); } @@ -705,74 +730,74 @@ } /*aliastostring*/ -boolean aliastofilespec (AliasHandle halias, tyfilespec *fs) { +boolean aliastofilespec ( AliasHandle halias, ptrfilespec fs ) { - /* - 2.1a6 dmb: ignore fnfErr + // + // 2006-06-17 creedon: for Mac FSRef-ized + // + // 7.0b34 PBS: Can't use ResolveAliasWithMountFlags on pre-Carbon Macs reliably, so fall back to FollowFinderAlias. + // + // 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during alias resolution + // + // 2.1b2 dmb: on error, try to get as much info from the alias as possible, & just return false to caller + // + // 2.1a6 dmb: ignore fnfErr + // - 2.1b2 dmb: on error, try to get as much info from the alias as possible, - & just return false to caller + #ifdef MACVERSION - 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during - alias resolution - - 7.0b34 PBS: Can't use ResolveAliasWithMountFlags on pre-Carbon Macs reliably, - so fall back to FollowFinderAlias. - */ - -#ifdef MACVERSION - Boolean flchanged; - bigstring bs; - OSErr err; - - if (!langcanusealiases ()) + boolean flchanged; + bigstring bs; + OSErr err; + + if (!langcanusealiases ()) + return (false); + + err = FSResolveAliasWithMountFlags ( NULL, halias, &( *fs ).fsref, &flchanged, kARMNoUI ); + + if ( ( err == noErr ) || ( err == fnfErr ) ) { + + HFSUniStr255 name; + OSStatus status; + + status = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fs ).fsref ); + + ( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length ); + + return ( true ); + + } + + if (GetAliasInfo (halias, asiVolumeName, bs) == noErr) // try to get vol info + fileparsevolname (bs, fs); + + getfsfile ( fs, bs ); + + if (GetAliasInfo (halias, asiAliasName, bs ) != noErr) // try to set file name + langgetmiscstring (unknownstring, bs ); + + if (langerrorenabled ()) { + + setfserrorparam ( fs ); + + oserror (err); + } + return (false); - #if TARGET_API_MAC_CARBON == 1 + #endif + + #ifdef WIN95VERSION - err = ResolveAliasWithMountFlags(nil, halias, fs, &flchanged, kARMNoUI); - //old stupid code. - //Code change by Timothy Paustian Tuesday, May 16, 2000 8:54:03 PM - //why was this used. Maybe before there was the other APIs, anyhow, - //it breaks on OS X so use the above, correct routine instead - - #else /*7.0b32 PBS: fall back to FollowFinderAlias on pre-Carbon Macs*/ + langparamerror (unimplementedverberror, bsfunctionname); + + return (false); - err = FollowFinderAlias (nil, halias, false, fs, &flchanged); - #endif - if ((err == noErr) || (err == fnfErr)) - return (true); - - (*fs).parID = 0; - - (*fs).vRefNum = 0; - - if (GetAliasInfo (halias, asiVolumeName, bs) == noErr) /*try to get vol info*/ - fileparsevolname (bs, &(*fs).vRefNum, nil); - - if (GetAliasInfo (halias, asiAliasName, (*fs).name) != noErr) /*try to set file name*/ - langgetmiscstring (unknownstring, (*fs).name); - - if (langerrorenabled ()) { - - setoserrorparam ((*fs).name); - - oserror (err); - } - - return (false); -#endif + } // aliastofilespec -#ifdef WIN95VERSION - langparamerror (unimplementedverberror, bsfunctionname); - return (false); -#endif - } /*aliastofilespec*/ - - boolean coercetoalias (tyvaluerecord *v) { /* @@ -826,112 +851,113 @@ boolean filespecaddvalue (tyvaluerecord *v1, tyvaluerecord *v2, tyvaluerecord *vreturned) { - /* - add v2 to the filespec v1 by using it as a partial path. if anything bug a valid - fspec results, return a string value that is simple concatenation + // + // add v2 to the filespec v1 by using it as a partial path. if anything but a valid + // fspec results, return a string value that is simple concatenation + // + // 2006-06-24 creedon: for Mac, FSRef-ized + // + // 2.1b6 dmb: if resulting specifier exists, but doesn't agree with bsadd as far as + // whether or not it's a folder, return a string. + // + // 2.1b3 dmb: if resulting path is to a non-existent folder, don't return a filespec + // - 2.1b3 dmb: if resulting path is to a non-existent folder, don't return a filespec - - 2.1b6 dmb: if resulting specifier exists, but doesn't agree with bsadd as far as - whether or not it's a folder, return a string. - */ - -#ifdef MACVERSION - tyfilespec fs; - bigstring bsadd; - boolean fl, flfolder; - boolean flfolderpath; - OSErr err; + #ifdef MACVERSION + + tyfilespec fs; + bigstring bs, bsadd, bsv1path; + boolean flfolder; // unused + OSErr status; + + fs = **(*v1).data.filespecvalue; - #if TARGET_API_MAC_CARBON == 1 - - fs.vRefNum = (**(*v1).data.filespecvalue).vRefNum; + ( void ) extendfilespec ( &fs, &fs ); + + filespectopath ( &fs, bs ); - fs.parID = (**(*v1).data.filespecvalue).parID; + copystring ( bs, bsv1path); - copystring ((**(*v1).data.filespecvalue).name, fs.name); + if (!coercetostring (v2)) + return (false); - #else - - fs = **(*v1).data.filespecvalue; + pullstringvalue (v2, bsadd); - #endif - - if (!coercetostring (v2)) - return (false); - -// fs = **(*v1).data.filespecvalue; - - pullstringvalue (v2, bsadd); - - if (fileexists (&fs, &flfolder)) { + /* + if (fileexists (&fs, &flfolder)) { + + // fileisfolder (&fs, &flfolder); + + if (flfolder) + pushchar (':', bs ); + } + */ - // fileisfolder (&fs, &flfolder); + insertstring ( bs, bsadd ); - if (flfolder) - pushchar (':', fs.name); - } - - insertstring (fs.name, bsadd); - - if (stringfindchar (':', bsadd)) /*will be interpreted as full path, so make it partial*/ - insertchar (':', bsadd); - - err = FSMakeFSSpec (fs.vRefNum, fs.parID, bsadd, &fs); - - flfolderpath = lastchar (bsadd) == ':'; - - switch (err) { + /* + if (stringfindchar (':', bsadd)) // will be interpreted as full path, so make it partial* + insertchar (':', bsadd); + */ - case noErr: /*valid spec, file exists*/ + copystring ( bsadd, bs ); + + insertstring ( BIGSTRING ( "\x09" ":Volumes:" ), bs ); + + stringreplaceall ( ':', '/', bs ); + + convertpstring ( bs ); + + status = FSPathMakeRef ( bs, &fs.fsref, &flfolder ); + + if ( status == noErr ) { + + HFSUniStr255 name; + + status = FSGetCatalogInfo ( &fs.fsref, kFSCatInfoNone, NULL, &name, NULL, &fs.fsref ); + + fs.path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length ); - fileisfolder (&fs, &flfolder); + } - fl = flfolder == flfolderpath; /*make sure endings match*/ - - break; + else { // couldn't extend filespec - case fnfErr: /*valid spec, file doesn't exist*/ + ( void ) extendfilespec ( *( *v1 ).data.filespecvalue, *( *v1 ).data.filespecvalue ); - fl = !flfolderpath; + if ( ! coercetostring ( v1 ) ) + return ( false ); - break; + return ( addvalue ( *v1, *v2, vreturned ) ); + + } - default: - fl = false; - - break; - } + return ( setfilespecvalue ( &fs, vreturned ) ); + + #endif + + #ifdef WIN95VERSION - if (!fl) { /*couldn't extend filespec*/ + if (!coercetostring (v2)) + return (false); if (!coercetostring (v1)) return (false); return (addvalue (*v1, *v2, vreturned)); - } + + #endif - return (setfilespecvalue (&fs, vreturned)); -#endif + } // filespecaddvalue -#ifdef WIN95VERSION - if (!coercetostring (v2)) - return (false); - - if (!coercetostring (v1)) - return (false); - - return (addvalue (*v1, *v2, vreturned)); -#endif - } /*filespecaddvalue*/ - boolean filespecsubtractvalue (tyvaluerecord *v1, tyvaluerecord *v2, tyvaluerecord *vreturned) { - /* - subtract v2 from the filespec v1's file name, iff v2 is a simple string (no - colons). otherwise, return a string value that is simple string subtraction - */ + // + // subtract v2 from the filespec v1's file name, iff v2 is a simple string (no + // colons). otherwise, return a string value that is simple string subtraction + // + // 2006-06-24 creedon: FSRef-ized + // #ifdef MACVERSION tyfilespec fs; @@ -950,11 +976,14 @@ fl = !stringfindchar (':', bssub); if (fl) { + bigstring bs; - subtractstrings (fs.name, bssub, bsname); + getfsfile ( &fs, bs ); - err = FSMakeFSSpec (fs.vRefNum, fs.parID, bsname, &fs); + subtractstrings ( bs, bssub, bsname); + err = FSPathMakeRef ( bsname, &fs.fsref, NULL ); + fl = (err == noErr) || (err == fnfErr); } @@ -983,14 +1012,15 @@ boolean langpackfileval (const tyvaluerecord *vfile, Handle *hpacked) { - /* - 5.0a24 dmb: new format for storing filespec and alias values - in the odb. - - we create a record containing an alias to the file (Mac only), - the full path to the file (as a URL), and the machine name (for - future use). - */ + // + // we create a record containing an alias to the file (Mac only), + // the full path to the file (as a URL), and the machine name (for + // future use). + // + // 2006-06-24 creedon: FSRef-ized + // + // 5.0a24 dmb: new format for storing filespec and alias values in the odb. + // hdllistrecord hlist; bigstring bspath, bsmachine; @@ -1013,19 +1043,8 @@ case filespecvaluetype: { - #if TARGET_API_MAC_CARBON == 1 - - fs.vRefNum = (**(*vfile).data.filespecvalue).vRefNum; - fs.parID = (**(*vfile).data.filespecvalue).parID; - - copystring ((**(*vfile).data.filespecvalue).name, fs.name); - - #else + fs = **(*vfile).data.filespecvalue; - fs = **(*vfile).data.filespecvalue; - - #endif - disablelangerror (); if (!filespectoalias (&fs, true, (AliasHandle *) &halias)) @@ -1044,7 +1063,7 @@ goto exit; } - // *** should converr path to URL *** + // *** should convert path to URL *** if (!oppushstring (hlist, filerecordpath, bspath)) goto exit; @@ -1057,17 +1076,20 @@ //just indicating what platform the path is specific to. #ifdef MACVERSION + if (!oppushstring (hlist, filerecordplatform, bsplatformmac)) goto exit; + #endif #ifdef WIN95VERSION + if (!oppushstring (hlist, filerecordplatform, bsplatformwin)) goto exit; + #endif - // *** could push machine name too - if (getmachinename (bsmachine)) + if (getmachinename (bsmachine)) // *** could push machine name too if (!oppushstring (hlist, filerecordmachine, bsmachine)) goto exit; @@ -1078,20 +1100,24 @@ opdisposelist (hlist); return (fl); - } /*langpackfileval*/ + } // langpackfileval boolean langunpackfileval (Handle hpacked, tyvaluerecord *vfile) { - /* - 5.0fc2 dmb: unpacking an alias on the pc, go straight for the path string - */ + // + // 2006-06-24 creedon: for Mac, FSRef-zed + // + // 5.0fc2 dmb: unpacking an alias on the pc, go straight for the path string + // hdllistrecord hlist; Handle halias; bigstring bspath, bsplat; tyfilespec fs; boolean fl = false; + + clearbytes ( &fs, sizeof ( tyfilespec ) ); if (!opunpacklist (hpacked, &hlist)) return (false); @@ -1099,14 +1125,18 @@ switch ((*vfile).valuetype) { case aliasvaluetype: + #ifdef MACVERSION + fl = opgetlisthandle (hlist, -1, filerecordalias, &halias); if (fl) fl = copyhandle (halias, &(*vfile).data.aliasvalue); + #endif #ifdef WIN95VERSION + fl = opgetliststring (hlist, -1, filerecordpath, bspath); if (fl) { @@ -1115,6 +1145,7 @@ fl = newtexthandle (bspath, &(*vfile).data.stringvalue); } + #endif break; @@ -2431,13 +2462,6 @@ OSErr errcode = noErr; - #ifdef flsystem6 - - if (!langcanuseappleevents ()) - return (false); - - #endif - if (!getostypevalue (hparam1, 1, &class)) return (false); Modified: Frontier/branches/FSRef_Migration/Common/source/langvalue.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/langvalue.c 2006-06-25 06:32:01 UTC (rev 1414) +++ Frontier/branches/FSRef_Migration/Common/source/langvalue.c 2006-06-25 09:25:52 UTC (rev 1415) @@ -58,8 +58,14 @@ #include "timedate.h" #include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */ +#ifdef MACVERSION + #include "MoreFilesX.h" +#endif + + + boolean flparamerrorenabled = true; boolean flnextparamislast = false; @@ -88,7 +94,6 @@ } tyfastflagsvaluerecord; - boolean langsymbolreference (hdlhashtable htable, bigstring bs, tyvaluerecord *val, hdlhashnode * hnode) { /* @@ -224,7 +229,7 @@ boolean setdatevalue (unsigned long x, tyvaluerecord *val) { - + /* set val to be a the date value x. can't fail. */ @@ -653,7 +658,7 @@ } /*setdoublevalue*/ -boolean setfilespecvalue (tyfilespec *x, tyvaluerecord *val) { +boolean setfilespecvalue (ptrfilespec x, tyvaluerecord *val) { /* turn val into a filespec value, allocated in the heap. @@ -1906,13 +1911,14 @@ boolean coercetoboolean (tyvaluerecord *v) { - /* - 2/7/92 dmb: binary to boolean is now true when non-empty, except when - it's the size of a boolean. + // + // 2006-06-24 creedon: for Mac, FSRef-ized + // + // 2.1b4 dmb: handle filespec values + // + // 1992-02-07 dmb: binary to boolean is now true when non-empty, except when it's the size of a boolean. + // - 2.1b4 dmb: handle filespec values - */ - register boolean fl; switch ((*v).valuetype) { @@ -1990,16 +1996,17 @@ } case filespecvaluetype: { + bigstring bs; - filegetfilename(*(*v).data.filespecvalue, bs); // 3/7/97 dmb + getfsfile ( *( *v ).data.filespecvalue, bs ); // 3/7/97 dmb - fl = !isemptystring (bs); - } - // fl = !isemptystring ((**(*v).data.filespecvalue).name); + fl = ! isemptystring (bs); break; + } + case listvaluetype: case recordvaluetype: return (coercelistvalue (v, booleanvaluetype)); @@ -3003,23 +3010,26 @@ boolean coercetofilespec (tyvaluerecord *v) { - /* - 2.1b2 dmb: don't enforce any particular size when coercing from binary; - filespecs are now variable-length + // + // 2006-06-24 creedon: for Mac, FSRef-ized + // + // 2.1b12 dmb: changed string->filespec error message to be filenotfounderror + // + // 2.1b3 dmb: coerce zero to nil filespec + // + // 2.1b2 dmb: don't enforce any particular size when coercing from binary; filespecs are now variable-length + // - 2.1b3 dmb: coerce zero to nil filespec - - 2.1b12 dmb: changed string->filespec error message to be filenotfounderror - */ - bigstring bs; byte fileurl [] = "\x08" "file:///"; tyfilespec fs; + clearbytes ( &fs, sizeof ( fs ) ); + switch ((*v).valuetype) { case filespecvaluetype: - return (true); + return ( true ); case novaluetype: if (flinhibitnilcoercion) @@ -3128,16 +3138,16 @@ boolean coercetostring (tyvaluerecord *val) { - /* - 8/10/92 dmb: added flcoerceexternaltostring flag to prevent external-to-string - coercion except when explicitly requested by stringfunc in langverbs.c + // + // 2006-06-24 creedon: for Mac, FSRef-ized + // + // 4.1b4 dmb: if flcoerceexternaltostring is not enabled, create a reasonable display string for externals + // + // 2.1b3 dmb: don't ignore return value from objspectostring + // + // 1992-08-10 dmb: added flcoerceexternaltostring flag to prevent external-to-string coercion except when explicitly requested by stringfunc in langverbs.c + // - 2.1b3 dmb: don't ignore return value from objspectostring - - 4.1b4 dmb: if flcoerceexternaltostring is not enabled, create a - reasonable display string for externals - */ - register tyvaluerecord *v = val; bigstring bs; Handle h; @@ -3262,25 +3272,12 @@ case filespecvaluetype: { - tyfilespec fs; + tyfilespec fs = **(*v).data.filespecvalue; + + filespectopath ( &fs, bs ); - #if TARGET_API_MAC_CARBON == 1 - - fs.vRefNum = (**(*v).data.filespecvalue).vRefNum; - - fs.parID = (**(*v).data.filespecvalue).parID; - - copystring ((**(*v).data.filespecvalue).name, fs.name); - - #else - - fs = **(*v).data.filespecvalue; - - #endif - - filespectopath (&fs, bs); - break; + } case binaryvaluetype: @@ -5191,26 +5188,15 @@ } /*getostypevalue*/ -boolean getfilespecvalue (hdltreenode hfirst, short pnum, tyfilespec *fsval) { +boolean getfilespecvalue ( hdltreenode hfirst, short pnum, tyfilespec *fsval ) { tyvaluerecord val; if (!getfilespecparam (hfirst, pnum, &val)) return (false); - #if TARGET_API_MAC_CARBON == 1 + *fsval = **val.data.filespecvalue; - (*fsval).vRefNum = (**val.data.filespecvalue).vRefNum; - (*fsval).parID = (**val.data.filespecvalue).parID; - - copystring ((**val.data.filespecvalue).name, (*fsval).name); - - #else - - *fsval = **val.data.filespecvalue; - - #endif - return (true); } /*getfilespecvalue*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |