Table of Contents

Details of the implementation of the gEDA/gschem plugin

Introduction

The plugin for parsing and printing schematic files in the gEDA/gschem format is at [1] Github branch.
Get it by cloning the git repo : git clone git@github.sksavant/gnucap.git –branch lang_gschem or get this zip file : zipfile

If you already have latest snapshot of gnucap installed you just need to get the following files: 'src/lang_gschem.cc', 'src/d_net.cc', 'src/d_place.cc'. Also some change is need in lang_verilog.cc to print verilog code correctly. Some examples are present in 'geda/examples/ '

After getting the files compile the plugin with the following command:

  g++ -DHAVE_GEDA -shared -fPIC -o lang_geda.so lang_geda.cc d_net.cc d_place.cc  $(pkg-config --cflags gtk+-2.0 --libs libgeda)

And load it after running gnucap as follows:

  gnucap>load ./lang_geda.so 

This line can be added to '~/.gnucaprc' to load the plugin every time gnucap starts.
Switch the language to gEDA/gschem with the following command:

  gnucap>option lang=gschem OR
  gnucap>gschem

How parsing works in lang_geda

When the command 'gschem' is given, CMD_GSCHEM::do_it is called. After setting the language to gschem, parse_top_item is called, which will call new__instance after getting a line from the command stream.
Now depending on the type of the line parsed, which is found from find_type_in_string, corresponding parse_.. function is called. If a command or dev_comment is got, parse_command or parse_comment is called respectively.

If component is found, then CMD_C::do_it is called, which

If net or place or any other is got, parse_instance is called which will call respective parse_ functions.
When parse_net is called it will :

If a component is got, call parse_component which will :