libgeda

a_basic.c File Reference

basic libgeda read and write functions More...

#include <config.h>
#include <version.h>
#include <stdio.h>
#include "libgeda_priv.h"
Include dependency graph for a_basic.c:

Go to the source code of this file.

Functions

gchar * o_file_format_header ()
 Get the file header string.
gchar * o_save_buffer (TOPLEVEL *toplevel, GList *object_list)
 "Save" a file into a string buffer
gchar * o_save_objects (TOPLEVEL *toplevel, GList *object_list, gboolean save_attribs)
 Save a series of objects into a string buffer.
int o_save (TOPLEVEL *toplevel, GList *object_list, char *filename, GError **err)
 Save a file.
GList * o_read_buffer (TOPLEVEL *toplevel, GList *object_list, char *buffer, int size, char *name, GError **err)
 Read a memory buffer.
GList * o_read (TOPLEVEL *toplevel, GList *object_list, char *filename, GError **err)
 Read a file.
void o_scale (TOPLEVEL *toplevel, GList *list, int x_scale, int y_scale)
 Scale a set of lines.

Detailed Description

Definition in file a_basic.c.


Function Documentation

gchar* o_file_format_header ( )
Function Description
This function simply returns the DATE_VERSION and FILEFORMAT_VERSION formatted as a gEDA file header.
Warning:
Do not free the returned string.

Definition at line 45 of file a_basic.c.

gchar* o_save_buffer ( TOPLEVEL toplevel,
GList *  object_list 
)
Function Description
This function saves a whole schematic into a buffer in libgeda format. The buffer should be freed when no longer needed.
Parameters:
[in]toplevelThe current TOPLEVEL.
[in]object_listThe head of a GList of OBJECTs to save.
Returns:
a buffer containing schematic data or NULL on failure.

Definition at line 65 of file a_basic.c.

Here is the call graph for this function:

gchar* o_save_objects ( TOPLEVEL toplevel,
GList *  object_list,
gboolean  save_attribs 
)
Function Description
This function recursively saves a set of objects into a buffer in libgeda format. User code should not normally call this function; they should call o_save_buffer() instead.

With save_attribs passed as FALSE, attribute objects are skipped over, and saved separately - after the objects they are attached to. When we recurse for saving out those attributes, the function must be called with save_attribs passed as TRUE.

Parameters:
[in]toplevelA TOPLEVEL structure.
[in]object_listThe head of a GList of objects to save.
[in]save_attribsShould attribute objects encounterd be saved?
Returns:
a buffer containing schematic data or NULL on failure.

Todo:
Maybe we can continue instead of just failing completely? In any case, failing gracefully is better than killing the program, which is what this used to do...

Definition at line 97 of file a_basic.c.

Here is the call graph for this function:

int o_save ( TOPLEVEL toplevel,
GList *  object_list,
char *  filename,
GError **  err 
)
Function Description
This function saves the data in a libgeda format to a file
Bug:
g_access introduces a race condition in certain cases, but solves bug #698565 in the normal use-case
Parameters:
[in]toplevelThe current TOPLEVEL.
[in]object_listThe head of a GList of OBJECTs to save.
[in]filenameThe filename to save the data to.
[in,out]err#GError structure for error reporting.
Returns:
1 on success, 0 on failure.

Definition at line 228 of file a_basic.c.

Here is the call graph for this function:

GList* o_read_buffer ( TOPLEVEL toplevel,
GList *  object_list,
char *  buffer,
int  size,
char *  name,
GError **  err 
)
Function Description
This function reads data in libgeda format from a memory buffer.

If the size argument is negative, the buffer is assumed to be null-terminated.

The name argument is used for debugging, and should be set to a meaningful string (e.g. the name of the file the data is from).

Parameters:
[in,out]toplevelThe current TOPLEVEL structure.
[in]object_listThe object_list to read data to.
[in]bufferThe memory buffer to read from.
[in]sizeThe size of the buffer.
[in]nameThe name to describe the data with.
Returns:
GList of objects if successful read, or NULL on error.

Definition at line 269 of file a_basic.c.

Here is the call graph for this function:

GList* o_read ( TOPLEVEL toplevel,
GList *  object_list,
char *  filename,
GError **  err 
)
Function Description
This function reads a file in libgeda format.
Parameters:
[in,out]toplevelThe current TOPLEVEL structure.
[in]object_listThe object_list to read data to.
[in]filenameThe filename to read from.
[in,out]err#GError structure for error reporting, or NULL to disable error reporting
Returns:
object_list if successful read, or NULL on error.

Definition at line 556 of file a_basic.c.

Here is the call graph for this function:

void o_scale ( TOPLEVEL toplevel,
GList *  list,
int  x_scale,
int  y_scale 
)
Function Description
This function takes a list of lines and scales them by the values of x_scale and y_scale.
Parameters:
[in]toplevelThe current TOPLEVEL object.
[in,out]listThe list with lines to scale.
[in]x_scaleThe x scale value for the lines.
[in]y_scaleThe y scale value for the lines.
Todo:
this really doesn't belong here. you need more of a core routine first. yes.. this is the core routine, just strip out the drawing stuff move it to o_complex_scale

Definition at line 592 of file a_basic.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines