/* Copyright 1996 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/****************************************************************************
 * This source file was written by Acorn Computers Limited. It is part of   *
 * the RISCOS library for writing applications in C for RISC OS. It may be  *
 * used freely in the creation of programs for Archimedes. It should be     *
 * used with Acorn's C Compiler Release 3 or later.                         *
 *                                                                          *
 ***************************************************************************/

/*
 * Title:   res.h
 * Purpose: Access to resources
 *
 */

# ifndef __res_h
# define __res_h

# include <stdio.h>       /*
                           * stdio.h checks if it's already been included
                           * so this is safe
                           */

/* -------------------------------- res_init ------------------------------
 * Description:   Initialises, ready for calling other res functions.
 *
 * Parameters:    const char *a -- your program name
 * Returns:       void.
 * Other Info:    call this before using any res functions
 *                (or before using any resspr functions!).
 *
 */

void res_init(const char *progname);


/* ------------------------------- res_findname ---------------------------
 * Description:   Creates full pathname for "resname" file.
 *
 * Parameters:    const char *resname -- name of one of your resource files
 *                char *buf -- buffer to put full pathname in
 * Returns:       TRUE always!!
 * Other Info:    full pathname is constructed as:
 *                             ProgramName:resname
 *                or if that doesn't exist:
 *                             <ProgramName$Dir>.resname
 *                where ProgramName has been set using res_init.
 *
 */

int res_findname(const char *resname, char *buf /*out*/);


/* ------------------------------- res_prefixnamewithpath -----------------
 * Description:   Creates full pathname for "resname" file.
 *
 * Parameters:    const char *resname -- name of one of your resource files
 *                char *buf -- buffer to put full pathname in
 * Returns:       TRUE always!!
 * Other Info:    full pathname is constructed as:
 *                             ProgramName:resname
 *                where ProgramName has been set using res_init.
 *
 */

int res_prefixnamewithpath(const char *resname, char *buf /*out*/);


/* ------------------------------- res_prefixnamewithdir ------------------
 * Description:   Creates full pathname for "resname" file.
 *
 * Parameters:    const char *resname -- name of one of your resource files
 *                char *buf -- buffer to put full pathname in
 * Returns:       TRUE always!!
 * Other Info:    full pathname is constructed as:
 *                             <ProgramName$Dir>.resname
 *                where ProgramName has been set using res_init.
 *
 */

int res_prefixnamewithdir(const char *resname, char *buf /*out*/);


/* -------------------------- res_openfile --------------------------------
 * Description:   opens a named resource file, in a given ANSI-style mode.
 *
 * Parameters:    const char *resname -- name of the resource file
 *                const char *mode -- usual ANSI open mode ("r", "w", etc)
 * Returns:       ANSI FILE pointer for opened file.
 * Other Info:    resname should be a "leafname" (a call to res_findname is
 *                made for you!).
 *
 */

FILE *res_openfile(const char *resname, const char *mode);

#endif

/* end of res.h */