pcb 4.1.1
An interactive printed circuit board layout editor.

gts/misc.c File Reference

#include <stdlib.h>
#include <string.h>
#include "gts.h"
#include "gts-private.h"
#include "config.h"
Include dependency graph for gts/misc.c:

Go to the source code of this file.

Functions

static gboolean char_in_string (char c, const char *s)
static GtsFilefile_new (void)
GtsFilegts_file_new (FILE *fp)
GtsFilegts_file_new_from_string (const gchar *s)
void gts_file_destroy (GtsFile *f)
void gts_file_verror (GtsFile *f, const gchar *format, va_list args)
void gts_file_error (GtsFile *f, const gchar *format,...)
static gint next_char (GtsFile *f)
gint gts_file_getc (GtsFile *f)
guint gts_file_read (GtsFile *f, gpointer ptr, guint size, guint nmemb)
gint gts_file_getc_scope (GtsFile *f)
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)
GtsFileVariablegts_file_assign_next (GtsFile *f, GtsFileVariable *vars)
void gts_file_assign_variables (GtsFile *f, GtsFileVariable *vars)
has been assigned (using gts_file_assign_variables())

sets the

it has been assigned.

void gts_file_variable_error (GtsFile *f, GtsFileVariable *vars, const gchar *name, const gchar *format,...)

Variables

const guint gts_major_version = GTS_MAJOR_VERSION
const guint gts_minor_version = GTS_MINOR_VERSION
const guint gts_micro_version = GTS_MICRO_VERSION
const guint gts_interface_age = 1
const guint gts_binary_age = 1

Function Documentation

static gboolean char_in_string ( char  c,
const char *  s 
) [static]

Definition at line 33 of file gts/misc.c.

References FALSE, and TRUE.

Referenced by gts_file_getc(), and gts_file_next_token().

GtsFileVariable* gts_file_assign_next ( GtsFile f,
GtsFileVariable vars 
)

gts_file_assign_next: : a GtsFile. : a GTS_NONE terminated array of GtsFileVariable.

Assigns the next optional argument of read from .

Returns: the variable of which has been assigned or NULL if no variable has been assigned (if an error has been encountered the field of is set).

Definition at line 451 of file gts/misc.c.

References _GtsFileVariable::data, FALSE, GTS_DOUBLE, GTS_ERROR, GTS_FILE, gts_file_error(), gts_file_next_token(), GTS_FLOAT, GTS_INT, GTS_NONE, GTS_STRING, GTS_UINT, _GtsFile::line, _GtsFileVariable::line, _GtsFileVariable::name, _GtsFile::pos, _GtsFileVariable::pos, _GtsFile::scope_max, _GtsFileVariable::set, _GtsFile::token, TRUE, _GtsFileVariable::type, _GtsFile::type, and _GtsFileVariable::unique.

Referenced by gts_file_assign_variables().

Here is the call graph for this function:

void gts_file_assign_start ( GtsFile f,
GtsFileVariable vars 
)

gts_file_assign_start: : a GtsFile. : a GTS_NONE terminated array of GtsFileVariable.

Opens a block delimited by braces to read a list of optional arguments specified by .

If an error is encountered the field of is set.

Definition at line 420 of file gts/misc.c.

References FALSE, gts_file_error(), gts_file_next_token(), GTS_NONE, _GtsFile::scope_max, _GtsFile::type, and _GtsFileVariable::type.

Referenced by gts_file_assign_variables().

Here is the call graph for this function:

void gts_file_assign_variables ( GtsFile f,
GtsFileVariable vars 
)

gts_file_assign_variables: : a GtsFile. : an array of GtsFileVariable.

Assigns all the variables belonging to found in .

If an error is encountered the field of is set.

Definition at line 562 of file gts/misc.c.

References gts_file_assign_next(), and gts_file_assign_start().

Here is the call graph for this function:

void gts_file_destroy ( GtsFile f)

gts_file_destroy: : a GtsFile.

Frees all the memory allocated for .

Definition at line 107 of file gts/misc.c.

References _GtsFile::comments, _GtsFile::delimiters, _GtsFile::error, _GtsFile::s1, _GtsFile::token, _GtsFile::tokens, and TRUE.

void gts_file_error ( GtsFile f,
const gchar *  format,
  ... 
)

gts_file_error: : a . : the standard sprintf() format string. @...: the parameters to insert into the format string.

