[net.micro.mac] Desktop file comments from Get Info

mandel@talcott.UUCP (04/17/86)

Given a file, how can you tell if there is a comment in the Get Info box
for that file. What is the formula to link the ID of the 'fcmt' resource
in the Desktop file  to the owning file?

Thanks,
Victor

joel@gould9.UUCP (Joel West) (04/20/86)

In article <588@talcott.UUCP>, mandel@talcott.UUCP (Victor Mandel) writes:
> Given a file, how can you tell if there is a comment in the Get Info box
> for that file. What is the formula to link the ID of the 'fcmt' resource
> in the Desktop file  to the owning file?

Tech Note #29, "Resources Contained in the Desktop File", says that
the ID on an MFS volume is a hashed result from the object name
the algorithm:
;	HashString(str: 255): INTEGER;
	move.l	(sp)+,a0
	move.l	(sp)+,a1
	moveq	#0,d0
	move.b	(a1)+,d0
	moveq	#0,d2
@0
	move.b	(a1)+,d1
	eor.b	d1,d2
	ror	#1,d2
	bmi.s	@1
	neg	d2
@1
	subq	#1,d0
	bne	@0
	move	d2,(sp)
	jmp	(a0)

For an HFS document it's even easier; the ID is in "kept in the
Finder file information record in a new filed called FFComment
([offset] $5E)."

I cannot say strongly enough that everyone who's forked out $ for 
Inside Mac should also send $25 for one year to
	Macintosh Technical Notes
	Apple Computer, Inc
	20525 Mariania Ave MS3-T
	Cupertino, CA  95014
I'm not a certified developer, but I couldn't get by without these
notes.  The software supplements are valuable, too, but at $25 a
quarter, they're not as clear-cut a value.

I believe many of them are also available for FTP for ARPA sites
from the INFO-MAC headquarters.

Does anyone want to start a mod.mac.technotes?
-- 
	Joel West	 	(619) 457-9681
	CACI, Inc. Federal, 3344 N. Torrey Pines Ct., La Jolla, CA  92037
	{cbosgd, ihnp4, sdcsvax, ucla-cs} !gould9!joel
	{seismo!s3sun, hplabs!hp-sdd, sun!pyramid} !gould9!joel
	joel%gould9.uucp@NOSC.ARPA