gattrib

s_toplevel.c File Reference

Functions to manipulate the TOPLEVEL struct. 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"
Include dependency graph for s_toplevel.c:

Go to the source code of this file.

Functions

int s_toplevel_read_page (TOPLEVEL *toplevel, char *filename)
 Read a schematic page.
void s_toplevel_verify_design (TOPLEVEL *toplevel)
 Verify the entire design.
void s_toplevel_gtksheet_to_toplevel (TOPLEVEL *toplevel)
 Copy data from gtksheet into TOPLEVEL struct.
void s_toplevel_add_new_attrib (gchar *new_attrib_name)
 Add a new attribute to the top level.
void s_toplevel_delete_attrib_col ()
 Delete an attribute column.
void s_toplevel_sheetdata_to_toplevel (TOPLEVEL *toplevel, PAGE *page)
 Copy SHEET_DATA content to TOP_LEVEL.
STRING_LISTs_toplevel_get_component_attribs_in_sheet (char *refdes)
 Get the component attributes from the top level.
void s_toplevel_update_component_attribs_in_toplevel (TOPLEVEL *toplevel, OBJECT *o_current, STRING_LIST *new_comp_attrib_list)
 Update component attributes in TOP_LEVEL.
STRING_LISTs_toplevel_get_net_attribs_in_sheet (char *netname)
void s_toplevel_update_net_attribs_in_toplevel (OBJECT *o_current, STRING_LIST *new_net_attrib_list)
STRING_LISTs_toplevel_get_pin_attribs_in_sheet (char *refdes, OBJECT *pin)
 Get pin attributes.
void s_toplevel_update_pin_attribs_in_toplevel (TOPLEVEL *toplevel, char *refdes, OBJECT *o_pin, STRING_LIST *new_pin_attrib_list)
 Update pin attributes in toplevel.

Detailed Description

This file holds functions involved in manipulating the TOPLEVEL data structure. TOPLEVEL is the data structure inherited from gEDA's other programs, and holds all info about a project in a form native to gEDA.

Definition in file s_toplevel.c.


Function Documentation

int s_toplevel_read_page ( TOPLEVEL *  toplevel,
char *  filename 
)

Reads in a schematic page & calls f_open, which fills out the toplevel structure.

Parameters:
toplevelTOPLEVEL structure
filenamefile to be opened
Returns:
1 on success, 0 on failure

Definition at line 64 of file s_toplevel.c.

void s_toplevel_verify_design ( TOPLEVEL *  toplevel)

This function loops through all components in the design looking for components which are placeholders.

Placeholders are inserted into the object list when no symbol file is found. If this function finds a placeholder, it warns the user.

Parameters:
toplevelpointer to the toplevel object to be verified

Definition at line 96 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_gtksheet_to_toplevel ( TOPLEVEL *  toplevel)

Called when the user invokes "save". It first places all data from gtksheet into SHEET_DATA. Then it loops through all pages & calls s_toplevel_sheetdata_to_toplevel() to place all stuff in SHEET_DATA into the libgeda TOPLEVEL structure.

Definition at line 135 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_add_new_attrib ( gchar *  new_attrib_name)

This function gets called when the user has entered a new attrib name, and clicked the OK button. It does this:

  1. It figures out which attrib/sheet is being added to
  2. It destroys the old table in preparation for the new attrib.
  3. It adds the new attrib to the master lists.
  4. It creates a new table with the new attrib.
  5. It then adds the appropriate col to the gtksheet.
    Parameters:
    new_attrib_nameattribute to be added

Definition at line 183 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_delete_attrib_col ( )

This function gets called when the user has selected a single attrib column, selected the edit->delete attrib item from the pull-down menu, and then said "yes" to the confirm dialog.

Definition at line 279 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_sheetdata_to_toplevel ( TOPLEVEL *  toplevel,
PAGE *  page 
)

