res 4.03 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
/* 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:
Ben Avison's avatar
Ben Avison committed
57 58
 *                             ProgramName:resname
 *                or if that doesn't exist:
Neil Turton's avatar
Neil Turton committed
59 60 61 62 63 64 65 66
 *                             <ProgramName$Dir>.resname
 *                where ProgramName has been set using res_init.
 *
 */

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


Ben Avison's avatar
Ben Avison committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
/* ------------------------------- 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*/);


Neil Turton's avatar
Neil Turton committed
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
/* -------------------------- 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 */