cake
/
libcasio
Archived
1
1
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libcasio/include/libcasio/mcs.h

131 lines
4.2 KiB
C

/* ****************************************************************************
* libcasio/mcs.h -- libcasio RAM filesystem.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libcasio.
* libcasio is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libcasio 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
#ifndef LIBCASIO_MCS_H
# define LIBCASIO_MCS_H
# include "cdefs.h"
# include "mcsfile.h"
# include "iter.h"
CASIO_BEGIN_NAMESPACE
CASIO_STRUCT(casio_mcs, casio_mcs_t)
CASIO_STRUCT(casio_mcsfuncs, casio_mcsfuncs_t)
/* ---
* Main Memory filesystem description.
* --- */
/* The Main Memory, also called MCS (for Main Control Structure),
* is a filesystem that represents all the RAM filesystems CASIO has had
* over the years in its calculators.
*
* It is the filesystem where the calculator stores all of the main and little
* informations, the biggest elements you can find in it being the programs
* most of the time. Up to the monochrome models, this main memory, index
* included, are of a maximum capacity of 64 KiB.
*
* Here are the callbacks you should set: */
typedef CASIO_HOOK_TYPE(int) casio_mcs_get_t
OF((void *casio__cookie, casio_mcsfile_t **casio__mcsfile,
casio_mcshead_t *casio__mcshead));
typedef CASIO_HOOK_TYPE(int) casio_mcs_put_t
OF((void *casio__cookie, casio_mcsfile_t *casio__mcsfile));
typedef CASIO_HOOK_TYPE(int) casio_mcs_delete_t
OF((void *casio__cookie, casio_mcshead_t *casio__mcshead));
typedef CASIO_HOOK_TYPE(int) casio_mcs_iter_t
OF((void *casio__cookie, casio_iter_t **casio__iter));
typedef CASIO_HOOK_TYPE(int) casio_mcs_close_t
OF((void *casio__cookie));
struct casio_mcsfuncs {
casio_mcs_get_t *casio_mcsfuncs_get;
casio_mcs_put_t *casio_mcsfuncs_put;
casio_mcs_delete_t *casio_mcsfuncs_delete;
casio_mcs_iter_t *casio_mcsfuncs_iter;
casio_mcs_close_t *casio_mcsfuncs_close;
};
/* ---
* Main Memory filesystem public functions.
* --- */
CASIO_BEGIN_DECLS
/* Open and close. */
CASIO_EXTERN(int) casio_open_mcs
OF((casio_mcs_t **casio__mcs, void *casio__cookie,
casio_mcsfuncs_t const *casio__funcs));
CASIO_EXTERN(int) casio_close_mcs
OF((casio_mcs_t *casio__mcs));
/* Get and put an MCS file. */
CASIO_EXTERN(int) casio_get_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcsfile_t **casio__mcsfile,
casio_mcshead_t *casio__mcshead));
CASIO_EXTERN(int) casio_put_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcsfile_t *casio__mcsfile,
int casio__change_ownership));
/* Transfer an MCS file. */
CASIO_EXTERN(int) casio_transfer_mcsfile
OF((casio_mcs_t *casio__dest, casio_mcs_t *casio__source,
casio_mcshead_t *casio__mcshead));
/* Delete an MCS file. */
CASIO_EXTERN(int) casio_delete_mcsfile
OF((casio_mcs_t *casio__mcs, casio_mcshead_t *casio__mcshead));
/* List MCS files (the deprecated way). */
typedef CASIO_HOOK_TYPE(void) casio_mcslist_t
OF((void *casio__cookie, casio_mcshead_t const *casio__mcshead));
CASIO_DEPRECATED CASIO_EXTERN(int) casio_list_mcsfiles
OF((casio_mcs_t *casio__mcs, casio_mcslist_t *casio__mcslist,
void *casio__mcookie));
/* Iterate on MCS entries. */
CASIO_EXTERN(int) casio_iter_mcsfiles
OF((tio_iter_t **casio__iter, casio_mcs_t *casio__mcs));
# define casio_next_mcshead(ITER, MCSFILEP) \
(tio_next((ITER), (void **)(casio_mcshead_t **)(MCSFILEP)))
/* Make a temporary main memory or copy an existing main memory into
* one. */
CASIO_EXTERN(int) casio_open_local_mcs
OF((casio_mcs_t **casio__mcs));
CASIO_EXTERN(int) casio_copy_mcs
OF((casio_mcs_t **casio__mcs, casio_mcs_t *casio__source_mcs));
CASIO_END_DECLS
CASIO_END_NAMESPACE
#endif /* LIBCASIO_MCS_H */