

** (c) 1995 GC/TBR

		opt alink

******* vartools.lib/stricmp_pol *********************************************
*
*  NAME
*	stricmp_pol -- case insensitive polish string comparision
*
*  SYNOPSIS
*	result = stricmp_pol(string1, string2)
*	D0		     A0       A1	
*
*	LONG stricmp_pol(STRPTR, STRPTR)
*
*  FUNCTION
*	Like stricmp but accounts for polish diacritical chars.
*	It's faaaast!
*
*  INPUTS
*	string1 = 1st string to compare (null-terminated)
*	string2 = 2nd string to compare (null-terminated)
*
*  RESULT
*	As usual in stricmps:
*		<0 means string1 < string2
*		=0 means string1 = string2
*		>0 means string1 > string2
*
*
******************************************************************************/

		XDEF	_stricmp_pol

_stricmp_pol
		move.l	a2,-(sp)

		lea	magictab(pc),a2 * we need here the magic... :)
		moveq	#0,d0
		moveq	#0,d1

.loop		move.b	(a0)+,d0
		beq.s	.mayeq
		move.b	(a2,d0.w),d0	; get the value from magictab :)

		move.b	(a1)+,d1
		beq.s	.ge
		move.b	(a2,d1.w),d1	; as above, for the second char

		cmp.b	d0,d1
		beq.s	.loop
		bcs.s	.ge

.lo		moveq	#-1,d0
		bra.s	.exit
.ge		moveq	#1,d0
		bra.s	.exit
.mayeq		tst.b	(a1)
		bne.s	.lo
		moveq	#0,d0

.exit		movem.l	(sp)+,a2
		rts

		cnop	0,4

magictab	incbin "stricmp_magic.bin"

