CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/12/01 23:42:40
Modified files: . : ChangeLog libbase : Makefile.am utilities : parser.cpp Removed files: libbase : demo.cpp demo.h hash_wrapper.h Log message: * libbase/: drop demo.{cpp,h} and hash_wrapper.h * utilities/parser.cpp: use std::map instead of hash_wrapper. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5049&r2=1.5050 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Makefile.am?cvsroot=gnash&r1=1.90&r2=1.91 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/demo.cpp?cvsroot=gnash&r1=1.4&r2=0 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/demo.h?cvsroot=gnash&r1=1.3&r2=0 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/hash_wrapper.h?cvsroot=gnash&r1=1.7&r2=0 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/parser.cpp?cvsroot=gnash&r1=1.44&r2=1.45 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5049 retrieving revision 1.5050 diff -u -b -r1.5049 -r1.5050 --- ChangeLog 1 Dec 2007 23:21:46 -0000 1.5049 +++ ChangeLog 1 Dec 2007 23:42:38 -0000 1.5050 @@ -1,5 +1,10 @@ 2007-12-01 Sandro Santilli <[EMAIL PROTECTED]> + * libbase/: drop demo.{cpp,h} and hash_wrapper.h + * utilities/parser.cpp: use std::map instead of hash_wrapper. + +2007-12-01 Sandro Santilli <[EMAIL PROTECTED]> + * libgeometry: drop libgnashgeo. 2007-12-01 Bastiaan Jacques <[EMAIL PROTECTED]> Index: libbase/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/libbase/Makefile.am,v retrieving revision 1.90 retrieving revision 1.91 diff -u -b -r1.90 -r1.91 --- libbase/Makefile.am 1 Dec 2007 15:49:58 -0000 1.90 +++ libbase/Makefile.am 1 Dec 2007 23:42:39 -0000 1.91 @@ -111,7 +111,6 @@ noinst_HEADERS = \ $(LIBLTDLHEAD) \ container.h \ - demo.h \ dlmalloc.h \ extension.h \ GnashException.h \ @@ -121,7 +120,6 @@ jpeg.h \ membuf.h \ network.h \ - hash_wrapper.h \ lirc.h \ log.h \ ogl.h \ @@ -166,16 +164,6 @@ libltdl_la_LDFLAGS = -no-undefined -version-info 4:4:1 libltdl_la_LIBADD = $(LIBADD_DL) -# We use our own rule to build the demo so it isn't built by default. -# Since it doesn't contain a main() routine, we only try to compile, -# and not link it. -#noinst_PROGRAMS = demo -#demo_SOURCES = demo.cpp -#demo_LDADD = libgnashbase.la -demo$(EXEEXT): demo.o $(pkglib_LTLIBRARIES) -# @$(RM) demo$(EXEEXT) -# $(CXXLINK) $(AM_LDFLAGS) demo.o $(pkglib_LTLIBRARIES) $(LIBS) - # Rebuild with GCC 4.x Mudflap support mudflap: @echo "Rebuilding with GCC Mudflap support" Index: utilities/parser.cpp =================================================================== RCS file: /sources/gnash/gnash/utilities/parser.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -b -r1.44 -r1.45 --- utilities/parser.cpp 8 Nov 2007 15:55:08 -0000 1.44 +++ utilities/parser.cpp 1 Dec 2007 23:42:39 -0000 1.45 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: parser.cpp,v 1.44 2007/11/08 15:55:08 nihilus Exp $ */ +/* $Id: parser.cpp,v 1.45 2007/12/01 23:42:39 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -50,9 +50,10 @@ #include "log.h" #include "gnash.h" #include "rc.h" -#include "hash_wrapper.h" #include "debugger.h" +#include <map> + #define TWIPS_TO_PIXELS(x) ((x) / 20.f) #define PIXELS_TO_TWIPS(x) ((x) * 20.f) @@ -92,14 +93,14 @@ //std::auto_ptr<tu_file> out; typedef void (*loader_function)(stream* input, int tag_type); -static hash_wrapper<int, loader_function> tag_loaders; +static std::map<int, loader_function> tag_loaders; void register_tag_loader(int tag_type, loader_function lf) { - assert(tag_loaders.get(tag_type, NULL) == false); assert(lf != NULL); - tag_loaders.add(tag_type, lf); + bool inserted = tag_loaders.insert(std::make_pair(tag_type, lf)).second; + assert(inserted); } // parse a matrix @@ -496,7 +497,7 @@ ident--; ident--; log_msg("end of sprite definition\n"); - } else if (tag_loaders.get(tag_type, &lf)) { + } else if (lf = tag_loaders[tag_type]) { (*lf)(input, tag_type); } else { log_msg("warning: no tag loader for tag_type %d", tag_type); @@ -583,7 +584,7 @@ loader_function lf = NULL; - if (tag_loaders.get(tag_type, &lf)) { + if (lf = tag_loaders[tag_type]) { (*lf)(&str, tag_type); } else { log_msg("warning: no tag loader for tag_type %d", tag_type); Index: libbase/demo.cpp =================================================================== RCS file: libbase/demo.cpp diff -N libbase/demo.cpp --- libbase/demo.cpp 2 Apr 2006 21:45:55 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,123 +0,0 @@ -// demo.cpp -- Thatcher Ulrich <http://tulrich.com> 2005 - -// This source code has been donated to the Public Domain. Do -// whatever you want with it. - -// Some helper code for making graphical demos. Covers OpenGL/SDL -// initialization, and some basic viewport navigation. - - -#include <cstdio> -#include "tu_config.h" -#include "demo.h" -#include "ogl.h" -#include "SDL.h" - -using namespace demo; - -void init_video(int width, int height, int depth) -{ - // Display. - // Initialize the SDL subsystems we're using. - if (SDL_Init(SDL_INIT_VIDEO /* | SDL_INIT_JOYSTICK | SDL_INIT_CDROM | SDL_INIT_AUDIO*/)) - { - fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); - - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - // Set the video mode. - if (SDL_SetVideoMode(width, height, depth, SDL_OPENGL) == 0) - { - fprintf(stderr, "SDL_SetVideoMode() failed."); - exit(1); - } - - ogl::open(); -} - - -bool update_nav2d(nav2d_state* state) -{ - // Handle input. - SDL_Event event; - while (SDL_PollEvent(&event)) - { switch (event.type) - { - case SDL_KEYDOWN: - { - int key = event.key.keysym.sym; - - if (key == SDLK_q || key == SDLK_ESCAPE) - { - return true; - } else if (key == SDLK_EQUALS) { - state->m_scale *= 0.5f; - } else if (key == SDLK_MINUS) { - state->m_scale *= 2.0f; - } - break; - } - - case SDL_MOUSEMOTION: - { - int new_x = (int) (event.motion.x); - int new_y = (int) (event.motion.y); - state->m_mouse_dx = new_x - state->m_mouse_x; - state->m_mouse_dy = new_y - state->m_mouse_y; - if (state->m_mouse_buttons & 2) { - // Left drag: move. - state->m_center_x -= state->m_mouse_dx * state->m_scale; - state->m_center_y += state->m_mouse_dy * state->m_scale; - } - state->m_mouse_x = new_x; - state->m_mouse_y = new_y; - break; - } - - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - { - int mask = 1 << (event.button.button); - if (event.button.state == SDL_PRESSED) - { - state->m_mouse_buttons |= mask; - } - else - { - state->m_mouse_buttons &= ~mask; - } - break; - } - - case SDL_QUIT: - return true; - break; - - default: - break; - } - } - - return false; -} - - -void set_nav2d_viewport(const nav2d_state& state) -{ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(state.m_center_x - 500 * state.m_scale, state.m_center_x + 500 * state.m_scale, - state.m_center_y - 500 * state.m_scale, state.m_center_y + 500 * state.m_scale, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -// Local Variables: -// mode: C++ -// indent-tabs-mode: t -// End: - Index: libbase/demo.h =================================================================== RCS file: libbase/demo.h diff -N libbase/demo.h --- libbase/demo.h 26 Aug 2006 18:20:50 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,76 +0,0 @@ -// demo.h -- Thatcher Ulrich <http://tulrich.com> 2005 - -// This source code has been donated to the Public Domain. Do -// whatever you want with it. - -// Some helper code for making graphical demos. Covers OpenGL/SDL -// initialization, and some basic viewport navigation. - - -#ifndef DEMO_H -#define DEMO_H - - -#include "tu_config.h" - - -namespace demo -{ - // Open an OpenGL window with the given dimensions. - void init_video(int width, int height, int depth); - - // A state object you can use to manage 2D scrolling & zooming. - class nav2d_state - { - public: - // 2d viewport state. - float m_center_x; - float m_center_y; - float m_scale; - - // Current mouse state. - int m_mouse_x; - int m_mouse_y; - int m_mouse_buttons; - - // Change in mouse position in pixels, this frame. - int m_mouse_dx; - int m_mouse_dy; - - nav2d_state() - : - m_center_x(0), - m_center_y(0), - m_scale(1), - m_mouse_x(0), - m_mouse_y(0), - m_mouse_buttons(0), - m_mouse_dx(0), - m_mouse_dy(0) - { - } - }; - - // Checks and processes the SDL message queue. Returns true - // if the user wants to exit. - // - // TODO: do some kind of callback registry for handling misc - // app-specific inputs - bool update_nav2d(nav2d_state* state); - - // Sets the OpenGL projection & modelview according to the 2d - // view state. - void set_nav2d_viewport(const nav2d_state& state); -} - - -#endif // DEMO_H - - -// Local Variables: -// mode: C++ -// c-basic-offset: 8 -// tab-width: 8 -// indent-tabs-mode: t -// End: - Index: libbase/hash_wrapper.h =================================================================== RCS file: libbase/hash_wrapper.h diff -N libbase/hash_wrapper.h --- libbase/hash_wrapper.h 1 Jul 2007 10:54:09 -0000 1.7 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,54 +0,0 @@ -// -// Copyright (C) 2005, 2006, 2007 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 - -// -// - -/* $Id: hash_wrapper.h,v 1.7 2007/07/01 10:54:09 bjacques Exp $ */ - -#ifndef HASH_WRAPPER_H -#define HASH_WRAPPER_H - -#include <map> - -template<typename T, typename U> -class hash_wrapper : public std::map<T, U> -{ - -public: - - void add(const T& key, U& mov) - { - (*this)[key] = mov; - } - - bool get(const T& key, U* ret) - { - typename std::map<T, U>::iterator it = std::map<T, U>::find(key); - if ( it != this->end() ) - { - *ret = it->second; - return true; - } - else - { - return false; - } - } -}; - -#endif _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit