basic libgeda read and write functions
More...
#include <config.h>
#include <version.h>
#include <stdio.h>
#include "libgeda_priv.h"
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] | toplevel | The current TOPLEVEL. |
[in] | object_list | The 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.
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] | toplevel | A TOPLEVEL structure. |
[in] | object_list | The head of a GList of objects to save. |
[in] | save_attribs | Should 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.
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] | toplevel | The current TOPLEVEL. |
[in] | object_list | The head of a GList of OBJECTs to save. |
[in] | filename | The 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.
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] | toplevel | The current TOPLEVEL structure. |
[in] | object_list | The object_list to read data to. |
[in] | buffer | The memory buffer to read from. |
[in] | size | The size of the buffer. |
[in] | name | The 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.
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] | toplevel | The current TOPLEVEL structure. |
[in] | object_list | The object_list to read data to. |
[in] | filename | The 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.
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] | toplevel | The current TOPLEVEL object. |
[in,out] | list | The list with lines to scale. |
[in] | x_scale | The x scale value for the lines. |
[in] | y_scale | The 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.