From daa0874278b49005ae3f19800534e1004e574a00 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Thu, 7 Aug 2014 18:43:37 -0400
Subject: [PATCH] reordered includes to ensure that boost/python.hpp is
 included before system headers

---
 modules/config/base.hh                        |  1 -
 modules/gui/src/python_shell/gutter.cc        |  2 +-
 .../gui/src/python_shell/python_completer.cc  |  2 +-
 .../src/python_shell/python_context_parser.hh |  2 +-
 .../src/python_shell/python_interpreter.hh    |  5 +---
 .../python_shell/python_interpreter_worker.cc | 20 ++++++++++++++++
 .../python_shell/python_interpreter_worker.hh | 24 +++++++++++++++++--
 .../python_namespace_tree_item.cc             |  2 +-
 modules/gui/src/python_shell/python_shell.cc  |  4 ++--
 .../gui/src/python_shell/python_shell_fw.hh   |  2 --
 .../src/python_shell/python_shell_widget.cc   |  9 ++++---
 .../src/python_shell/python_shell_widget.hh   |  7 +++---
 .../python_shell/python_syntax_highlighter.cc |  3 +--
 modules/gui/src/python_shell/shell_history.hh |  2 +-
 modules/gui/src/python_shell/state.cc         | 21 +++++++++++++++-
 modules/gui/src/python_shell/state.hh         | 19 +++++++++++++++
 modules/gui/src/python_shell/state_machine.cc | 19 +++++++++++++++
 modules/gui/src/python_shell/state_machine.hh | 19 +++++++++++++++
 modules/gui/src/python_shell/transition.cc    | 21 +++++++++++++++-
 modules/gui/src/python_shell/transition.hh    | 23 ++++++++++++++++--
 .../gui/src/python_shell/transition_guard.cc  | 22 ++++++++++++++++-
 .../gui/src/python_shell/transition_guard.hh  | 19 +++++++++++++++
 22 files changed, 217 insertions(+), 31 deletions(-)

diff --git a/modules/config/base.hh b/modules/config/base.hh
index 02bdc2b4c..2019437b5 100644
--- a/modules/config/base.hh
+++ b/modules/config/base.hh
@@ -19,7 +19,6 @@
 #ifndef OST_BASE_HH
 #define OST_BASE_HH
 
-#include <string>
 #include <cmath>
 #include <math.h>
 #include <complex>
diff --git a/modules/gui/src/python_shell/gutter.cc b/modules/gui/src/python_shell/gutter.cc
index bb8cb98ee..eed96f457 100644
--- a/modules/gui/src/python_shell/gutter.cc
+++ b/modules/gui/src/python_shell/gutter.cc
@@ -49,7 +49,7 @@ void Gutter::paintEvent(QPaintEvent* paint_event)
   QPainter painter(this);
   painter.setPen(QPen(Qt::black));
   painter.fillRect(paint_event->rect(), QBrush(Qt::lightGray));
