gattrib
|
Functions to manipulate the TABLE structure. More...
#include <config.h>
#include <stdio.h>
#include <math.h>
#include <libgeda/libgeda.h>
#include "../include/struct.h"
#include "../include/prototype.h"
#include "../include/globals.h"
Go to the source code of this file.
Functions | |
TABLE ** | s_table_new (int rows, int cols) |
Create a new table. | |
TABLE ** | s_table_resize (TABLE **table, int rows, int old_cols, int new_cols) |
Resize a TABLE. | |
void | s_table_destroy (TABLE **table, int row_count, int col_count) |
Destroy a table. | |
int | s_table_get_index (STRING_LIST *local_list, char *local_string) |
Get a string index number. | |
STRING_LIST * | s_table_create_attrib_pair (gchar *row_name, TABLE **table, STRING_LIST *row_list, int num_attribs) |
Create attribute pair. | |
void | s_table_add_toplevel_comp_items_to_comp_table (const GList *obj_list) |
Add components to the component table. | |
void | s_table_add_toplevel_pin_items_to_pin_table (const GList *obj_list) |
Add pins to pin table. | |
void | s_table_gtksheet_to_all_tables () |
Push spreadsheet data to TABLEs. | |
void | s_table_gtksheet_to_table (GtkSheet *local_gtk_sheet, STRING_LIST *master_row_list, STRING_LIST *master_col_list, TABLE **local_table, int num_rows, int num_cols) |
Extract attributes from gtksheet into TABLE. |
This file holds functions involved in manipulating the TABLE structure, which is subsidiary to SHEET_DATA. TABLE is a 2 dimensional array of structs; each struct corresponds to the data about an element in a single cell of the spreadsheet.
Definition in file s_table.c.
TABLE** s_table_new | ( | int | rows, |
int | cols | ||
) |
This is the table creator. It returns a pointer to an initialized TABLE struct. As calling args, it needs the number of rows and cols to allocate. The table is a dynamically allocated 2D array of structs. To access data in a cell in the table, you reference (for example): ((sheet_data->comp_table)[i][j]).attrib_value (Parens used only for clarity. It works without parens.)
rows | Number of rows required in the new table |
cols | Number of columns required in the new table |
This function recreates the table with a new size. It can only increase the number of cols. You can't increase the number of rows since gattrib doesn't allow you to input new components. Decreasing the number of cols is also TBD.
table | Table to resize |
rows | Number of rows in the table |
old_cols | Number of columns previously in the table |
new_cols | Number of columns required in the table |
void s_table_destroy | ( | TABLE ** | table, |
int | row_count, | ||
int | col_count | ||
) |
int s_table_get_index | ( | STRING_LIST * | local_list, |
char * | local_string | ||
) |
STRING_LIST* s_table_create_attrib_pair | ( | gchar * | row_name, |
TABLE ** | table, | ||
STRING_LIST * | row_list, | ||
int | num_attribs | ||
) |
This function takes a table, a row list, and a row name, and returns a list holding name=value pairs for all attribs pertainent to that particular row. If the row holds no attribs, it just returns NULL.
row_name | Name of the row to search for |
table | Table to be searched |
row_list | list of rows |
num_attribs |
Definition at line 228 of file s_table.c.
void s_table_add_toplevel_comp_items_to_comp_table | ( | const GList * | obj_list | ) |
This fcn iterates over adds all objects found on this page looking for components. When it finds a component, it finds all component attribs and sticks them in the TABLE.
obj_list | pointer to GList containing objects on this page |
Definition at line 275 of file s_table.c.
void s_table_add_toplevel_pin_items_to_pin_table | ( | const GList * | obj_list | ) |
void s_table_gtksheet_to_all_tables | ( | ) |
void s_table_gtksheet_to_table | ( | GtkSheet * | local_gtk_sheet, |
STRING_LIST * | master_row_list, | ||
STRING_LIST * | master_col_list, | ||
TABLE ** | local_table, | ||
int | num_rows, | ||
int | num_cols | ||
) |
This function does the actual heavy lifting of looping through the spreadsheet, extracting the attribs from the cells, and placing them back into TABLE. This is the first step in saving out a project.
local_gtk_sheet | GtkSheet to save |
master_row_list | STRING_LIST of rows |
master_col_list | STRING_LIST of columns |
local_table | TABLE structure to fill |
num_rows | Number of rows in table |
num_cols | Number of columns in table |
Definition at line 678 of file s_table.c.