From f86eb756afdebbd255a5d787155e6f7279567091 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 28 Oct 2014 15:43:12 -0400 Subject: [PATCH] Source license, coding policy, and documentation fixes. * Add more missing source code licenses. * Fix coding policy violations (tabs and trailing white space) in Python scripting code. * Add stable release policy to full documentation build. --- Doxyfile | 3 +- .../plugins/FPC_(SMD_type)_footprintwizard.py | 23 ++++ .../scripting/plugins/touch_slider_wizard.py | 23 ++++ polygon/polygon_test_point_inside.cpp | 24 ++++ polygon/polygon_test_point_inside.h | 26 +++- polygon/polygons_defs.h | 24 ++++ scripting/dlist.i | 100 ++++++++------ scripting/wx.i | 122 +++++++++--------- 8 files changed, 241 insertions(+), 104 deletions(-) diff --git a/Doxyfile b/Doxyfile index 162c74c097..773175fcb6 100644 --- a/Doxyfile +++ b/Doxyfile @@ -645,7 +645,8 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = Documentation/development/road-map.md \ +INPUT = Documentation/development/stable-release-policy.md \ + Documentation/development/road-map.md \ kicad \ pcbnew \ cvpcb \ diff --git a/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py b/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py index c93eb8f9ef..9a58f493ae 100644 --- a/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py +++ b/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py @@ -1,3 +1,26 @@ +# +# This program source code file is part of KiCad, a free EDA CAD application. +# +# Copyright (C) 2013-2014 KiCad Developers, see change_log.txt for contributors. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you may find one here: +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# or you may search the http://www.gnu.org website for the version 2 license, +# or you may write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + # This python script wizard creates a FPC connector # for Surface Mounted Technology diff --git a/pcbnew/scripting/plugins/touch_slider_wizard.py b/pcbnew/scripting/plugins/touch_slider_wizard.py index 5b33be7ed3..d8ededc57e 100644 --- a/pcbnew/scripting/plugins/touch_slider_wizard.py +++ b/pcbnew/scripting/plugins/touch_slider_wizard.py @@ -1,5 +1,28 @@ #!/usr/bin/python +# +# This program source code file is part of KiCad, a free EDA CAD application. +# +# Copyright (C) 2012-2014 KiCad Developers, see change_log.txt for contributors. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you may find one here: +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# or you may search the http://www.gnu.org website for the version 2 license, +# or you may write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + from pcbnew import * class TouchSliderWizard(FootprintWizardPlugin): diff --git a/polygon/polygon_test_point_inside.cpp b/polygon/polygon_test_point_inside.cpp index f63d9ba9d7..df2a34b2ad 100644 --- a/polygon/polygon_test_point_inside.cpp +++ b/polygon/polygon_test_point_inside.cpp @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2007-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file polygon_test_point_inside.cpp */ diff --git a/polygon/polygon_test_point_inside.h b/polygon/polygon_test_point_inside.h index ff43798159..833eba8e2a 100644 --- a/polygon/polygon_test_point_inside.h +++ b/polygon/polygon_test_point_inside.h @@ -1,6 +1,26 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: polygon_test_point_inside.h -///////////////////////////////////////////////////////////////////////////// +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2007-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ #ifndef __WXWINDOWS__ // define here wxPoint if we want to compile outside wxWidgets diff --git a/polygon/polygons_defs.h b/polygon/polygons_defs.h index 94437bfff8..82bccfab77 100644 --- a/polygon/polygons_defs.h +++ b/polygon/polygons_defs.h @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2012-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /* * file polygons_defs.h * definitions to use boost::polygon in KiCad. diff --git a/scripting/dlist.i b/scripting/dlist.i index aa3f5e25ad..43241ae3fc 100644 --- a/scripting/dlist.i +++ b/scripting/dlist.i @@ -1,43 +1,67 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo + * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /* DLIST python iteration code, to allow standard iteration over DLIST */ %extend DLIST { - %pythoncode - { - class DLISTIter: - def __init__(self,aList): - self.last = aList # last item is the start of list - - def next(self): # get the next item - - item = self.last - try: - item = item.Get() - except: - pass - - if item is None: # if the item is None, then finish the iteration - raise StopIteration - else: - ret = None - - # first item in list has "Get" as a DLIST - try: - ret = self.last.Get() - except: - ret = self.last # next items do not.. - - self.last = self.last.Next() - - # when the iterated object can be casted down in inheritance, just do it.. - - if 'Cast' in dir(ret): - ret = ret.Cast() - - return ret - - def __iter__(self): - return self.DLISTIter(self) - - } + %pythoncode + { + class DLISTIter: + def __init__(self,aList): + self.last = aList # last item is the start of list + + def next(self): # get the next item + + item = self.last + try: + item = item.Get() + except: + pass + + if item is None: # if the item is None, then finish the iteration + raise StopIteration + else: + ret = None + + # first item in list has "Get" as a DLIST + try: + ret = self.last.Get() + except: + ret = self.last # next items do not.. + + self.last = self.last.Next() + + # when the iterated object can be casted down in inheritance, just do it.. + + if 'Cast' in dir(ret): + ret = ret.Cast() + + return ret + + def __iter__(self): + return self.DLISTIter(self) + + } } diff --git a/scripting/wx.i b/scripting/wx.i index d3421bd94f..d5c07774ef 100644 --- a/scripting/wx.i +++ b/scripting/wx.i @@ -60,19 +60,19 @@ public: int GetWidth() const { return width; } void SetWidth(int w) { width = w; } - + int GetHeight() const { return height; } void SetHeight(int h) { height = h; } wxPoint GetPosition() const { return wxPoint(x, y); } void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } - + int x, y, width, height; - - %extend - { + + %extend + { /* extend the wxRect object so it can be converted into a tuple */ - PyObject* Get() + PyObject* Get() { PyObject* res = PyTuple_New(4); PyTuple_SET_ITEM(res, 0, PyInt_FromLong(self->x)); @@ -82,23 +82,23 @@ public: return res; } } - - - %pythoncode + + + %pythoncode { - - def __eq__(self,other): - return self.x==other.x and self.y==other.y and self.width==other.width and self.height==other.height + + def __eq__(self,other): + return self.x==other.x and self.y==other.y and self.width==other.width and self.height==other.height def __str__(self): return str(self.Get()) def __repr__(self): return 'wxRect'+str(self.Get()) def __len__(self): return len(self.Get()) def __getitem__(self, index): return self.Get()[index] def __setitem__(self, index, val): - if index == 0: self.SetX(val) - elif index == 1: self.SetY(val) - elif index == 2: self.SetWidth(val) - elif index == 3: self.SetHeight(val) - else: raise IndexError + if index == 0: self.SetX(val) + elif index == 1: self.SetY(val) + elif index == 2: self.SetWidth(val) + elif index == 3: self.SetHeight(val) + else: raise IndexError def __nonzero__(self): return self.Get() != (0,0,0,0) __safe_for_unpickling__ = True } @@ -113,9 +113,9 @@ public: int x,y; wxSize(int xx, int yy) : x(xx), y(yy) { } wxSize(double xx, double yy) : x(xx), y(yy) {} - %extend - { - PyObject* Get() + %extend + { + PyObject* Get() { PyObject* res = PyTuple_New(2); PyTuple_SET_ITEM(res, 0, PyInt_FromLong(self->x)); @@ -123,39 +123,39 @@ public: return res; } } - + ~wxSize(); - + void SetWidth(int w); void SetHeight(int h); int GetWidth() const; int GetHeight() const; - - - %pythoncode + + + %pythoncode { - def Scale(self,xscale,yscale): - return wxSize(self.x*xscale,self.y*yscale) - def __eq__(self,other): - return self.GetWidth()==other.GetWidth() and self.GetHeight()==other.GetHeight() - def __str__(self): return str(self.Get()) - def __repr__(self): return 'wxSize'+str(self.Get()) - def __len__(self): return len(self.Get()) - def __getitem__(self, index): return self.Get()[index] - def __setitem__(self, index, val): - if index == 0: self.SetWidth(val) - elif index == 1: self.SetHeight(val) - else: raise IndexError - def __nonzero__(self): return self.Get() != (0,0) - __safe_for_unpickling__ = True - + def Scale(self,xscale,yscale): + return wxSize(self.x*xscale,self.y*yscale) + def __eq__(self,other): + return self.GetWidth()==other.GetWidth() and self.GetHeight()==other.GetHeight() + def __str__(self): return str(self.Get()) + def __repr__(self): return 'wxSize'+str(self.Get()) + def __len__(self): return len(self.Get()) + def __getitem__(self, index): return self.Get()[index] + def __setitem__(self, index, val): + if index == 0: self.SetWidth(val) + elif index == 1: self.SetHeight(val) + else: raise IndexError + def __nonzero__(self): return self.Get() != (0,0) + __safe_for_unpickling__ = True + } }; // wxPoint class wrapper to (xx,yy) tuple ///////////////////////////////////// class wxPoint -{ +{ public: int x, y; wxPoint(int xx, int yy); @@ -166,8 +166,8 @@ public: wxPoint __sub__(const wxPoint& pt) { return *self - pt; } void Set(long x, long y) { self->x = x; self->y = y; } - PyObject* Get() - { + PyObject* Get() + { PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -175,7 +175,7 @@ public: } } - %pythoncode { + %pythoncode { def __eq__(self,other): return (self.x==other.x and self.y==other.y) def __ne__(self,other): return not (self==other) def __str__(self): return str(self.Get()) @@ -183,11 +183,11 @@ public: def __len__(self): return len(self.Get()) def __getitem__(self, index): return self.Get()[index] def __setitem__(self, index, val): - if index == 0: + if index == 0: self.x = val - elif index == 1: + elif index == 1: self.y = val - else: + else: raise IndexError def __nonzero__(self): return self.Get() != (0,0) @@ -204,7 +204,7 @@ public: // wxString wrappers ///////////////////////////////////////////////////////// -%typemap(out) wxString& +%typemap(out) wxString& { %#if wxUSE_UNICODE $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); @@ -215,7 +215,7 @@ public: %apply wxString& { wxString* } -%typemap(out) wxString +%typemap(out) wxString { %#if wxUSE_UNICODE $result = PyUnicode_FromWideChar($1.c_str(), $1.Len()); @@ -224,7 +224,7 @@ public: %#endif } -%typemap(varout) wxString +%typemap(varout) wxString { %#if wxUSE_UNICODE $result = PyUnicode_FromWideChar($1.c_str(), $1.Len()); @@ -233,14 +233,14 @@ public: %#endif } -%typemap(in) wxString& (bool temp=false) +%typemap(in) wxString& (bool temp=false) { $1 = newWxStringFromPy($input); if ($1 == NULL) SWIG_fail; temp = true; } -%typemap(freearg) wxString& +%typemap(freearg) wxString& { if (temp$argnum) delete $1; @@ -261,20 +261,20 @@ public: // wxArrayString wrappers ////////////////////////////////////////////////////// %typemap(in) wxArrayString& (bool temp=false) { - if (!PySequence_Check($input)) + if (!PySequence_Check($input)) { PyErr_SetString(PyExc_TypeError, "Not a sequence of strings"); SWIG_fail; } - + $1 = new wxArrayString; temp = true; int last=PySequence_Length($input); - for (int i=0; iAdd(*wxS); delete wxS; @@ -282,21 +282,19 @@ public: } } -%typemap(freearg) wxArrayString& +%typemap(freearg) wxArrayString& { - if (temp$argnum) + if (temp$argnum) delete $1; } -%typemap(out) wxArrayString& +%typemap(out) wxArrayString& { $result = wxArrayString2PyList(*$1); } -%typemap(out) wxArrayString +%typemap(out) wxArrayString { $result = wxArrayString2PyList($1); } - -