cake
/
libg1m
Archived
1
0
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.
libg1m/include/libg1m/formatutils.h

71 lines
3.1 KiB
C

/* *****************************************************************************
* libg1m/formatutils.h -- libg1m format decoder helpers.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libg1m.
* libg1m 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.
*
* libg1m 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 libg1m; if not, see <http://www.gnu.org/licenses/>.
*
* Even though the structures and constants are shared in public headers, some
* things cannot be defined easily in structures and constants, such as
* strings <-> types correspondances. These utilities are there for this.
*
* If you want to implement the format lecture yourself, either link with
* libg1m and use these functions directly, or copy their sources in
* `src/utils/type.c` and/or `src/utils/mcstype.c`.
* ************************************************************************** */
#ifndef LIBG1M_FORMATUTILS_H
# define LIBG1M_FORMATUTILS_H
# include <libg1m/format.h>
# ifdef __cplusplus
extern "C" {
# endif
/* ************************************************************************** */
/* General types (`g1m_t`) */
/* ************************************************************************** */
/* Standard header */
# define g1m_stdflag_check1 0x0001 /* check first control value */
# define g1m_stdflag_check2 0x0002 /* check second control value */
# define g1m_stdflag_sub 0x0004 /* is followed by a standard subheader */
# define g1m_stdflag_pic 0x0008 /* is followed by a picture subheader */
extern int g1m_maketype_std(const char *path,
unsigned char *main_id, unsigned char *subtype,
const char **info, unsigned int *flags,
g1m_platform_t *platform, g1m_type_t *type);
/* Standard Subheader */
//# define g1m_subflag_check 0x0001
extern int g1m_maketype_sub(int raw_type, int raw_pf, unsigned int *flags,
g1m_type_t *type, g1m_platform_t *platform);
/* ************************************************************************** */
/* MCS types (`g1m_mcshead_t`/`g1m_mcsfile_t`) */
/* ************************************************************************** */
/* get mcs type data */
extern int g1m_maketype_mcs(g1m_mcshead_t *head,
const char *groupname, const char *dirname,
const char *filename, unsigned int rawtype);
/* get cas type data */
extern int g1m_maketype_cas(g1m_mcshead_t *head,
const char *datatype);
/* get caspro type data */
extern int g1m_maketype_caspro(g1m_mcshead_t *head,
const char *maintype, const char *datatype);
# ifdef __cplusplus
}
# endif
#endif /* LIBG1M_FORMATUTILS_H */