##stringtype assembler
##shortstrings
*****************************************************************
*   This file was created automatically by `%fv'
*   from "%f0".
*   Do NOT edit by hand!
*****************************************************************

*   Includefiles
	include "exec/types.i"
	include "utility/tagitem.i"
	include "libraries/locale.i"

*   Function declarations
	xdef	Open%bCatalog
	xdef	Close%bCatalog
	xdef	Get%bString

*   Referenced data
	xref	_LocaleBase

*   Referenced functions
	xref	_LVOOpenCatalogA
	xref	_LVOCloseCatalog
	xref	_LVOGetCatalogStr

*   Data definitions
	section data
OpenCatalogTags:
	cnop	0,4
	dc.l	OC_Language,0
	dc.l	OC_BuiltInLanguage,%b_BuiltInLanguage
	dc.l	OC_Version,%v
	dc.l	TAG_DONE,0

%b_BuiltInLanguage:
	%l,0

CatalogName:
	dc.b	'%b.catalog',0

\tcnop\t0,4\n\txdef\t%i\n%i:\tdc.l\t%d\n\t%s,0

	section bss
	cnop	0,4
%b_Catalog:
	ds.l	1


*   Code definitions
	section code

Open%bCatalog:
*   a0 = Locale
*   a1 = Language
	movem.l a2/a6,-(sp)             ;   Save Regs

	lea	OpenCatalogTags,a2	;   Store Language
	move.l	a1,4(a2)
	bne	Open%bCatalog1
	lea	8(a2),a2
Open%bCatalog1:
	move.l	_LocaleBase,a6		;   Call locale.OpenCatalog
	move.l	a6,d0			;   Locale opened?
	beq	Open%bCatalogEnd	;   No, skip
	tst.l	%b_Catalog		;   Catalog opened?
	bne	Open%bCatalogEnd	;   Yes, skip
	lea	CatalogName,a1
	jsr	_LVOOpenCatalogA(a6)
	move.l	d0,%b_Catalog
Open%bCatalogEnd:
	movem.l (sp)+,a2/a6
	rts


Close%bCatalog:
	move.l	a6,-(sp)
	move.l	%b_Catalog,a0		;   Close the Catalog, if needed
	move.l	#0,%b_Catalog
	move.l	_LocaleBase,a6
	move.l	a6,d0			;   Locale.library opened?
	beq	Close%bCatalogEnd	;   No, skip
	jsr	_LVOCloseCatalog(a6)
Close%bCatalogEnd:
	move.l	(sp)+,a6
	rts


Get%bString:
*   a0 = pointer to structure (ID, string)
	move.l	a6,-(sp)                ;   Save regs

	move.l	(a0)+,d0                ;   Get string number
	move.l	a0,a1			;   Get default string

Get%bString3:
	move.l	_LocaleBase,a6		;   Locale.library present?
	move.l	a6,d1
	beq	Get%bStringNoLoc	;   No, skip
	move.l	%b_Catalog,a0		;   Catalog opened?
	move.l	a0,d1
	beq	Get%bStringNoLoc	;   No, skip

	jsr	_LVOGetCatalogStr(a6)   ;   Call locale.library
Get%bStringEnd:
	move.l	(sp)+,a6
	rts

Get%bStringNoLoc:
	move.l	a1,d0
	bra	Get%bStringEnd

	end
