home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!eos!data.nas.nasa.gov!taligent!keith@taligent.com
- From: keith@taligent.com (Keith Rollin)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: PLstrcmp?? Do the right thing!
- Message-ID: <Bs56G5.1Jy@taligent.com>
- Date: 29 Jul 92 08:33:41 GMT
- References: <jpurlia-280792143857@129.46.5.45>
- Sender: usenet@taligent.com (More Bytes Than You Can Read)
- Organization: Taligent
- Lines: 42
-
- In article <jpurlia-280792143857@129.46.5.45>, jpurlia@qualcomm.com (John
- Purlia) writes:
- >
- > Has anyone else noticed the effective weirdness of PLstrcmp in MPW? I'm
- > using qsort to sort a list of pascal style strings in ascending alphabetic
- > order. My comparison function basically uses a PLstrcmp to test equality
- > of the list elements. Here's the weird part: PLstrcmp thinks that "Public
- > Folder" comes before "Public". If I take the same data, convert each
- > element to C style using p2cstr, and use strcmp in my comparison function,
- > "Public" comes before "Public Folder" just as you would expect.
- >
- > Is there a known bug in PLstrcmp (MPW 3.2) or for that matter any of the
- > other Pascal style string routines? Is there a fix or am I going to have
- > to do the convert to C conversion all over the place? (No, the toolbox
- > routine I'm using to get the data does not have a C string equivalent.)
-
- I don't know about PLstrcmp. If I were in your position, I'd do one of two
- things:
-
- - Disassemble PLstrcmp and see WTF was going on.
- - Use one of the toolbox routines that compares Pascal strings (RelString,
- EqualString, IUCompString, IUMagString, IUEqualString, or IUMagIDString). Here
- are some notes I have on the functions (I can never keep them straight!):
-
- Name Takes Case Diac Returns Trap used
- -------------- ------- ----- ----- ------------ ----------
- RelString: Str255 spec spec -1, 0, 1 _RelString
- EqualString: Str255 spec spec Boolean _CmpString
-
- IUCompString: Str255 TRUE TRUE -1, 0, 1 _Pack6,#10
- IUMagString: Ptr/len TRUE TRUE -1, 0, 1 _Pack6,#10
-
- IUEqualString: Str255 FALSE FALSE Inv. Boolean _Pack6,#12
- IUMagIDString: Ptr/len FALSE FALSE Inv. Boolean _Pack6,#12
-
- The Case and Diac columns refer to whether or not the functions are sensitive to
- case or diacriticals. "spec" means that you can specify whether they are or not.
-
- --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-