User Tools

Site Tools


libgeda3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
libgeda3 [2007/08/22 15:49]
pcjc2
libgeda3 [2012/02/20 15:14] (current)
Line 1: Line 1:
 +====== gEDA Library v3 Specification ======
  
 +===== Rationale =====
 +
 +The current version (2.x) of the libgeda shared library has a number of defects:
 +
 +  * Poor separation between public interface and internals, which leads to...
 +  * Frequent changes to the API
 +  * API contains large amounts of code specific to application internals ​
 +
 +This page is an attempt to itemise in detail what is required of libgeda, and what the interface to it should look like.  This will enable:
 +
 +  * More rigorous testing of library functions
 +  * Creation of language bindings for libgeda
 +  * Easier development of other applications for manipulating schematics
 +
 +===== Requirements =====
 +
 +==== Core ====
 +
 +  - Define data structures for representing schematics
 +  - Provide methods for creating and manipulating schematics
 +  - Provide methods for reading and storing schematics into files and data streams
 +  - Provide access to detailed data on errors and exceptions
 +  - Provide a simple interface for configuring libgeda'​s behaviour
 +
 +==== Secondary ====
 +
 +  - Make no assumptions about applications which will use the library
 +  - Make no assumptions about the compiler or architecture on which the library is being used
 +  - Fully reentrant for thread safety
 +  - Minimise number of dependency libraries
 +  - Detect and gracefully handle multiple instances accessing the same schematic file
 +
 +===== Coordinate System =====
 +
 +Because libgeda should "make no assumptions about applications which will use the library,"​ libgeda should use only "​world"​ coordinates throughout (the same coordinate system as used in the files). ​ See the [[geda:​file_format_spec|file format specification]].
 +
 +===== Configuration =====
 +
 +Currently, libgeda relies on an embedded Scheme interpreter ([[http://​www.gnu.org/​software/​guile/​|Guile]]) for configuring settings such as library search paths. ​ This has a number of pros and cons:
 +
 +Pros:
 +
 +  * All applications which access libgeda can automatically use the same settings
 +  * Arbitrary Scheme code can be used in the configuration process
 +
 +Cons:
 +
 +  * Large & complex dependency
 +  * Doesn'​t integrate nicely into applications which use e.g. the GNOME or KDE configuration mechanisms
 +  * Substantially complicates the creation of graphical user interfaces for configuring library settings
 +  * Problems with Guile backward-compatibility in the past
 +
 +It might, therefore, make more sense to provide a complete API for configuring libgeda, and rely on the application to handle the storage and loading of the configuration.
 +
 +===== Dependencies =====
 +
 +==== glib ====
 +
 +[[http://​developer.gnome.org/​doc/​API/​glib/​|glib]] provides a very large number of useful features that would make writing and maintaining libgeda easier. ​ These include:
 +
 +  * Portable definitions of basic types (although ''​intptr.h''​ does this too, and would probably be preferable)
 +  * Doubly- and singly-linked lists, and many other data structures
 +  * Plugin loading, memory allocation, threading, IO abstraction,​ ...
 +
 +Not having to reinvent the wheel -- and letting a much larger project be responsible for optimising and maintaining these features -- would make the libgeda code smaller and easier to understand and maintain. ​ libgeda already uses glib to a certain extent, but using it more extensively in future versions of libgeda does not immediately seem to be a bad idea.
 +
 +
 +==== gobject ====
 +
 +[[http://​developer.gnome.org/​doc/​API/​2.0/​gobject/​|gobject]] is an object-oriented programming system in C. It is used extensively in the GTK+ user interface toolkit. ​ In addition to class-like structures, it provides a signalling system that allows objects to emit, listen for and respond to events. ​ It is designed to be compatible with the object systems of other languages, and this is one of the chief reasons that so many bindings of GTK+ are available (Python, Perl, .NET, Java, C++, etc).
 +
 +gobject is often considered to be heavyweight,​ requiring lots of boilerplate code in order to use it effectively. ​ Its use in libgeda has historically been opposed, though its use in future versions may ease creation of bindings for libgeda in more directly object-oriented languages such as Python, Java or C++.
 +
 +GObject is currently used in libgeda for the GedaList class which wrapps a GList, and provides a notification signal when API is used to modify the list.
 +
 +===== References =====
 +
 +  * [[http://​www.unet.univie.ac.at/​aix/​aixprggd/​genprogc/​writing_reentrant_thread_safe_code.htm|Writing Reentrant and Thread-Safe Code]]