This function loops through all objects on (PAGE page)->(OBJECT *start_obj). It takes the updated SHEET_DATA->TABLE data and then updates the objects with the new attribs & attrib values. For each component, it updates the attached attrib values using the updated values held in the SHEET_DATA->TABLE structure. It does so in three steps:

  1. First find and update component attribs.
  2. Then find and update net attribs.
  3. Finally find and update pin attribs.
    Parameters:
    toplevelTOPLEVEL structure
    pageschematic page to copy

Definition at line 394 of file s_toplevel.c.

Here is the call graph for this function:

STRING_LIST* s_toplevel_get_component_attribs_in_sheet ( char *  refdes)

This function returns a list of attributes attached to obj_name = comp refdes or netlist.

Parameters:
refdescomponent refdes to return values from
Returns:
a STRING_LIST where the data field holds a name=value string.

Definition at line 534 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_update_component_attribs_in_toplevel ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
STRING_LIST new_comp_attrib_list 
)

For each attrib string attached to the component, update it using the value held in new_comp_attrib_list. Algorithm:

  1. Form list of all component attribs held on both the component (o_current), as well as in the attrib list (SHEET_DATA).
  2. Loop over name=value pairs held in complete_comp_attrib_list.
  3. For each name=value pair, look for corresponding attrib on o_current.
  4. For each name=value pair, look for the corresponding attrib in new_comp_attrib_list.
  5. If the attrib exists on o_current and in new_comp_attrib_list, write the new value (from new_comp_attrib_list) into o_current.
  6. If the attrib exists on o_current, but is null in name=value pair, delete the attrib from o_current.
  7. If the attribs doesn't exist on o_current, but is non-null in the name=value pair, create an attrib object and add it to the part on o_current.
    Parameters:
    toplevelTOPLEVEL structure
    o_currentComponent (complex) to be updated.
    new_comp_attrib_listlist of name=value attribute pairs from SHEET_DATA.

Definition at line 623 of file s_toplevel.c.

Here is the call graph for this function:

STRING_LIST* s_toplevel_get_net_attribs_in_sheet ( char *  netname)
Todo:
Function doesn't do anything - candidate for removal?

Definition at line 832 of file s_toplevel.c.

void s_toplevel_update_net_attribs_in_toplevel ( OBJECT *  o_current,
STRING_LIST new_net_attrib_list 
)
Todo:
Function doesn't do anything - candidate for removal?

Definition at line 843 of file s_toplevel.c.

STRING_LIST* s_toplevel_get_pin_attribs_in_sheet ( char *  refdes,
OBJECT *  pin 
)

This function takes a pointer to the OBJECT pin, and returns a list of attribs found attached to the pin. The returned list is a STRING_LIST where the ->data holds a name=value string. The algorithm is as follows:

  1. Form refdes:pinnumber label for this pin.
  2. Get row number of this refdes:pinnumber
  3. Create a list of name=value pairs from entries in the pin_table on this row.
  4. Return list of name=value pairs found.
Parameters:
refdesRef des string
pinPin object
Returns:
name=value pair as a STRING_LIST

Definition at line 868 of file s_toplevel.c.

Here is the call graph for this function:

void s_toplevel_update_pin_attribs_in_toplevel ( TOPLEVEL *  toplevel,
char *  refdes,
OBJECT *  o_pin,
STRING_LIST new_pin_attrib_list 
)

For each attrib string attached to the pin, update it using the value held in new_pin_attrib_list. Algorithm:

  1. Loop over name=value pairs held in new_pin_attrib_list.
  2. For each name=value pair, look for corresponding attrib on pin.
  3. If the attrib exists on pin and in name=value pair, write the new value in.
  4. If the attrib exists on pin, but is null in name=value pair, delete the attrib.
  5. If the attribs doesn't exist on pin, but is non-null in the name=value pair, create an attrib object and add it to the pin.
    Parameters:
    toplevelTOPLEVEL structure
    refdesUnused - needs refactored out
    [in,out]o_pinpin to update
    [in]new_pin_attrib_listNew pin attribute list to apply

Definition at line 964 of file s_toplevel.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines