diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp
index 47a6d7c4bc..b21a79eb7d 100644
--- a/common/dsnlexer.cpp
+++ b/common/dsnlexer.cpp
@@ -148,6 +148,34 @@ void DSNLEXER::SetSpecctraMode( bool aMode )
}
}
+
+bool DSNLEXER::SyncLineReaderWith( DSNLEXER& aLexer )
+{
+ // Synchronize the pointers handling the data read by the LINE_READER
+ // only if aLexer shares the same LINE_READER, because only in this case
+ // the char buffer can be common
+
+ if( reader != aLexer.reader )
+ return false;
+
+ // Be sure the char buffer is common
+ if( reader->Line() != aLexer.reader->Line() )
+ return false;
+
+ // We can synchronize the pointers which handle the data currently read
+ start = aLexer.start;
+ next = aLexer.next;
+ limit = aLexer.limit;
+
+ // Sync these parameters is not mandatory, but could help
+ // for instance in debug
+ curText = aLexer.curText;
+ curOffset = aLexer.curOffset;
+
+ return true;
+}
+
+
void DSNLEXER::PushReader( LINE_READER* aLineReader )
{
readerStack.push_back( aLineReader );
diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp
index 99dde1c4bd..382e141bb3 100644
--- a/common/footprint_info.cpp
+++ b/common/footprint_info.cpp
@@ -275,6 +275,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{
+ if( aFootprintName.IsEmpty() )
+ return NULL;
+
BOOST_FOREACH( FOOTPRINT_INFO& fp, m_list )
{
FPID fpid;
diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp
index 6a3bbe66dd..6f71d20960 100644
--- a/eeschema/dialogs/dialog_bom.cpp
+++ b/eeschema/dialogs/dialog_bom.cpp
@@ -69,7 +69,6 @@ public:
private:
void parsePlugin() throw( IO_ERROR, PARSE_ERROR );
-
};
// PCB_PLOT_PARAMS_PARSER
@@ -162,7 +161,7 @@ private:
// the first is the title
// the second is the command line
wxArrayString m_plugins;
- wxConfigBase* m_config; // to store the "plugins"
+ wxConfigBase* m_config; // to store the "plugins"
public:
// Constructor and destructor
@@ -175,7 +174,6 @@ private:
void OnCancelClick( wxCommandEvent& event );
void OnHelp( wxCommandEvent& event );
void OnAddPlugin( wxCommandEvent& event );
- void OnChoosePlugin( wxCommandEvent& event );
void OnRemovePlugin( wxCommandEvent& event );
void OnEditPlugin( wxCommandEvent& event );
void OnCommandLineEdited( wxCommandEvent& event );
@@ -183,6 +181,25 @@ private:
void pluginInit();
void installPluginsList();
+
+ /**
+ * @return the Plugin filename from a command line
+ * @param aCommand = the command line
+ */
+ wxString getPluginFileName( const wxString& aCommand );
+
+ /**
+ * display (when exists) the text found between the keyword "@package"
+ * (compatible with doxygen comments)
+ * and the end of comment block (""" in python", --> in xml)
+ */
+ void displayPluginInfo( FILE * aFile, const wxString& aFilename );
+
+ /**
+ * Browse plugin files, and set m_CommandStringCtrl field
+ * @return a command line ro run the plugin
+ */
+ wxString choosePlugin();
};
// Create and show DIALOG_BOM.
@@ -215,12 +232,14 @@ DIALOG_BOM::~DIALOG_BOM()
STRING_FORMATTER writer;
writer.Print( 0, "(plugins" );
+
for( unsigned ii = 0; ii < m_plugins.GetCount(); ii += 2 )
{
writer.Print( 1, "(plugin %s (cmd %s))",
writer.Quotew( m_plugins[ii] ).c_str(),
writer.Quotew( m_plugins[ii+1] ).c_str() );
}
+
writer.Print( 0, ")" );
wxString list( FROM_UTF8( writer.GetString().c_str() ) );
@@ -272,6 +291,7 @@ void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event )
pluginInit();
}
+#include
-The
-Eeschema
-documentation, chapter 14
-describes this intermediate netlist and gives examples
-2 - The
-intermediate Netlist File
-BOM files (and
-netlist files) can be created from an Intermediate netlist file
-created by Eeschema.
-This file uses XML
-syntax and is called the intermediate netlist. The intermediate
-netlist includes a large amount of data about your board and because
-of this, it can be used with post-processing to create a BOM or other
-reports.
-Depending on the
-output (BOM or netlist), different subsets of the complete
-Intermediate Netlist file will be used in the post-processing.
-3 - Conversion to
-a new format
-By applying a
-post-processing filter to the Intermediate netlist file you can
-generate foreign netlist files as well as BOM files. Because this
-conversion is a text to text transformation.
-this post-processing
-filter can be written using Python, XSLT, or any other tool capable
-of taking XML as input.
-XSLT
+ p { margin-bottom: 0.21cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto }
+ p.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US }
+ a:link { color: #004586; text-decoration: none }
+ a.western:link { font-family: "Liberation Sans", sans-serif; so-language: zxx; font-style: italic }
+ a.sdfootnotesym-western { font-family: "DejaVu Serif", serif }
+
+
+
+
+
+The
+Eeschema
+documentation, chapter 14 describes
+this intermediate netlist and gives examples
+2
+- The intermediate Netlist File
+BOM
+files (and netlist files) can be created from an Intermediate netlist
+file created by Eeschema.
+This
+file uses XML syntax and is called the intermediate netlist. The
+intermediate netlist includes a large amount of data about your board
+and because of this, it can be used with post-processing to create a
+BOM or other reports.
+Depending
+on the output (BOM or netlist), different subsets of the complete
+Intermediate Netlist file will be used in the post-processing.
+3
+- Conversion to a new format
+By
+applying a post-processing filter to the Intermediate netlist file
+you can generate foreign netlist files as well as BOM files. Because
+this conversion is a text to text transformation.
+this
+post-processing filter can be written using Python, XSLT, or any
+other tool capable of taking XML as input.
+XSLT
itself is a XML language very suitable for XML transformations. There
-is a free program called xsltproc
-that
-you can download and install. The
-xsltproc
+is a free program called xsltproc
+that
+you can download and install. The
+xsltproc
program can be used to read the Intermediate XML netlist input file,
-apply a
+apply a
style-sheet to transform the input, and save the results in an output
file. Use of xsltproc requires a style-sheet file using XSLT
-conventions. The full conversion process is handled
-by
+conventions. The full conversion process is handled
+by
Eeschema, after it is configured once to run xsltproc in a specific
-way.
-4 -
-Initialization of the dialog window
-You should add a new
-pluging (a script) in plugin list by clicking on the Add Plugin
-button.
-4.1 - Plugin
-Configuration Parameters
-The Eeschema plug-in
-configuration dialog requires the following information:
- The title: for
- instance, the name of the netlist format.
- The command line to
- launch the converter (usually a script).
-Once you click on
-the generate button the following will happen:
- Eeschema creates an
- intermediate netlist file *.xml, for instance test.xml.
- Eeschema runs the
- script from the command line to create the final output file.
-4.2 - Generate
-netlist files with the command line
-Assuming we are
-using the program xsltproc.exe
-to
-apply the sheet style to the intermediate file, xsltproc.exe
-is
-executed with the following command.
-xsltproc.exe -o <
-output filename > < style-sheet filename > < input XML
-file to convert >
-On
-Windows the command line is the
-following.
-On
-Linux the command becomes as
-following.
+4
+- Initialization of the dialog window
+You
+should add a new pluging (a script) in plugin list by clicking on the
+Add Plugin button.
+4.1
+- Plugin Configuration Parameters
+The
+Eeschema plug-in configuration dialog requires the following
+information:
+ The
+ title: for instance, the name of the netlist format.
+ The
+ command line to launch the converter (usually a script).
+Once
+you click on the generate button the following will happen:
+ Eeschema
+ creates an intermediate netlist file *.xml, for instance test.xml.
+ Eeschema
+ runs the script from the command line to create the final output
+ file.
+4.2
+- Generate netlist files with the command line
+Assuming
+we are using the program xsltproc.exe
+to
+apply the sheet style to the intermediate file, xsltproc.exe
+is
+executed with the following command.
+xsltproc.exe
+-o < output filename > < style-sheet filename > <
+input XML file to convert >
+On
+Windows the command line is
+the following.
+On
+Linux the command becomes as
+following.
-Where
-myconverter.xsl
-is
+“%I”
+Where
+myconverter.xsl
+is
the style-sheet that you are applying. Do not forget the double
-quotes
-around
+quotes
+around
the file names, this allows them to have spaces after the
-substitution by Eeschema.
-The command line
-format accepts parameters for filenames:
-The supported
-formatting parameters are.
- %B => base
- filename and path of selected output file, minus path and extension.
- %I => complete
- filename and path of the temporary input file (the intermediate net
- file).
- %O => complete
- filename and path of the user chosen output file.
-%I will be replaced
-by the actual intermediate file name
-4.3 - Command
-line format: example for xsltproc
-The
-command line format for xsltproc is the following:
-On
-Windows:
-On
-Linux:
+The
+command line format accepts parameters for filenames:
+The
+supported formatting parameters are.
+ %B
+ => base filename and path of selected output file, minus path and
+ extension.
+ %I
+ => complete filename and path of the temporary input file (the
+ intermediate net file).
+ %O
+ => complete filename and path (but without extension) of the user
+ chosen output file.
+%I
+will be replaced by the actual intermediate file name
+4.3
+- Command line format: example for xsltproc
+4.3.1
+- Command line
+The
+command line format for xsltproc is the following:
+On
+Windows:
+On
+Linux:
-The
-above examples assume
-xsltproc
+/usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”
+The
+above examples assume
+xsltproc
is installed on your PC under Windows and all files located in
-kicad/bin.
-4.4 - Command
-line format: example for
-python scripts
-The command line
-format for python is something like:
-On
-Windows:
-On Linux:
-Assuming python is
-installed on your PC.
See also
-https://answers.launchpad.net/kicad/+faq/2265
See also
+https://answers.launchpad.net/kicad/+faq/2265
-
-
-
-
f:/kicad/bin/xsltproc.exe
--o “%O” f:/kicad/bin/plugins/myconverter.xsl “%I”
xsltproc
+way.
+
+
+
+
+
+
f:/kicad/bin/xsltproc.exe
+-o “%O” f:/kicad/bin/plugins/myconverter.xsl “%I”
xsltproc
-o “%O” /usr/local/kicad/bin/plugins/myconverter .xsl
-“%I”
-
-
%O
-will be replaced by the actual output file name.
< path of
-xsltproc > xsltproc
-< xsltproc parameters >
f:/kicad/bin/xsltproc.exe -o “%O”
-f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”
xsltproc
+substitution by Eeschema.
+
+
+
%O
+will be replaced by the actual output file name.
< path of
+xsltproc > xsltproc
+< xsltproc parameters >
f:/kicad/bin/xsltproc.exe -o “%O”
+f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”
xsltproc
-o “%O”
-/usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”
python
-<
-script file name > < input filename > <
-output filename >
python.exe f:/kicad/python/my_python_script.py
-“%I” “%O”
python
-/usr/local/kicad/python/my_python_script.py “%I”
-“%O”
+4.3.2 +- Remark:
+
+Most
+of time, the created file must have an extension, depending on its
+type.
Therefore you have to add to the option %O the
+right file extension.
+For +instance %O.csv to create a .csv file (comma separated +value file).
+
+
+
+
+4.4 +- Command line format: example for +python scripts
++4.4.1 +- Command line
+
+The
+command line format for python is something like:
python
+<
+script file name > < input filename > <
+output filename >
+On
+Windows:
python.exe f:/kicad/python/my_python_script.py
+“%I” “%O”
+On
+Linux:
python
+/usr/local/kicad/python/my_python_script.py “%I”
+“%O”
+Assuming +python is installed on your PC.
+
+
+
+
+Most
+of time, the created file must have an extension, depending on its
+type.
Therefore you have to add to the option %O the
+right file extension.
+For +instance %O.html to create a .html file.
+
+
+
+