[Libreoffice-commits] .: 2 commits - TEMPLATE.SOURCECODE.HEADER vcl/headless vcl/inc vcl/Library_vclplug_svp.mk vcl/unx

Michael Meeks michael at kemper.freedesktop.org
Wed Oct 26 11:45:52 PDT 2011


 TEMPLATE.SOURCECODE.HEADER   |    3 +
 vcl/Library_vclplug_svp.mk   |    1 
 vcl/headless/svpdata.cxx     |   50 +++++++++++++++++
 vcl/headless/svpinst.cxx     |   52 ------------------
 vcl/inc/headless/svpinst.hxx |    2 
 vcl/inc/unx/salunx.h         |   85 ------------------------------
 vcl/inc/unx/salunxtime.h     |  120 +++++++++++++++++++++++++++++++++++++++++++
 vcl/unx/gtk/app/gtkinst.cxx  |    1 
 8 files changed, 178 insertions(+), 136 deletions(-)

New commits:
commit 90067e8007227b7f1e555a878088d81c117fee56
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Wed Oct 26 19:45:35 2011 +0100

    gtk3: cleanup some code inclusion, and share timeval operators

diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk
index 7b93c1c..cfc5ead 100644
--- a/vcl/Library_vclplug_svp.mk
+++ b/vcl/Library_vclplug_svp.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_svp,\
     vcl/headless/svpframe \
     vcl/headless/svpgdi \
     vcl/headless/svpinst \
+    vcl/headless/svpdata \
     vcl/headless/svpprn \
     vcl/headless/svppspgraphics \
     vcl/headless/svptext \
diff --git a/vcl/headless/svpdata.cxx b/vcl/headless/svpdata.cxx
new file mode 100644
index 0000000..32afd02
--- /dev/null
+++ b/vcl/headless/svpdata.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *  Copyright (C) 2011 Novell, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <generic/gendata.hxx>
+#include <headless/svpinst.hxx>
+
+class SvpSalData : public SalGenericData
+{
+public:
+    SvpSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_SVP, pInstance ) {}
+    virtual void ErrorTrapPush() {}
+    virtual bool ErrorTrapPop( bool ) { return false; }
+};
+
+// plugin factory function
+extern "C"
+{
+    SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance()
+    {
+        SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() );
+        new SvpSalData( pInstance );
+        return pInstance;
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index ad58bc5..9de3f82 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -45,28 +45,8 @@
 #include <svdata.hxx>
 #include <generic/gendata.hxx>
 #include <vcl/solarmutex.hxx>
-
-// FIXME: split off into a separate, standalone module to aid linking
-#ifndef GTK3_INCLUDED
-class SvpSalData : public SalGenericData
-{
-public:
-    SvpSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_SVP, pInstance ) { }
-    virtual void ErrorTrapPush() {}
-    virtual bool ErrorTrapPop( bool ) { return false; }
-};
-
-// plugin factory function
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance()
-    {
-        SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() );
-        new SvpSalData( pInstance );
-        return pInstance;
-    }
-}
-#endif
+// FIXME: remove when we re-work the svp mainloop
+#include <unx/salunxtime.h>
 
 bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const
 {
@@ -198,34 +178,6 @@ void SvpSalInstance::Wakeup()
     OSL_VERIFY(write (m_pTimeoutFDS[1], "", 1) == 1);
 }
 
