diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/include/conf_driver.h | 205 | ||||
-rw-r--r-- | engines/sci/include/conf_parse.h | 106 | ||||
-rw-r--r-- | engines/sci/include/conf_subsystems.h | 78 |
3 files changed, 0 insertions, 389 deletions
diff --git a/engines/sci/include/conf_driver.h b/engines/sci/include/conf_driver.h deleted file mode 100644 index 3b1767e977..0000000000 --- a/engines/sci/include/conf_driver.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CONF_DRIVER_H_ -#define CONF_DRIVER_H_ - - -/* Possible values for enum types */ -typedef struct { - char *name; - int value; -} conf_value_t; - -typedef struct { - char *name; - char *description; - unsigned int type; - unsigned int flags; - union { char * str; - int nr - } default; /* Optional default value */ - int min; /* For subrange types */ - int max; /* For subrange types; for enum types */ - conf_value_t *values; /* For enum types; NULL-terminated */ - void *data; /* User data */ -} conf_option_t; - -#define CONF_OPTION_TYPE_INT 0 -#define CONF_OPTION_TYPE_SUBRANGE 1 /* ``interval'' type, i.e. bounded int */ -#define CONF_OPTION_TYPE_STRING 2 -#define CONF_OPTION_TYPE_BOOL 3 /* special built-in enum */ -#define CONF_OPTION_TYPE_ENUM 4 - -#define CONF_OPTION_FLAG_MANDATORY (1<<0) /* Option MUST be set */ -#define CONF_OPTION_FLAG_HAS_DEFAULT (1<<1) /* Option has a default value */ -#define CONF_OPTION_FLAG_DYNAMIC (1<<2) /* Option may be altered after initialisation */ - - -#define CONF_DRIVER_FAIL 1 -#define CONF_DRIVER_SUCCESS 0 - -typedef struct conf_header { - char [16] magic; /* MUST be CONF_DRIVER_MAGIC */ - int freesci_version; /* MUST be CONF_DRIVER_VERSION */ - int subsystem_id; /* CONF_SUBSYSTEM_*, if appropriate */ - int subsystem_version; - char *name; /* Long driver name */ - char *version; /* Long driver version */ - unsigned int dependencies; /* CONF_DRIVER_DEPENDENCY_* */ - conf_option_t *options; /* Last option has name of NULL */ - char * (*set_option)(void * self, /* points to base struct */ - conf_option_t *, - union { char *str; - int nr - }); /* Set option, return static error (if applicable) or NULL on success */ -} conf_header_t; /* Universal driver header */ - -struct conf_driver; -struct conf_subsystem; -struct conf_main; - -#define CONF_SUBSYSTEM_GFX 0 -#define CONF_SUBSYSTEM_SOUND 1 /* The sfx/player subsystem */ -#define CONF_SUBSYSTEM_PCM_DEVICE 2 -#define CONF_SUBSYSTEM_MIXER 3 -#define CONF_SUBSYSTEM_SEQ 4 /* HW sequencer or generic softseq interface */ -#define CONF_SUBSYSTEM_SOFTSEQ 5 -#define CONF_SUBSYSTEM_TIMER 6 - -#define CONF_SUBSYSTEMS_NR 7 - -typedef struct conf_driver { - conf_header_t header; - char * (*init)(struct conf_driver *self, - struct conf_subsystem *owner); /* Initialise, return static error message on error or NULL on success. - ** The owner is guaranteed to have been configured and guaranteed NOT to have - ** been initialised. */ - - void (*exit)(void); -} conf_driver_t; - -typedef struct conf_subsystem { - conf_header_t header; - char * (*init)(struct conf_subsystem *self, - struct conf_main *main, - struct conf_driver *driver); /* Initialise, return static error message on error or NULL on success. - ** The driver is configured and initialised, the main reference configured but - ** not initialised. */ - void (*exit)(void); - char *(*get_default_driver)(struct conf_subsystem *self, - int index); /* Get the nth default driver name, or NULL if there is none. These are tried in order if - ** there is no explicit choice. */ - conf_driver_t **builtin_drivers; /* NULL terminated list of built-in drivers */ - char *dynamic_driver_prefix; /* string prefix to dynamically loaded drivers for this subsystem */ -} conf_subsystem_t; - - -typedef struct conf_main { - conf_header_t header; - conf_subsystem_t *[CONF_SUBSYSTEMS_NR]; - char **dynamic_driver_locations; /* NULL terminated list of locations to check for dynamically loadable drivers */ - char * (*init)(struct conf_main *self); /* Return static error message, or NULL on success. */ - void (*exit)(void); -} conf_main_t; - - -#define CONF_DRIVER_MAGIC "FreeSCI driver" - -#define CONF_DRIVER_VERSION 1 - -/* Dependency flags */ -#define CONF_DRIVER_DEPENDENCY_GFX (1 << CONF_SUBSYSTEM_GFX) -#define CONF_DRIVER_DEPENDENCY_SOUND (1 << CONF_SUBSYSTEM_SOUND) -#define CONF_DRIVER_DEPENDENCY_PCM_DEVICE (1 << CONF_SUBSYSTEM_PCM_DEVICE) -#define CONF_DRIVER_DEPENDENCY_MIXER (1 << CONF_SUBSYSTEM_MIXER) -#define CONF_DRIVER_DEPENDENCY_SEQ (1 << CONF_SUBSYSTEM_SEQ) -#define CONF_DRIVER_DEPENDENCY_SOFTSEQ (1 << CONF_SUBSYSTEM_SOFTSEQ) -#define CONF_DRIVER_DEPENDENCY_TIMER (1 << CONF_SUBSYSTEM_TIMER) - -#define CONF_BUILTIN_DEPENDENCIES (CONF_DRIVER_DEPENDENCY_GFX | CONF_DRIVER_DEPENDENCY_SOUND) - -/* ---------------------------------------------- */ -/* -- convenience macros for driver developers -- */ -/* ---------------------------------------------- */ - - -char * -conf_default_set_option(void * self, conf_option_t *option, - union { char *str; - int nr - } value); -/* Default implementation of the option setting function -** Parameters: (void *) self: Reference to the structure we should be accessing -** (conf_option_t *) option: The option to set -** (char * | nr) value: The value to set -** Returns : (char *) NULL on success, a static error string otherwise -*/ - - -#define CONF_MK_HEADER(NAME, VERSION, SUBSYSTEM, DEPENDENCIES, OPTIONS, SETOPTION) \ - { \ - CONF_DRIVER_MAGIC, \ - CONF_DRIVER_VERSION, \ - SUBSYSTEM, \ - 0, \ - NAME, \ - VERSION, \ - DEPENDENCIES, \ - OPTIONS, \ - SETOPTION } - -#define CONF_OPT_ANY(STRUCTURE, FIELD, NAME, TYPE, DEFAULT, MIN, MAX, VALUES, FLAGS, DESCRIPTION) \ - { \ - NAME, \ - DESCRIPTION, \ - TYPE, \ - FLAGS, \ - DEFAULT, \ - MIN, \ - MAX, \ - VALUES, \ - (void *)(offsetof (STRUCTURE, FIELD)) \ - } - -#define CONF_OPT_INT(S, F, NAME, DEFAULT, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = DEFAULT}, 0, 0, NULL, (FLAGS) | CONF_OPTION_HAS_DEFAULT, DESCR) -#define CONF_OPT_INT_NODEFAULT(S, F, NAME, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = 0}, 0, 0, NULL, (FLAGS), DESCR) - -#define CONF_OPT_SUBRANGE(S, F, NAME, DEFAULT, MIN, MAX, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_SUBRANGE, {.nr = DEFAULT}, MIN, MAX, NULL, (FLAGS) | CONF_OPTION_HAS_DEFAULT, DESCR) -#define CONF_OPT_SUBRANGE_NODEFAULT(S, F, NAME, MIN, MAX, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_SUBRANGE, {.nr = 0}, MIN, MAX, NULL, (FLAGS), DESCR) - -#define CONF_OPT_STRING(S, F, NAME, DEFAULT, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_STRING, {.str = DEFAULT}, 0, 0, NULL, (FLAGS) | CONF_OPTION_HAS_DEFAULT, DESCR) -#define CONF_OPT_STRING_NODEFAULT(S, F, NAME, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_STRING, {.str = NULL}, 0, 0, NULL, (FLAGS), DESCR) - -#define CONF_OPT_BOOL(S, F, NAME, DEFAULT, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = DEFAULT}, 0, 0, NULL, (FLAGS) | CONF_OPTION_HAS_DEFAULT, DESCR) -#define CONF_OPT_BOOL_NODEFAULT(S, F, NAME, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = 0}, 0, 0, NULL, (FLAGS), DESCR) - -#define CONF_OPT_ENUM(S, F, NAME, DEFAULT, CHOICES, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = DEFAULT}, 0, 0, CHOICES, (FLAGS) | CONF_OPTION_HAS_DEFAULT, DESCR) -#define CONF_OPT_ENUM_NODEFAULT(S, F, NAME, CHOICES, FLAGS, DESCR) CONF_OPT_ANY(S, F, NAME, CONF_OPTION_TYPE_INT, {.nr = 0}, 0, 0, CHOICES, (FLAGS), DESCR) - -#define CONF_LAST_OPTION { NULL, NULL, -1, 0, 0, 0, 0, NULL } - - -#endif /* !defined(CONF_DRIVER_H_) */ diff --git a/engines/sci/include/conf_parse.h b/engines/sci/include/conf_parse.h deleted file mode 100644 index 43fee18907..0000000000 --- a/engines/sci/include/conf_parse.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -/* RAW parse (config layers zero and one) */ - -#ifndef CONF_PARSE_H_ -#define CONF_PARSE_H_ -#include "sci/include/conf_extension.h" - -#define CONF_PARSE_TYPE_WHITESPACE 1 /* Whitespace, comments */ -#define CONF_PARSE_TYPE_SUBSECTION 2 /* Subsection division */ -#define CONF_PARSE_TYPE_OPTION 3 /* Option or driver assignment */ -#define CONF_PARSE_TYPE_INCLUDE 4 /* External include file */ -#define CONF_PARSE_TYPE_EXTENSION 5 /* An ``extension'' */ -#define CONF_PARSE_TYPE_LEXERROR 255 /* Something lexically broken (stored in ``whitespace'') */ - -/* Base options */ -#define CONF_PARSE_BASEOPTION_VERSION 0 -#define CONF_PARSE_BASEOPTION_RESOURCEDIR 1 -#define CONF_PARSE_BASEOPTION_DEBUGMODE 2 - -typedef struct _conf_parse_struct { - int type; /* c. CONF_PARSE_TYPE */ - int line_nr; /* Line number in the current input file */ - - struct _conf_parse_struct *prev; - struct _conf_parse_struct *next; - struct _conf_parse_struct *overridden; /* In case we overrode something */ - - union { - char *whitespace; - struct { - char *subsystem; /* may be NULL if driver==NULL */ - char *driver; /* may be NULL */ - char *option; - char *centre_whitespace; - char *value; - char *terminal_whitespace; - } assignment; /* driver assignment, option */ - struct { - char *pre_whitespace; - char *name; - char *post_whitespace; - } subsection; - struct { - char *include_prefix; /* NULL for system includes */ - char *filename; /* Extracted from include_stmt, also a copy */ - char *include_suffix; /* NULL for system includes */ - int modifiable; /* May we write to this file? */ - struct _conf_parse_struct *options_head; - struct _conf_parse_struct *options_end; - } include; - conf_extension_t *extension; /* Extended information, cf. conf_extension.h */ - } data; -} conf_parse_t; - - - -conf_parse_t * -conf_read_file(char *config_file_name, int modifiable, conf_parse_t *previous); -/* Read configuration file -** Parameters: (char *) config_file_name: File name for the source config file -** (int) modifiable: Whether to treat the result as modifiable -** (conf_parse_t *) previous: Head of the previous configuration, or NULL if none -** Returns : (conf_parse_t *) Head of the combined config parse, or NULL on failure -** Effects : (stderr) Error message if the specified file was found but parsing failed -*/ - -void -conf_free_parse(conf_parse_t *raw_config); -/* Deallocates a conf_parse_t -** Parameters: (conf_parse_t *) raw_config: The raw parse to deallocate -** Returns : usually. -*/ - -void -conf_write_parse(conf_parse_t *raw_config); -/* Writes out all writeable parts of the configuration parse to the source files, if writeable -** Parameters: (conf_parse_t *) raw_config -** Effects : (stderr) Prints error message if ``modifiable'' file could not be written to -** (filesystem) All ``modifiable'' config files are overwritten -*/ - -#endif /* !defined (CONF_PARSE_H_) */ diff --git a/engines/sci/include/conf_subsystems.h b/engines/sci/include/conf_subsystems.h deleted file mode 100644 index 64c8124070..0000000000 --- a/engines/sci/include/conf_subsystems.h +++ /dev/null @@ -1,78 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CONF_SUBSYSTEMS_H_ -#define CONF_SUBSYSTEMS_H_ - -#include "conf_parse.h" -#include "conf_driver.h" - -conf_parse_t * -conf_validate(conf_main_t *main, conf_parse_t *raw_config); -/* Validates raw configuration data (including subsections) and fills in ``overridden'' and ``prev'' pointers -** Parameters: (conf_parse_t *) raw_config: The raw config data -** Returns : (conf_parse_t *) The updated raw_config on success, or NULL if validation failed -** (raw_config is not freed in that case) -** Effects : (stderr) Error message(s) if validation failed -*/ - -int -conf_init(conf_main_t *main, conf_parse_t *config, const char *id); -/* Validates all parameters, sets all parameters, loads modules, initialises drivers and subsystems and the main module -** Parameters: (conf_main_t *) The main config element -** (conf_parse_t *) The parse -** (char *) id: The game ID to choose for initialisation, or NULL for default -** Effects : (stderr) Error message(s) if validation failed -*/ - -char * -conf_set_main_option(conf_main_t *main, const char *option, const char *value); -/* Sets a value for the main module -** Parameters: (char *) option: Name of the option to set -** (char *) value: Value to set -** Returns : (char *) NULL on success, an error message otherwise -*/ - -char * -conf_set_subsystem_option(conf_main_t *main, const char *subsystem, const char *option, const char *value); -/* Sets a value for the main module -** Parameters: (char *) option: Name of the option to set -** (char *) value: Value to set -** (char *) subsystem: Name of the subsystem to manipulate -** Returns : (char *) NULL on success, an error message otherwise -*/ - -char * -conf_set_driver_option(conf_main_t *main, const char *subsystem, const char *driver, const char *option, const char *value); -/* Sets a value for the main module -** Parameters: (char *) option: Name of the option to set -** (char *) value: Value to set -** (char *) subsystem: Name of the subsystem to manipulate -** (char *) driver: Name of the driver to manipulate -** Returns : (char *) NULL on success, an error message otherwise -** Automatically loads the driver, if neccessary -*/ - -#endif /* !defined(CONF_SUBSYSTEMS_H_) */ |