-  for (GutterBlockList::const_iterator it=blocks.begin(); 
+  for (GutterBlockList::const_iterator it=blocks.begin();
        it!=blocks.end(); ++it) {
     if (it->type & BLOCKTYPE_ACTIVE) {
       QColor green(Qt::green);
diff --git a/modules/gui/src/python_shell/python_completer.cc b/modules/gui/src/python_shell/python_completer.cc
index 9ec41df66..af7f93d38 100644
--- a/modules/gui/src/python_shell/python_completer.cc
+++ b/modules/gui/src/python_shell/python_completer.cc
@@ -20,10 +20,10 @@
   Authors: Marco Biasini, Andreas Schenk
  */
 
-#include <iostream>
 
 #include "python_completer.hh"
 #include "python_namespace_tree_model.hh"
+#include <iostream>
 #include <QStringList>
 
 
diff --git a/modules/gui/src/python_shell/python_context_parser.hh b/modules/gui/src/python_shell/python_context_parser.hh
index ddc2c93dd..0e5df593f 100644
--- a/modules/gui/src/python_shell/python_context_parser.hh
+++ b/modules/gui/src/python_shell/python_context_parser.hh
@@ -23,10 +23,10 @@
   Author: Marco Biasini
 */
 
+#include "python_tokenizer.hh"
 #include <vector>
 #include <iostream>
 
-#include "python_tokenizer.hh"
 
 namespace ost { namespace gui {
     
diff --git a/modules/gui/src/python_shell/python_interpreter.hh b/modules/gui/src/python_shell/python_interpreter.hh
index 5f12d6bbd..3cbe055cb 100644
--- a/modules/gui/src/python_shell/python_interpreter.hh
+++ b/modules/gui/src/python_shell/python_interpreter.hh
@@ -27,14 +27,11 @@
 #ifndef PYTHON_INTERPRETER_HH
 #define PYTHON_INTERPRETER_HH
 
-#include <vector>
 
-#include <ost/gui/module_config.hh>
-
-#include <ost/gui/module_config.hh>
 #include "python_interpreter_worker.hh"
 #include "output_redirector.hh"
 #include "main_thread_runner.hh"
+#include <ost/gui/module_config.hh>
 
 #include <QQueue>
 #include <QMetaType>
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc
index 68f38a247..e75f48460 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.cc
+++ b/modules/gui/src/python_shell/python_interpreter_worker.cc
@@ -1,3 +1,23 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
+
 #include "python_interpreter_worker.hh"
 #include "python_interpreter.hh"
 
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.hh b/modules/gui/src/python_shell/python_interpreter_worker.hh
index ed80f6fe7..557604900 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.hh
+++ b/modules/gui/src/python_shell/python_interpreter_worker.hh
@@ -1,14 +1,34 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
+
 #ifndef PYTHON_INTERPRETER_WORKER_HH
 #define PYTHON_INTERPRETER_WORKER_HH
 
-#include <csignal>
-#include <utility>
 // workaround for QTBUG-22829: https://bugreports.qt-project.org/browse/QTBUG-22829
 #ifndef Q_MOC_RUN
   #include <boost/python.hpp>
   #include <boost/shared_ptr.hpp>
 #endif
 #include "output_redirector.hh"
+#include <csignal>
+#include <utility>
 #include <QObject>
 #include <QQueue>
 
diff --git a/modules/gui/src/python_shell/python_namespace_tree_item.cc b/modules/gui/src/python_shell/python_namespace_tree_item.cc
index e16bbede4..5c59e2358 100644
--- a/modules/gui/src/python_shell/python_namespace_tree_item.cc
+++ b/modules/gui/src/python_shell/python_namespace_tree_item.cc
@@ -17,9 +17,9 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
 
+#include "python_namespace_tree_item.hh"
 #include <ost/base.hh>
 
-#include "python_namespace_tree_item.hh"
 
 
 
diff --git a/modules/gui/src/python_shell/python_shell.cc b/modules/gui/src/python_shell/python_shell.cc
index cdd9c28c3..6690506d2 100644
--- a/modules/gui/src/python_shell/python_shell.cc
+++ b/modules/gui/src/python_shell/python_shell.cc
@@ -21,11 +21,11 @@
   Author: Marco Biasini
  */
 
+#include "python_shell.hh"
+#include "python_shell_widget.hh"
 #include <ost/gui/gosty_app.hh>
 #include <ost/gui/widget_registry.hh>
 
-#include "python_shell.hh"
-#include "python_shell_widget.hh"
 
 #include <QVBoxLayout>
 namespace ost { namespace gui {
diff --git a/modules/gui/src/python_shell/python_shell_fw.hh b/modules/gui/src/python_shell/python_shell_fw.hh
index d70eb83d8..9abb7cae1 100644
--- a/modules/gui/src/python_shell/python_shell_fw.hh
+++ b/modules/gui/src/python_shell/python_shell_fw.hh
@@ -23,7 +23,6 @@
   Author: Andreas Schenk
  */
 
-#include <vector>
 namespace ost { namespace gui {
 
 // fw decl
@@ -51,7 +50,6 @@ struct GutterBlock{
   BlockType type;
 };
 
-typedef std::vector<GutterBlock> GutterBlockList;
 
 }}//ns
 
diff --git a/modules/gui/src/python_shell/python_shell_widget.cc b/modules/gui/src/python_shell/python_shell_widget.cc
index 9adafdd7c..9c816f5dc 100644
--- a/modules/gui/src/python_shell/python_shell_widget.cc
+++ b/modules/gui/src/python_shell/python_shell_widget.cc
@@ -20,21 +20,20 @@
   Authors: Marco Biasini, Andreas Schenk
  */
 
-#include <iostream>
 
 
 #include "python_shell_widget.hh"
-
+#include "state_machine.hh"
+#include "state.hh"
 #include "gutter.hh"
-
 #include "string_literal_positions.hh"
-
 #include "python_shell_text_document_layout.hh"
-
 #include "python_completer.hh"
 #include "path_completer.hh"
 #include "transition.hh"
 
+#include <iostream>
+
 #include <QApplication>
 #include <QFontMetrics>
 #include <QClipboard>
diff --git a/modules/gui/src/python_shell/python_shell_widget.hh b/modules/gui/src/python_shell/python_shell_widget.hh
index f2b2dbced..090272bbb 100644
--- a/modules/gui/src/python_shell/python_shell_widget.hh
+++ b/modules/gui/src/python_shell/python_shell_widget.hh
@@ -25,13 +25,11 @@
 #define OST_GUI_PYTHON_SHELL_WIDGET_HH
 
 
-#include <ost/gui/module_config.hh>
 #include "python_interpreter.hh"
 #include "shell_history.hh"
 #include  "python_shell_fw.hh"
 #include "python_syntax_highlighter.hh"
-#include "state_machine.hh"
-#include "state.hh"
+#include <ost/gui/module_config.hh>
 
 #include <QPlainTextEdit>
 #include <QHash>
@@ -41,7 +39,10 @@ namespace ost { namespace gui {
 class Gutter;
 class PythonCompleter;
 class PathCompleter;
+class State;
+class StateMachine;
 
+typedef std::vector<GutterBlock> GutterBlockList;
 
 class DLLEXPORT_OST_GUI PythonShellWidget : public QPlainTextEdit {
 
diff --git a/modules/gui/src/python_shell/python_syntax_highlighter.cc b/modules/gui/src/python_shell/python_syntax_highlighter.cc
index cca2c0b8b..72ab4be2a 100644
--- a/modules/gui/src/python_shell/python_syntax_highlighter.cc
+++ b/modules/gui/src/python_shell/python_syntax_highlighter.cc
@@ -20,14 +20,13 @@
   Authors: Marco Biasini, Andreas Schenk
  */
 
-#include <iostream>
 
 #include "python_shell.hh"
 #include "string_literal_positions.hh"
-
 #include "python_syntax_highlighter.hh"
 #include "python_context_parser.hh"
 
+#include <iostream>
 
 #include <QDebug>
 #include <QTextCursor>
diff --git a/modules/gui/src/python_shell/shell_history.hh b/modules/gui/src/python_shell/shell_history.hh
index 20e0405af..87e082af6 100644
--- a/modules/gui/src/python_shell/shell_history.hh
+++ b/modules/gui/src/python_shell/shell_history.hh
@@ -22,8 +22,8 @@
   Author: Andreas Schenk
  */
 
-#include <vector>
 #include "python_shell_fw.hh"
+#include <vector>
 #include <QString>
 
 namespace ost { namespace gui {
diff --git a/modules/gui/src/python_shell/state.cc b/modules/gui/src/python_shell/state.cc
index 381fffff4..f5b7c5223 100644
--- a/modules/gui/src/python_shell/state.cc
+++ b/modules/gui/src/python_shell/state.cc
@@ -1,7 +1,26 @@
-#include <cassert>
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #include "transition.hh"
 #include "state.hh"
 #include "state_machine.hh"
+#include <cassert>
 
 namespace ost { namespace gui {
 
diff --git a/modules/gui/src/python_shell/state.hh b/modules/gui/src/python_shell/state.hh
index a6c05c36b..679542078 100644
--- a/modules/gui/src/python_shell/state.hh
+++ b/modules/gui/src/python_shell/state.hh
@@ -1,3 +1,22 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #ifndef PYTHON_SHELL_STATE_HH
 #define PYTHON_SHELL_STATE_HH
 
diff --git a/modules/gui/src/python_shell/state_machine.cc b/modules/gui/src/python_shell/state_machine.cc
index 9ce3f37bc..048ed68eb 100644
--- a/modules/gui/src/python_shell/state_machine.cc
+++ b/modules/gui/src/python_shell/state_machine.cc
@@ -1,3 +1,22 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #include <QEvent>
 #include <QKeyEvent>
 #include <QMouseEvent>
diff --git a/modules/gui/src/python_shell/state_machine.hh b/modules/gui/src/python_shell/state_machine.hh
index ac265dfd9..8db26c10a 100644
--- a/modules/gui/src/python_shell/state_machine.hh
+++ b/modules/gui/src/python_shell/state_machine.hh
@@ -1,3 +1,22 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #ifndef PYTHON_SHELL_STATE_MACHINE_HH
 #define PYTHON_SHELL_STATE_MACHINE_HH
 
diff --git a/modules/gui/src/python_shell/transition.cc b/modules/gui/src/python_shell/transition.cc
index b2a07eb6b..991665771 100644
--- a/modules/gui/src/python_shell/transition.cc
+++ b/modules/gui/src/python_shell/transition.cc
@@ -1,7 +1,26 @@
-#include <cassert>
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #include "python_shell_widget.hh"
 #include "transition.hh"
 #include "state.hh"
+#include <cassert>
 #include <QKeyEvent>
 #include <QMouseEvent>
 
diff --git a/modules/gui/src/python_shell/transition.hh b/modules/gui/src/python_shell/transition.hh
index a17b38ee5..a3550f428 100644
--- a/modules/gui/src/python_shell/transition.hh
+++ b/modules/gui/src/python_shell/transition.hh
@@ -1,12 +1,31 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #ifndef PYTHON_SHELL_TRANSITION_HH
 #define PYTHON_SHELL_TRANSITION_HH
 
-#include <utility>
 #include <ost/gui/python_shell/python_interpreter.hh>
+#include "transition_guard.hh"
+#include <utility>
 
 #include <QObject>
 #include <QEvent>
-#include "transition_guard.hh"
 //fw decl
 class QKeyEvent;
 class QMouseEvent;
diff --git a/modules/gui/src/python_shell/transition_guard.cc b/modules/gui/src/python_shell/transition_guard.cc
index 940d5bba1..acf6ff2c9 100644
--- a/modules/gui/src/python_shell/transition_guard.cc
+++ b/modules/gui/src/python_shell/transition_guard.cc
@@ -1,7 +1,27 @@
-#include <iostream>
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
+
 #include "transition_guard.hh"
 #include "python_shell_widget.hh"
 #include "shell_history.hh"
+#include <iostream>
 
 namespace ost { namespace gui {
 
diff --git a/modules/gui/src/python_shell/transition_guard.hh b/modules/gui/src/python_shell/transition_guard.hh
index 5a2906481..c3b20201a 100644
--- a/modules/gui/src/python_shell/transition_guard.hh
+++ b/modules/gui/src/python_shell/transition_guard.hh
@@ -1,3 +1,22 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2014 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
 #ifndef TRANSITION_GUARD_HH
 #define TRANSITION_GUARD_HH
 
-- 
GitLab