-// FIXME: share this with unx/generic [!] ....
-#ifndef GTK3_INCLUDED
-// -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-inline int operator >= ( const timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_sec == t2.tv_sec )
-        return t1.tv_usec >= t2.tv_usec;
-    return t1.tv_sec > t2.tv_sec;
-}
-inline timeval &operator += ( timeval &t1, sal_uLong t2 )
-{
-    t1.tv_sec  += t2 / 1000;
-    t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500;
-    if( t1.tv_usec > 1000000 )
-    {
-        t1.tv_sec++;
-        t1.tv_usec -= 1000000;
-    }
-    return t1;
-}
-inline int operator > ( const timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_sec == t2.tv_sec )
-        return t1.tv_usec > t2.tv_usec;
-    return t1.tv_sec > t2.tv_sec;
-}
-#endif
-
 bool SvpSalInstance::CheckTimeout( bool bExecuteTimers )
 {
     bool bRet = false;
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 4fcdc2e..4977fa4 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -71,7 +71,7 @@ class GenPspGraphics;
 class SvpSalInstance : public SalGenericInstance
 {
     timeval             m_aTimeout;
-    sal_uLong               m_nTimeoutMS;
+    sal_uLong           m_nTimeoutMS;
     int                 m_pTimeoutFDS[2];
 
     // internal event queue
diff --git a/vcl/inc/unx/salunx.h b/vcl/inc/unx/salunx.h
index f022f43..e4150f0 100644
--- a/vcl/inc/unx/salunx.h
+++ b/vcl/inc/unx/salunx.h
@@ -29,15 +29,7 @@
 #ifndef _SALUNX_H
 #define _SALUNX_H
 
-// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#if defined LINUX || defined FREEBSD || \
-    defined NETBSD || defined OPENBSD || defined DRAGONFLY
-#include <sys/time.h>
-#elif defined AIX
-#include <time.h>
-#include <sys/time.h>
-#include <strings.h>
-#endif
+#include "unx/salunxtime.h"
 #include <unx/svunx.h>
 #include <unx/salstd.hxx>
 
@@ -51,81 +43,6 @@ inline long Divide( long nDividend, long nDivisor )
 inline long DPI( long pixel, long mm )
 { return Divide( pixel*254, mm*10 ); }
 
-// -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-inline int operator >= ( const timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_sec == t2.tv_sec )
-        return t1.tv_usec >= t2.tv_usec;
-    return t1.tv_sec > t2.tv_sec;
-}
-
-inline int operator > ( const timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_sec == t2.tv_sec )
-        return t1.tv_usec > t2.tv_usec;
-    return t1.tv_sec > t2.tv_sec;
-}
-
-inline int operator == ( const timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_sec == t2.tv_sec )
-        return t1.tv_usec == t2.tv_usec;
-    return sal_False;
-}
-
-inline timeval &operator -= ( timeval &t1, const timeval &t2 )
-{
-    if( t1.tv_usec < t2.tv_usec )
-    {
-        t1.tv_sec--;
-        t1.tv_usec += 1000000;
-    }
-    t1.tv_sec  -= t2.tv_sec;
-    t1.tv_usec -= t2.tv_usec;
-    return t1;
-}
-
-inline timeval &operator += ( timeval &t1, const timeval &t2 )
-{
-    t1.tv_sec  += t2.tv_sec;
-    t1.tv_usec += t2.tv_usec;
-    if( t1.tv_usec > 1000000 )
-    {
-        t1.tv_sec++;
-        t1.tv_usec -= 1000000;
-    }
-    return t1;
-}
-
-inline timeval &operator += ( timeval &t1, sal_uIntPtr t2 )
-{
-    t1.tv_sec  += t2 / 1000;
-    t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500;
-    if( t1.tv_usec > 1000000 )
-    {
-        t1.tv_sec++;
-        t1.tv_usec -= 1000000;
-    }
-    return t1;
-}
-
-inline timeval operator + ( const timeval &t1, const timeval &t2 )
-{
-    timeval t0 = t1;
-    return t0 += t2;
-}
-
-inline timeval operator + ( const timeval &t1, sal_uIntPtr t2 )
-{
-    timeval t0 = t1;
-    return t0 += t2;
-}
-
-inline timeval operator - ( const timeval &t1, const timeval &t2 )
-{
-    timeval t0 = t1;
-    return t0 -= t2;
-}
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/salunxtime.h b/vcl/inc/unx/salunxtime.h
new file mode 100644
index 0000000..6825581
--- /dev/null
+++ b/vcl/inc/unx/salunxtime.h
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SALUNX_TIME_H
+#define _SALUNX_TIME_H
+
+#if defined LINUX || defined FREEBSD || \
+    defined NETBSD || defined OPENBSD || defined DRAGONFLY
+#include <sys/time.h>
+#elif defined AIX
+#include <time.h>
+#include <sys/time.h>
+#include <strings.h>
+#endif
+#include <sal/types.h>
+
+// -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline int operator >= ( const timeval &t1, const timeval &t2 )
+{
+    if( t1.tv_sec == t2.tv_sec )
+        return t1.tv_usec >= t2.tv_usec;
+    return t1.tv_sec > t2.tv_sec;
+}
+
+inline int operator > ( const timeval &t1, const timeval &t2 )
+{
+    if( t1.tv_sec == t2.tv_sec )
+        return t1.tv_usec > t2.tv_usec;
+    return t1.tv_sec > t2.tv_sec;
+}
+
+inline int operator == ( const timeval &t1, const timeval &t2 )
+{
+    if( t1.tv_sec == t2.tv_sec )
+        return t1.tv_usec == t2.tv_usec;
+    return sal_False;
+}
+
+inline timeval &operator -= ( timeval &t1, const timeval &t2 )
+{
+    if( t1.tv_usec < t2.tv_usec )
+    {
+        t1.tv_sec--;
+        t1.tv_usec += 1000000;
+    }
+    t1.tv_sec  -= t2.tv_sec;
+    t1.tv_usec -= t2.tv_usec;
+    return t1;
+}
+
+inline timeval &operator += ( timeval &t1, const timeval &t2 )
+{
+    t1.tv_sec  += t2.tv_sec;
+    t1.tv_usec += t2.tv_usec;
+    if( t1.tv_usec > 1000000 )
+    {
+        t1.tv_sec++;
+        t1.tv_usec -= 1000000;
+    }
+    return t1;
+}
+
+inline timeval &operator += ( timeval &t1, sal_uIntPtr t2 )
+{
+    t1.tv_sec  += t2 / 1000;
+    t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500;
+    if( t1.tv_usec > 1000000 )
+    {
+        t1.tv_sec++;
+        t1.tv_usec -= 1000000;
+    }
+    return t1;
+}
+
+inline timeval operator + ( const timeval &t1, const timeval &t2 )
+{
+    timeval t0 = t1;
+    return t0 += t2;
+}
+
+inline timeval operator + ( const timeval &t1, sal_uIntPtr t2 )
+{
+    timeval t0 = t1;
+    return t0 += t2;
+}
+
+inline timeval operator - ( const timeval &t1, const timeval &t2 )
+{
+    timeval t0 = t1;
+    return t0 -= t2;
+}
+
+#endif // _SALUNX_TIME_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 1f9f1b1..2323103 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -620,7 +620,6 @@ GenPspGraphics *GtkInstance::CreatePrintGraphics()
 }
 
 #if GTK_CHECK_VERSION(3,0,0)
-#define GTK3_INCLUDED
 #include "../../headless/svpinst.cxx"
 #endif
 
commit 306c79e24f29bfb01b64aad1b6054a454e2927e4
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Wed Oct 26 19:40:15 2011 +0100

    add emacs + vim modelines to the MPL license template

diff --git a/TEMPLATE.SOURCECODE.HEADER b/TEMPLATE.SOURCECODE.HEADER
index 07fe450..48a85b8 100644
--- a/TEMPLATE.SOURCECODE.HEADER
+++ b/TEMPLATE.SOURCECODE.HEADER
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
  *
@@ -27,3 +28,5 @@
  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
  * instead of those above.
  */
+...
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list