[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/cygnal Makefile.am ChangeLog testsuite/cy...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash/cygnal Makefile.am ChangeLog testsuite/cy... |
Date: |
Mon, 17 Mar 2008 00:09:18 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/03/17 00:09:18
Modified files:
cygnal : Makefile.am ChangeLog
cygnal/testsuite/cygnal.all: Makefile.am
Added files:
cygnal : cque.h cque.cpp
cygnal/testsuite/cygnal.all: test_cque.cpp
Log message:
* cque.{h,cpp}: New files for base queuing class, moved out of
Handler when I noticed there was code duplication for the
queues.
* testsuite/cygnal.all/test_cque.cpp: New test case for CQue
base
class.
* testsuite/cygnal.all/Makefile.am: Build the new CQue testcase.
* Makefile.am: Add cque.* to libcygnal.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/Makefile.am?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ChangeLog?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cque.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cque.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/Makefile.am?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_cque.cpp?cvsroot=gnash&rev=1.1
Patches:
Index: Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/cygnal/Makefile.am,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- Makefile.am 21 Jan 2008 20:56:06 -0000 1.12
+++ Makefile.am 17 Mar 2008 00:09:17 -0000 1.13
@@ -20,9 +20,13 @@
AUTOMAKE_OPTIONS = dejagnu
+if TESTSUITE
+TEST_DIR = testsuite
+endif
+
SUBDIRS = \
- . \
- testsuite
+ $(TEST_DIR) \
+ .
# we don't want these anymore
#DIST_SUBDIRS = ACT IO HTTP Net unit_tests
@@ -61,6 +65,9 @@
libcygnal_la_LIBADD = $(AM_LDFLAGS)
noinst_HEADERS = \
+ buffer.h \
+ cque.h \
+ handler.h \
http.h \
netstats.h \
stream.h \
@@ -71,6 +78,9 @@
libcygnal_la_SOURCES = \
+ buffer.cpp \
+ cque.cpp \
+ handler.cpp \
http.cpp \
alloc.cpp \
netstats.cpp \
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/cygnal/ChangeLog,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- ChangeLog 16 Mar 2008 01:26:17 -0000 1.4
+++ ChangeLog 17 Mar 2008 00:09:17 -0000 1.5
@@ -1,3 +1,12 @@
+2008-03-16 Rob Savoye <address@hidden>
+
+ * cque.{h,cpp}: New files for base queuing class, moved out of
+ Handler when I noticed there was code duplication for the queues.
+ * testsuite/cygnal.all/test_cque.cpp: New test case for CQue base
+ class.
+ * testsuite/cygnal.all/Makefile.am: Build the new CQue testcase.
+ * Makefile.am: Add cque.* to libcygnal.
+
2008-03-15 Rob Savoye <address@hidden>
* buffer.{h,cpp}: Low level class to hold blocks of memory for
@@ -17,50 +26,3 @@
2009-09-05 Markus Gothe
* cygnal.cpp: Added a #ifdef ENABLE_NLS.
-
-2007-08-24 Eric Hughes <address@hidden>
- * ACT/test_support/Supplied_Service.cpp, ACT/unit_tests/Test_ACT.cpp,
IO/Stream_Consumer.cpp,
- IO/test_support/String_Device.cpp, IO/unit_tests/Test_Buffer.cpp,
Net/Net.cpp, Net/Old_Device.hpp,
- Net/socket_device.cpp, Net/unit_tests/Test_socket_device.cpp,
HTTP/HTTP_Parse.cpp, HTTP/URI.cpp,
- unit_tests/Permutation.hpp:
- Eliminated std::exception constructors with string arguments,
- replacing with std::runtime_error or std::logic error as
appropriate.
-
-2007-07-14 Rob Savoye <address@hidden>
- * ACT/Makefile.am: New Makefile.
- * HTTP/Makefile.am: New Makefile.
- * IO/Makefile.am: New Makefile.
- * Net/Makefile.am: New Makefile.
- * unit_test/Makefile.am: New Makefile.
-
-2007-07-09 Eric Hughes <address@hidden>
- * ACT/ACT.hpp: Changed ACT_State::Waiting to Would_Block.
- Modified convenience methods accordingly.
- * ACT/Pause_Service.cpp, ACT/test_support/Listening_Actions.cpp,
- HTTP/HTTP_Behavior.cpp: followed ACT.hpp changes.
- * ACT/unit_tests/Test_ACT.cpp: Improved act_twice to ensure guard
- on run() is in effect.
- * IO/Stream_Consumer.cpp: Removed defect that was masking failures
- in scanning. Change causes an HTTP unit test to fail.
-
-2007-07-06 Eric Hughes <address@hidden>
- * ACT/ACT.hpp: Converted ACT_State from an enumeration to a class.
- Removed convenience typedef.
- * IO/Stream_Consumer.hpp: Added source_state() to assist in writing
parsing filters.
- * Lots and lots of files: Renamed act_state to ACT_State
- everywhere. Changed constant references to Working to either
- Waiting or Ready, as appropriate. Changed set_working() to
- set_ready(), set_waiting(), or source_state(), as appropriate.
-
-2007-07-06 Eric Hughes <address@hidden>
- * doc/Doxyfile: Converted all paths to relative form.
- * doc/mainpage.doxygen.txt: Wrote new main page.
- * ACT/ACT.doxygen.txt: Wrote new page with overview of ACT.
-
-2007-06-28 Eric Hughes <address@hidden>
- * doc/Doxyfile: New file.
-
-2007-06-17 Eric Hughes <address@hidden>
- * ACT/*: Got listener wakeup working correctly in scheduler.
-
-
Index: testsuite/cygnal.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/cygnal/testsuite/cygnal.all/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/cygnal.all/Makefile.am 21 Jan 2008 20:56:09 -0000 1.6
+++ testsuite/cygnal.all/Makefile.am 17 Mar 2008 00:09:17 -0000 1.7
@@ -41,7 +41,12 @@
$(BOOST_CFLAGS) \
$(PTHREAD_CFLAGS)
-check_PROGRAMS = test_http test_crc
+check_PROGRAMS = \
+ test_buffer \
+ test_cque \
+ test_handler \
+ test_http \
+ test_crc
test_http_SOURCES = test_http.cpp
test_http_LDADD = $(AM_LDFLAGS)
@@ -51,6 +56,17 @@
test_crc_LDADD = $(AM_LDFLAGS)
test_crc_DEPENDENCIES = site-update
+test_cque_SOURCES = test_cque.cpp
+test_cque_LDADD = $(AM_LDFLAGS)
+test_cque_DEPENDENCIES = site-update
+
+test_handler_SOURCES = test_handler.cpp
+test_handler_LDADD = $(AM_LDFLAGS)
+test_handler_DEPENDENCIES = site-update
+
+test_buffer_SOURCES = test_buffer.cpp
+test_buffer_LDADD = $(AM_LDFLAGS)
+test_buffer_DEPENDENCIES = site-update
# Rebuild with GCC 4.x Mudflap support
mudflap:
Index: cque.h
===================================================================
RCS file: cque.h
diff -N cque.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ cque.h 17 Mar 2008 00:09:17 -0000 1.1
@@ -0,0 +1,73 @@
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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 3 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, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef __CQUE_H__
+#define __CQUE_H__ 1
+
+#include <boost/cstdint.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <deque>
+
+#include "buffer.h"
+
+// _definst_ is the default instance name
+namespace cygnal
+{
+
+class CQue {
+public:
+ CQue();
+ ~CQue();
+ // Push data onto the que
+ bool push(boost::uint8_t *data, int nbytes);
+ bool push(Buffer *data);
+ // Pop the first date element off the que
+ Buffer *pop();
+ // Peek at the first date element witjhout removing it from the que
+ Buffer *peek();
+ // Get the number of elements in the que
+ size_t size();
+ // Wait for a condition variable to trigger
+ void wait();
+ // Notify a condition variable to trigger
+ void notify();
+ // Empty the que of all data.
+ void clear();
+ // Dump the data to the terminal
+ void dump();
+private:
+ // The queue itself
+ std::deque<Buffer *> _que;
+ // A condition variable used to signal the other thread when the que has
data
+ boost::condition _cond;
+ // This is the mutex used by the condition variable. It needs to be
separate from the
+ // one used to lock access to the que.
+ boost::mutex _cond_mutex;
+ // This is the mutex that control access to the que.
+ boost::mutex _mutex;
+};
+
+} // end of cygnal namespace
+
+#endif // end of __CQUE_H__
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: cque.cpp
===================================================================
RCS file: cque.cpp
diff -N cque.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ cque.cpp 17 Mar 2008 00:09:17 -0000 1.1
@@ -0,0 +1,139 @@
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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 3 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, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <string>
+#include <deque>
+
+#include "log.h"
+#include "buffer.h"
+#include "cque.h"
+
+using namespace gnash;
+using namespace std;
+using namespace boost;
+
+namespace cygnal
+{
+
+CQue::CQue()
+{
+// GNASH_REPORT_FUNCTION;
+}
+
+CQue::~CQue()
+{
+// GNASH_REPORT_FUNCTION;
+// clear();
+#if 0
+ deque<Buffer *>::iterator it;
+ boost::mutex::scoped_lock lock(_mutex);
+ for (it = _que.begin(); it != _que.end(); it++) {
+ Buffer *ptr = *(it);
+ delete ptr;
+ }
+#endif
+}
+
+size_t
+CQue::size()
+{
+// GNASH_REPORT_FUNCTION;
+ boost::mutex::scoped_lock lock(_mutex);
+ return _que.size();
+}
+
+bool
+CQue::push(Buffer *data)
+{
+// GNASH_REPORT_FUNCTION;
+ boost::mutex::scoped_lock lock(_mutex);
+ _que.push_back(data);
+ return true;
+}
+
+// Push bytes on the outgoing FIFO
+bool
+CQue::push(uint8_t *data, int nbytes)
+{
+// GNASH_REPORT_FUNCTION;
+ Buffer *buf = new Buffer;
+ std::copy(data, data + nbytes, buf->reference());
+}
+
+
+// Pop the first date element off the FIFO
+Buffer *
+CQue::pop()
+{
+// GNASH_REPORT_FUNCTION;
+ Buffer *buf;
+ boost::mutex::scoped_lock lock(_mutex);
+ if (_que.size()) {
+ buf = _que.front();
+ _que.pop_front();
+ }
+ return buf;
+}
+
+// Peek at the first data element without removing it
+Buffer *
+CQue::peek()
+{
+// GNASH_REPORT_FUNCTION;
+ boost::mutex::scoped_lock lock(_mutex);
+ if (_que.size()) {
+ return _que.front();
+ }
+ return 0;
+}
+
+// Return the size of the queues
+void
+CQue::clear()
+{
+// GNASH_REPORT_FUNCTION;
+ boost::mutex::scoped_lock lock(_mutex);
+ _que.clear();
+}
+
+// Dump internal data.
+void
+CQue::dump()
+{
+// GNASH_REPORT_FUNCTION;
+ deque<Buffer *>::iterator it;
+ boost::mutex::scoped_lock lock(_mutex);
+ cerr << endl << "Outgoing queue has "<< _que.size() << " buffers." << endl;
+ for (it = _que.begin(); it != _que.end(); it++) {
+ Buffer *ptr = *(it);
+ ptr->dump();
+ }
+}
+
+} // end of cygnal namespace
+
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
+
Index: testsuite/cygnal.all/test_cque.cpp
===================================================================
RCS file: testsuite/cygnal.all/test_cque.cpp
diff -N testsuite/cygnal.all/test_cque.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/cygnal.all/test_cque.cpp 17 Mar 2008 00:09:17 -0000 1.1
@@ -0,0 +1,120 @@
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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 3 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, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#ifdef HAVE_STDARG_H
+#include <cstdarg>
+#endif
+
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <regex.h>
+#include <cstdio>
+#include <cerrno>
+#include <iostream>
+#include <fstream>
+#include <cstring>
+#include <vector>
+#include <boost/cstdint.hpp>
+
+#ifdef HAVE_DEJAGNU_H
+#include "dejagnu.h"
+#else
+#include "check.h"
+#endif
+
+#include "log.h"
+#include "cque.h"
+
+using namespace std;
+using namespace gnash;
+using namespace cygnal;
+using namespace boost;
+
+TestState runtest;
+//LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+int
+main (int /*argc*/, char** /*argv*/) {
+ gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+ dbglogfile.setVerbosity();
+
+ CQue que;
+
+ Buffer buf;
+ boost::uint8_t *test = new uint8_t[6];
+ memcpy(test, "hell", 4);
+
+ // Push one buffer on the fifo. The default is the incoming fifo,
+ // which is the one where data flows from the network to the queue.
+ que.push(&buf);
+ if (que.size() == 1) {
+ runtest.pass ("CQue::push(Buffer *)");
+ } else {
+ runtest.fail ("CQue::push(Buffer *)");
+ }
+
+ // Test push. When dumpimg, the second address should be different than
the first,
+ // as well as the size. The outgoing queue should be uneffected.
+ Buffer buf1;
+ buf1.resize(112);
+ que.push(&buf1);
+ if (que.size() == 2) {
+ runtest.pass ("CQue::pushin(Buffer *)");
+ } else {
+ runtest.fail ("CQue::pushin(Buffer *)");
+ }
+
+ // Nuke the array
+ que.clear();
+ if (que.size() == 0) {
+ runtest.pass ("CQue::clearall()");
+ } else {
+ runtest.fail ("CQue::clearall()");
+ }
+
+ // populate the buffer
+ boost::uint8_t *ptr = buf.reference();
+ for (size_t i=1; i< buf.size(); i++) {
+ ptr[i] = i;
+ }
+
+ que.push(&buf);
+ Buffer *buf2 = que.peek();
+ if ((buf2 == &buf) && (que.size() == 1)) {
+ runtest.pass ("CQue::peek()");
+ } else {
+ runtest.fail ("CQue::peek()");
+ }
+
+ Buffer *buf3 = que.peek();
+ if ((buf3 == &buf) && (que.size() == 1)) {
+ runtest.pass ("CQue::pop()");
+ } else {
+ runtest.fail ("CQue::pop()");
+ }
+
+// que.dump();
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/cygnal Makefile.am ChangeLog testsuite/cy...,
Rob Savoye <=