;
; res.sh
;
; Locating resources
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's Sapphire library.
;
; Sapphire is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; Sapphire is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Sapphire.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Overview -------------------------------------------------------------
;
; Functions provided:
;
;  res_exists
;  res_country
;  res_find
;  res_init

		[	:LNOT::DEF:res__dfn
		GBLL	res__dfn

; --- res_exists ---
;
; On entry:	R0 == pointer to pathname
;
; On exit:	CS if the file exists, CC otherwise
;
; Use:		Tries to find the named file.  The file is deemed to exist
;		if OS_File can return a valid object type for it (i.e. not
;		`non-existant object' or actually raising errors).

		IMPORT	res_exists

; --- res_country ---
;
; On entry:	R0 == pointer to a buffer to use
;
; On exit:	R0 == pointer to country name (may not be in the buffer)
;
; Use:		Reads the name of the current country.  If no name can be
;		found, it returns a pointer to the string `UK' which should
;		do as a suitable default

		IMPORT	res_country

; --- res_find ---
;
; On entry:	R0 == pointer to resource filename
;		R1 == pointer to buffer to build filename in
;
; On exit:	R0 == pointer to start of full pathname (R1 on entry)
;		R1 == pointer to terminating null character
;		CS if the file could actually be found, CC otherwise
;
; Use:		Locates a resource file.  It searches, in order:
;
;		* resPrefix.Resources.leaf[suffix]
;		* resPrefix.Resources.country.leaf[suffix]
;		* resPrefix.leaf[suffix]
;
;		returning the last if none of them could be found.  Note
;		that `country' here is the currently configured country
;		setting, and `suffix' is the WIMP mode aspect ratio suffix
;		for the current mode (RISC OS 3 only).

		IMPORT	res_find

; --- res_init ---
;
; On entry:	R0 == pointer to application name
;
; On exit:	--
;
; Use:		Initialises the resource prefix to <appname$Dir>

		IMPORT	res_init

		]

;----- That's all, folks ----------------------------------------------------

		END
