+1.5
+ - share io manager between rxvt-unicode and vpe
+
1.4 Fri Jan 16 23:03:22 CET 2004
- fix stupid segfault on esc-c
- small font tunings
-# $Id: Makefile.in,v 1.7 2004-01-16 22:11:09 pcg Exp $
+# $Id: Makefile.in,v 1.8 2004-01-17 01:20:01 pcg Exp $
@MCOMMON@
LINT = lint -DNARROWPROTO=1 $(XINC) -chapbxz
LIBSRCS = command.C defaultfont.C graphics.C grkelot.C init.C logging.C \
main.C menubar.C misc.C netdisp.C ptytty.C screen.C scrollbar.C \
scrollbar-rxvt.C scrollbar-next.C scrollbar-xterm.C strings.C \
- xdefaults.C xpm.C encoding.C rxvtcolor.C rxvtvec.C iom.C
+ xdefaults.C xpm.C encoding.C rxvtcolor.C rxvtstl.C iom.C
SRCS = rxvt.C $(LIBSRCS)
HDRS = command.h defaultfont.h feature.h grkelot.h init.h logging.h \
menubar.h netdisp.h protos.h rxvt.h rxvtgrx.h version.h encoding.h \
- rxvtvec.h iom.h
+ rxvtstl.h iom.h iom_conf.h
EXTRAHDRS = rxvtlib.h rxvtdaemon.h
OBJS = command.o defaultfont.o init.o graphics.o grkelot.o logging.o \
main.o menubar.o misc.o netdisp.o ptytty.o screen.o \
scrollbar.o scrollbar-next.o scrollbar-rxvt.o scrollbar-xterm.o \
- strings.o xdefaults.o xpm.o rxvt.o encoding.o rxvtcolor.o rxvtvec.o iom.o
+ strings.o xdefaults.o xpm.o rxvt.o encoding.o rxvtcolor.o rxvtstl.o iom.o
LIBOBJS = command.lo defaultfont.lo init.lo graphics.lo grkelot.lo logging.lo \
main.lo menubar.lo misc.lo netdisp.lo ptytty.lo screen.lo \
scrollbar.lo scrollbar-next.lo scrollbar-rxvt.lo scrollbar-xterm.lo \
- strings.lo xdefaults.lo xpm.lo encoding.lo rxvt.lo rxvtcolor.lo rxvtvec.lo iom.lo
+ strings.lo xdefaults.lo xpm.lo encoding.lo rxvt.lo rxvtcolor.lo rxvtstl.lo iom.lo
LIBVERSION = @LIBVERSION@
INSTALL_LIBRXVT = @INSTALL_LIBRXVT@
# DO NOT DELETE: nice dependency list follows
#
-defaultfont.h: encoding.h rxvtvec.h
+defaultfont.h: encoding.h rxvtstl.h
rxvtlib.h: rxvtcolor.h defaultfont.h
rxvtdaemon.o: rxvtdaemon.C rxvtdaemon.h
-rxvtd.o: rxvtd.C $(DEPS) rxvtdaemon.h rxvtvec.h
-rxvtc.o: rxvtc.C $(DEPS) rxvtdaemon.h rxvtvec.h
+rxvtd.o: rxvtd.C $(DEPS) rxvtdaemon.h rxvtstl.h
+rxvtc.o: rxvtc.C $(DEPS) rxvtdaemon.h rxvtstl.h
command.o: command.C $(DEPS) command.intpro command.h version.h
defaultfont.o: defaultfont.C $(DEPS) defaultfont.intpro defaultfont.h
Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef VPE_CALLBACK_H__
-#define VPE_CALLBACK_H__
+#ifndef CALLBACK_H__
+#define CALLBACK_H__
template<class R>
class callback0 {
/*
- * $Id: command.h,v 1.4 2003-12-19 09:41:09 pcg Exp $
+ * $Id: command.h,v 1.5 2004-01-17 01:20:01 pcg Exp $
*/
-#ifndef _COMMAND_H_
-#define _COMMAND_H_
+#ifndef COMMAND_H_
+#define COMMAND_H_
#define STRING_MAX 512 /* max string size for process_rxvt_xterm_seq() */
#define ESC_ARGS 32 /* max # of args for esc sequences */
-/*
- * $Id: defaultfont.h,v 1.8 2003-12-24 09:07:01 pcg Exp $
- */
-
-#ifndef _DEFAULTFONT_H_
-#define _DEFAULTFONT_H_
+#ifndef DEFAULTFONT_H_
+#define DEFAULTFONT_H_
#ifdef HAVE_XSETLOCALE
# define X_LOCALE
#include "rxvtlib.h"
#include "feature.h"
#include "encoding.h"
-#include "rxvtvec.h"
+#include "rxvtstl.h"
struct rxvt_fontprop {
enum {
/*
* File: feature.h
- * $Id: feature.h,v 1.4 2003-12-18 13:33:02 pcg Exp $
*
* Compile-time configuration.
*-----------------------------------------------------------------------
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*----------------------------------------------------------------------*/
-#ifndef _FEATURE_H
-#define _FEATURE_H
+#ifndef FEATURE_H
+#define FEATURE_H
#ifndef X11USRLIBDIR
# define X11USRLIBDIR "/usr/X11R6/lib"
/*
* File: grkelot.h
- * $Id: grkelot.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
*
* Synopsis: string -> greek ELOT928 string; 4-state FSM.
*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef _GRKELOT_H
-#define _GRKELOT_H
+#ifndef GRKELOT_H
+#define GRKELOT_H
#define GREEK_ELOT928 0
#define GREEK_IBM437 1
-/*
- * $Id: init.h,v 1.3 2003-11-25 15:25:17 pcg Exp $
- */
-
-#ifndef _INIT_H_
-#define _INIT_H_
+#ifndef INIT_H_
+#define INIT_H_
#undef CERASE /* TODO */
#define CERASE '\010' /* ^H */
/*
iom.C -- generic I/O multiplexor
- Copyright (C) 2003 Marc Lehmann <pcg@goof.com>
+ Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
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
Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "../config.h"
-
#include <cstdio>
#include <cstdlib>
#include <cerrno>
io_manager iom;
template<class watcher>
-void io_manager::reg (watcher *w, simplevec<watcher *> &queue)
+void io_manager::reg (watcher *w, io_manager_vec<watcher> &queue)
{
if (!iom_valid)
abort ();
}
template<class watcher>
-void io_manager::unreg (watcher *w, simplevec<watcher *> &queue)
+void io_manager::unreg (watcher *w, io_manager_vec<watcher> &queue)
{
if (!iom_valid)
return;
}
break;
}
- else if (next->at >= 0)
+ else
{
unreg (next);
next->call (*next);
int fds = 0;
- for (io_watcher **i = iow.end (); i-- > iow.begin (); )
+ for (io_manager_vec<io_watcher>::iterator i = iow.end (); i-- > iow.begin (); )
if (*i)
{
if ((*i)->events & EVENT_READ ) FD_SET ((*i)->fd, &rfd);
/*
iom.h -- generic I/O multiplexor
- Copyright (C) 2003 Marc Lehmann <pcg@goof.com>
+ Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
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
Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef VPE_IOM_H__
-#define VPE_IOM_H__
+#ifndef IOM_H__
+#define IOM_H__
-#include <cassert>
+// required:
+// - a vector template like simplevec or stl's vector
+// - defines for all watcher types required in your app
+// edit iom_conf.h as appropriate.
+#include "iom_conf.h"
#include "callback.h"
-#include "rxvtvec.h"
#ifndef IOM_IO
-# define IOM_IO 1
+# define IOM_IO 0
#endif
#ifndef IOM_TIME
-# define IOM_TIME 1
+# define IOM_TIME 0
#endif
#ifndef IOM_CHECK
-# define IOM_CHECK 1
+# define IOM_CHECK 0
#endif
#ifndef IOM_IDLE
# define IOM_IDLE 0
typedef double tstamp;
extern tstamp NOW;
+struct watcher;
#if IOM_IO
- struct io_watcher;
+struct io_watcher;
#endif
#if IOM_TIME
- struct time_watcher;
+struct time_watcher;
#endif
#if IOM_CHECK
- struct check_watcher;
+struct check_watcher;
#endif
#if IOM_IDLE
- struct idle_watcher;
+struct idle_watcher;
#endif
template<class watcher>
-struct io_manager_vec : protected simplevec<watcher *> {
+struct io_manager_vec : protected vector<watcher *> {
friend class io_manager;
protected:
void erase_unordered (unsigned int pos)
#endif
template<class watcher>
- void reg (watcher *w, simplevec<watcher *> &queue);
+ void reg (watcher *w, io_manager_vec<watcher> &queue);
template<class watcher>
- void unreg (watcher *w, simplevec<watcher *> &queue);
+ void unreg (watcher *w, io_manager_vec<watcher> &queue);
public:
// register a watcher
--- /dev/null
+/*
+ iom_conf.h -- generic I/O multiplexor config
+ Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
+
+ 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, write to the Free Software
+ Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef RXVT_IOM_CONF_H__
+#define RXVT_IOM_CONF_H__
+
+#include <rxvtstl.h>
+
+#define IOM_IO 1
+#define IOM_TIME 1
+#define IOM_CHECK 1
+
+#endif
+
-/*
- * $Id: logging.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
- */
-
-#ifndef _LOGGING_H_
-#define _LOGGING_H_
+#ifndef LOGGING_H_
+#define LOGGING_H_
#ifdef UTMP_SUPPORT
# if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP)
-/*
- * $Id: menubar.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
- */
-
-#ifndef _MENUBAR_H_
-#define _MENUBAR_H_
+#ifndef MENUBAR_H_
+#define MENUBAR_H_
typedef struct {
short type; /* must not be changed; first element */
/* Include prototypes for all files */
-/*
- * $Id: protos.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
- */
#include "command.extpro"
#include "defaultfont.extpro"
-/*
- * $Id: rxvt.h,v 1.20 2003-12-24 09:22:29 pcg Exp $
- */
-
-#ifndef _RXVT_H_ /* include once only */
-#define _RXVT_H_
+#ifndef RXVT_H_ /* include once only */
+#define RXVT_H_
#include "rxvtlib.h"
#include <stdint.h>
#include <cstdlib>
#include <cstring>
+#include <cstdio>
#include <unistd.h>
#include <sys/utsname.h>
#ifndef RXVT_DAEMON_H
#define RXVT_DAEMON_H
-#include "rxvtvec.h"
+#include "rxvtstl.h"
struct rxvt_connection {
int fd;
/*--------------------------------*-C-*---------------------------------*
* File: rxvtgrx.h
- * $Id: rxvtgrx.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
*
* Stuff for text alignment for rxvt special graphics mode
*
* text is placed so that the specified point is equidistant from the
* bottom and tops of capital letters
*----------------------------------------------------------------------*/
-#ifndef _RXVTGRX_H_
-#define _RXVTGRX_H_
+#ifndef RXVTGRX_H_
+#define RXVTGRX_H_
#define GRX_SCALE 10000
#include <cstdlib>
#include <cstring>
-#include "rxvtvec.h"
+#include "rxvtstl.h"
-#ifndef RXVT_VEC_H
-#define RXVT_VEC_H
+#ifndef RXVT_STL_H
+#define RXVT_STL_H
template<typename T> static inline T min (T a, long b) { return a < b ? a : b; }
template<typename T> static inline T max (T a, long b) { return a > b ? a : b; }
-#include <cstring>
#include "simplevec.h"
-#include <cstdio>
+template<typename T>
+struct vector : simplevec<T>
+{
+};
#if 0
template<typename T>
-#define VERSION "1.4"
-#define VSTRING "10400"
+#define VERSION "1.5"
+#define VSTRING "10500"
#define DATE "2004-01-16"
#define LSMDATE "16JAN04"
-#define LIBVERSION "1:4:0"
+#define LIBVERSION "1:5:0"