sc68fordevelopers  2.2.1
Typedefs | Enumerations | Functions
rsc68.h File Reference

sc68 resources access. More...

#include "file68/istream68.h"

Go to the source code of this file.

Typedefs

typedef istream_t *(* SC68rsc_handler_t) (SC68rsc_t, const char *, int)
 Resource handle function type. More...
 

Enumerations

enum  SC68rsc_t { SC68rsc_replay, SC68rsc_config, SC68rsc_sample, SC68rsc_dll }
 SC68 resource file type. More...
 

Functions

const char * SC68rsc_set_share (const char *path)
 Set shared resource path. More...
 
const char * SC68rsc_set_user (const char *path)
 Set user resource path. More...
 
void SC68rsc_get_path (const char **share, const char **user)
 Get resource pathes.
 
SC68rsc_handler_t SC68rsc_set_handler (SC68rsc_handler_t fct)
 Set/Get resource handler. More...
 
istream_tSC68rsc_open (SC68rsc_t type, const char *name, int mode)
 Open a resource in given mode. More...
 

Detailed Description

sc68 resources access.

Author
Benjamin Gerard ben@s.nosp@m.ashi.nosp@m.pa.co.nosp@m.m
Date
1998/10/07
Id
rsc68.h,v 2.2 2003/09/20 19:24:30 benjihan Exp

Typedef Documentation

typedef istream_t*(* SC68rsc_handler_t) (SC68rsc_t, const char *, int)

Resource handle function type.

Enumeration Type Documentation

enum SC68rsc_t

SC68 resource file type.

Enumerator
SC68rsc_replay 

68000 external replay.

SC68rsc_config 

Config file.

SC68rsc_sample 

Sc68 sample files.

SC68rsc_dll 

Sc68 dynamic library.

Function Documentation

const char* SC68rsc_set_share ( const char *  path)

Set shared resource path.

The SC68rsc_set_share() function set the shared resource path. The path will be duplicate by SC68strdup(). If path is null the current path is freed.

Parameters
pathNew shared resource path (0 for free).
Returns
new path (duplicated string).
Return values
0error (except for freeing)
const char* SC68rsc_set_user ( const char *  path)

Set user resource path.

The SC68rsc_set_user() function set the user resource path. The path will be duplicate by SC68strdup(). If path is null the current path is freed.

Parameters
pathNew user resource path (0 for free).
Returns
new path (duplicated string).
Return values
0error (except for freeing)
SC68rsc_handler_t SC68rsc_set_handler ( SC68rsc_handler_t  fct)

Set/Get resource handler.

The SC68rsc_set_handler() function set the current resource handler. If 0 is given as fct parameter the function does not set the handler. In all case the function returns the current handler. See below for more information about the default resource handler.

Resource handler
The resource handler is a function called by the SC68rsc_open() function. Some preliminary tests has already been performed. So the handler can assume that the name is not a NULL pointer and the mode is valid (either 1:reading or 2:writing). The resource handler must return an already opened istream_t or 0 in error case.
Default resource handler
The Default handler use a the istream_file_create() function.
  • If open mode is 2 (write mode) the default handler use the user resource path.
  • If open mode is 1 (read mode) the default handler tries in this order the user resource path and the shared resource path.
Parameters
fctNew resource handler (0 for reading current value).
Returns
previous value.
istream_t* SC68rsc_open ( SC68rsc_t  type,
const char *  name,
int  mode 
)

Open a resource in given mode.

The function SC68rsc_open() function opens an istream_t to access a resource.

Parameters
typeType of resource to open.
nameName of resource.
mode1:read-access, 2:write-access.
Returns
already opened istream_t stream.
Return values
0error.
See also
SC68rsc_set_handler() for more info on resource handler.