Main Page Alphabetical List Compound List File List Compound Members File Members
GATConfig.c File ReferenceMain file for the GATConfig class.
More...
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <unistd.h>
#include <sys/stat.h>
#include "GATUtil.h"
#include "GATConfig.h"
#include "GATTable.h"
#include "GATContext.h"
#include "GATErrors.h"
Include dependency graph for GATConfig.c:
Go to the source code of this file.
|
Compounds |
| struct | adaptor_list |
| struct | GATConfig_S |
Defines |
| #define | LINE_LENGTH 1024 |
| #define | RC_FILENAME ".gatrc" |
| #define | MAX_PATH _POSIX_PATH_MAX |
Enumerations |
| enum | linetype {
line_blank,
line_comment,
line_section,
line_adaptor,
line_string
} |
| enum | parse_error {
parse_success,
parse_empty_token,
parse_memory_failure,
parse_malformed_line
} |
Functions |
| GATResult | AddToAdaptorConfig (GATContext error_context, struct adaptor_list *adaptor, const char *nickname, GATTable config) |
| | AddAdaptorToConfig Adds a configuration table to an internal list for an adaptor.
|
| GATResult | ParseConfigFile (GATConfig this, GATContext error_context, const char *filename) |
| | ParseConfigFile Parse a GAT configuration file.
|
| enum parse_error | Tokenise (const char *line, char **token1, char **token2, enum linetype *type) |
| | Tokenise Determine what sort of string has been pased in and split into tokens.
|
| enum parse_error | ParseKeyVal (const char *string, char **token1, char **token2, enum linetype *type) |
| | ParseKeyVal Parse a line defining a key/value pair.
|
| enum parse_error | ParseString (const char *token_start, char **buffer) |
| | ParseString Parse a string token Strip whitespace from either end of a string and get rid of comments.
|
| enum parse_error | ParseSection (const char *token_start, char **buffer) |
| | ParseSection Parse a section definition Get a section name from a section definition.
|
| GATConfig | GATConfig_Create (GATContext error_context) |
| | GATConfig_Create The GATConfig constructor.
|
| void | GATConfig_Destroy (GATConfig *object) |
| | GATConfig_Destroy The GATConfig destructor.
|
| GATTable_const | GATConfig_GetSystemConfig (GATConfig_const this) |
| | GATConfig_GetSystemConfig Gets the system configuration table.
|
| GATConfigTableList_const | GATConfig_GetAdaptorConfigs (GATConfig_const this, const char *adaptor) |
| | GATConfig_GetAdaptorConfigs Gets the configuration tables for an adaptor.
|
| GATResult | GATConfig_AddAdaptorConfig (GATConfig this, GATContext error_context, const char *adaptor, const char *nickname, GATTable config) |
| | GATConfig_AddAdaptorConfig Adds a configuration table to an adaptor.
|
Variables |
| const char * | rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATConfig.c,v 1.18 2004/04/28 10:50:10 hartmutkaiser Exp $" |
Detailed Description
Main file for the GATConfig class.
A GATConfig object contains a set of configuration tables which define configuration parameters for the system and for specific adaptors.
- Date:
-
Tue Sep 23 2003
- Version:
-
- Header:
-
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATConfig.c,v 1.18 2004/04/28 10:50:10 hartmutkaiser Exp
Copyright (C) Tom Goodale This file is part of the GAT Engine. Contributed by Tom Goodale <goodale@aei.mpg.de>.
Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)
Definition in file GATConfig.c.
Define Documentation
| #define RC_FILENAME ".gatrc"
|
|
| #define MAX_PATH _POSIX_PATH_MAX
|
|
Enumeration Type Documentation
Function Documentation
|
|
ParseConfigFile Parse a GAT configuration file.
Open and parse the contents of a GAT configuration file, creating new configuration tables as necessary. - Parameters:
-
| this |
The GATConfig structure |
| filename |
The configuration filename. |
- Returns:
-
An error code.
Definition at line 424 of file GATConfig.c.
References filename, GAT_CREATE_STATUS, GAT_CREATE_STATUS_MSG, GAT_FILEOPEN_ERROR, GAT_INVALID_CONFIG_FORMAT, GAT_RETURN_STATUS, GAT_USES_STATUS, GATConfig_AddAdaptorConfig(), GATTable_Add_String(), GATTable_Create(), line_adaptor, line_blank, line_comment, LINE_LENGTH, line_section, line_string, linetype, MAX_PATH, parse_empty_token, parse_error, parse_malformed_line, parse_memory_failure, parse_success, and Tokenise().
Referenced by GATConfig_Create(). |
| enum parse_error Tokenise |
( |
const char * |
line, |
|
|
char ** |
token1, |
|
|
char ** |
token2, |
|
|
enum linetype * |
type |
|
) |
[static] |
|
|
|
Tokenise Determine what sort of string has been pased in and split into tokens.
Configuration file lines are either blank, comments, section definitions, adaptor definitions, or key/value pairs for the table. This function determines which, and splits the line into the requisite number of tokens. - Parameters:
-
| line |
The line to tokenise |
| token1 |
Buffer for first token on line. |
| token2 |
Buffer for first token on line. |
| type |
What type the line is. |
- Returns:
-
An error code.
Definition at line 593 of file GATConfig.c.
References line_blank, line_comment, line_section, linetype, parse_error, parse_success, ParseKeyVal(), and ParseSection().
Referenced by ParseConfigFile(). |
| enum parse_error ParseKeyVal |
( |
const char * |
string, |
|
|
char ** |
token1, |
|
|
char ** |
token2, |
|
|
enum linetype * |
type |
|
) |
[static] |
|
| enum parse_error ParseString |
( |
const char * |
token_start, |
|
|
char ** |
buffer |
|
) |
[static] |
|
| enum parse_error ParseSection |
( |
const char * |
token_start, |
|
|
char ** |
buffer |
|
) |
[static] |
|
|
|
GATConfig_Create The GATConfig constructor.
This is the constructor for GATConfig objects.
- Returns:
-
A new GATConfig
Definition at line 116 of file GATConfig.c.
References GATConfig_S::adaptor_configs, buf, GAT_CREATE_STATUS, GAT_CREATE_STATUS_MSG, GAT_CURRENT_STATUS, GAT_FAILED, GAT_MEMORYFAILURE, GAT_STORE_STATUS, GAT_USES_STATUS, GATConfig_Destroy(), GATResult, GATTable_Create(), GATUtil_strdup(), MAX_PATH, ParseConfigFile(), RC_FILENAME, and GATConfig_S::system_config.
Referenced by GATSelf_Create(). |
| void GATConfig_Destroy |
( |
GATConfig * |
object |
) |
|
|
|
|
GATConfig_GetSystemConfig Gets the system configuration table.
Gets the GATTable holding system configuration data. - Parameters:
-
| this |
The GATConfig structure |
- Returns:
-
The system configuration table.
Definition at line 235 of file GATConfig.c.
References GATConfig_const, and GATTable_const.
Referenced by Load(). |
|
|
GATConfig_GetAdaptorConfigs Gets the configuration tables for an adaptor.
An adaptor may have more than one configuration table associated with it. This function returns a list of them all. - Parameters:
-
| this |
The GATConfig structure |
| adaptor |
The adaptor to get the tables for. |
- Returns:
-
A list of adaptor configuration tables.
Definition at line 252 of file GATConfig.c.
References adaptor_list::configs, GATConfig_const, adaptor_list::name, and adaptor_list::next.
Referenced by Load(). |
Variable Documentation
const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATConfig.c,v 1.18 2004/04/28 10:50:10 hartmutkaiser Exp $" [static]
|
|
|