Sets the field of using gts_file_verror().

This function can be called only once and disables any other operation on (gts_file_close() excepted).

Definition at line 156 of file gts/misc.c.

References args, and gts_file_verror().

Referenced by graph_read(), gts_file_assign_next(), gts_file_assign_start(), gts_file_getc(), gts_graph_read(), gts_graph_read_jostle(), gts_psurface_read_vertex(), gts_surface_read(), nedge_read(), nface_read(), point_read(), and surface_read().

Here is the call graph for this function:

void gts_file_first_token_after ( GtsFile f,
GtsTokenType  type 
)

gts_file_first_token_after: : a GtsFile. : a GtsTokenType.

Finds and sets the first token of a type different from occuring after a token of type .

Definition at line 398 of file gts/misc.c.

References GTS_ERROR, gts_file_next_token(), GTS_NONE, and _GtsFile::type.

Referenced by gts_graph_read(), gts_graph_read_jostle(), gts_psurface_open(), gts_psurface_read_vertex(), gts_surface_read(), and surface_read().

Here is the call graph for this function:

gint gts_file_getc ( GtsFile f)

gts_file_getc : : a GtsFile.

Returns: the next character in or EOF if the end of the file is reached or if an error occured.

Definition at line 186 of file gts/misc.c.

References c, char_in_string(), _GtsFile::comments, _GtsFile::curline, _GtsFile::curpos, GTS_ERROR, gts_file_error(), _GtsFile::line, next_char(), _GtsFile::pos, _GtsFile::scope, and _GtsFile::type.

Referenced by gts_file_getc_scope().

Here is the call graph for this function:

gint gts_file_getc_scope ( GtsFile f)

gts_file_getc_scope : : a GtsFile.

Returns: the next character in in the scope defined by ->scope_max or EOF if the end of the file is reached or if an error occured.

Definition at line 270 of file gts/misc.c.

References c, GTS_ERROR, gts_file_getc(), _GtsFile::scope, _GtsFile::scope_max, and _GtsFile::type.

Referenced by gts_file_next_token().

Here is the call graph for this function:

GtsFile* gts_file_new ( FILE *  fp)

gts_file_new: : a file pointer.

Returns: a new GtsFile.

Definition at line 69 of file gts/misc.c.

References f, file_new(), fp, _GtsFile::fp, and gts_file_next_token().

Here is the call graph for this function:

GtsFile* gts_file_new_from_string ( const gchar *  s)

gts_file_new_from_string: : a string.

Returns: a new GtsFile.

Definition at line 88 of file gts/misc.c.

References f, file_new(), gts_file_next_token(), _GtsFile::s, and _GtsFile::s1.

Here is the call graph for this function:

guint gts_file_read ( GtsFile f,
gpointer  ptr,
guint  size,
guint  nmemb 
)

gts_file_read: : a GtsFile. : a pointer. : size of an element. : number of elements.

Reads elements of data, each bytes long, from , storing them at the location given by .

Returns: the number of elements read.

Definition at line 239 of file gts/misc.c.

References _GtsFile::curline, _GtsFile::curpos, _GtsFile::fp, GTS_ERROR, n, and _GtsFile::type.

Referenced by point_read().

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 
)

gts_file_verror: : a . : the standard sprintf() format string. : the list of parameters to insert into the format string.

Sets the field of using g_strdup_vprintf().

This function can be called only once and disables any other operation on (gts_file_close() excepted).

Definition at line 133 of file gts/misc.c.

References _GtsFile::error, GTS_ERROR, and _GtsFile::type.

Referenced by gts_file_error(), and gts_file_variable_error().

static gint next_char ( GtsFile f) [static]

Definition at line 170 of file gts/misc.c.

References _GtsFile::fp, and _GtsFile::s.

Referenced by gts_file_getc().


Variable Documentation

const guint gts_binary_age = 1

Definition at line 31 of file gts/misc.c.

const guint gts_interface_age = 1

Definition at line 30 of file gts/misc.c.

const guint gts_major_version = GTS_MAJOR_VERSION

Definition at line 27 of file gts/misc.c.

const guint gts_micro_version = GTS_MICRO_VERSION

Definition at line 29 of file gts/misc.c.

const guint gts_minor_version = GTS_MINOR_VERSION

Definition at line 28 of file gts/misc.c.