NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.52">Name Miscellaneous macros and functions -- Various utilities.
Synopsis
#include <gts.h>
#define GTS_COMMENTS
struct GtsFile ;
enum GtsTokenType ;
struct GtsFileVariable ;
GtsFile * gts_file_new (FILE *fp);
void gts_file_next_token (GtsFile *f);
void gts_file_first_token_after (GtsFile *f,
GtsTokenType type);
void gts_file_assign_start (GtsFile *f,
GtsFileVariable *vars);
GtsFileVariable * gts_file_assign_next (GtsFile *f,
GtsFileVariable *vars);
void gts_file_assign_variables (GtsFile *f,
GtsFileVariable *vars);
void gts_file_variable_error (GtsFile *f,
GtsFileVariable *vars,
const gchar *name,
const gchar *format,
...);
void gts_file_verror (GtsFile *f,
const gchar *format,
va_list args);
void gts_file_error (GtsFile *f,
const gchar *format,
...);
void gts_file_destroy (GtsFile *f);
Description The gts_get_token () and gts_get_newline () functions are used for parsing GTS geometric files.
Details GTS_COMMENTS#define GTS_COMMENTS "#!"
Set of characters used as comments identifiers in GTS geometric files.
struct GtsFilestruct GtsFile {
FILE * fp;
guint line, pos;
GString * token;
GtsTokenType type;
gchar * error;
guint curline, curpos;
guint scope, scope_max;
gint next_token;
gchar * delimiters;
gchar * comments;
gchar * tokens;
};
enum GtsTokenTypetypedef enum {
GTS_NONE = 1 << 8,
GTS_INT = 1 << 9,
GTS_UINT = 1 << 10,
GTS_FLOAT = 1 << 11,
GTS_DOUBLE = 1 << 12,
GTS_STRING = 1 << 13,
GTS_FILE = 1 << 14,
GTS_ERROR = 1 << 15
} GtsTokenType;
struct GtsFileVariablestruct GtsFileVariable {
GtsTokenType type;
gchar name[30];
gboolean unique;
gpointer data;
gboolean set;
guint line, pos;
};
gts_file_next_token ()void gts_file_next_token (GtsFile *f);
Reads next token from f and updates its token and delim fields.
gts_file_first_token_after ()Finds and sets the first token of a type different from type
occuring after a token of type type .
gts_file_assign_start ()Opens a block delimited by braces to read a list of optional
arguments specified by vars .
If an error is encountered the error field of f is set.
gts_file_assign_next ()Assigns the next optional argument of vars read from f .
gts_file_assign_variables ()Assigns all the variables belonging to vars found in f .
If an error is encountered the error field of f is set.
gts_file_variable_error ()void gts_file_variable_error (GtsFile *f,
GtsFileVariable *vars,
const gchar *name,
const gchar *format,
...);
Sets the error field of f using gts_file_verror ().
String name must match one of the variable names in vars .
If variable name has been assigned (using gts_file_assign_variables ())
sets the line and pos fields of f to the line and position where
it has been assigned.
gts_file_verror ()void gts_file_verror (GtsFile *f,
const gchar *format,
va_list args);
Sets the error field of f using g_strdup_vprintf ().
This function can be called only once and disables any other
operation on f (gts_file_close () excepted).
gts_file_error ()void gts_file_error (GtsFile *f,
const gchar *format,
...);
Sets the error field of f using gts_file_verror ().
This function can be called only once and disables any other
operation on f (gts_file_close () excepted).
gts_file_destroy ()void gts_file_destroy (GtsFile *f);
Frees all the memory allocated for f .