diff options
author | Peter Wemm <peter@FreeBSD.org> | 2000-01-26 16:43:25 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2000-01-26 16:43:25 +0000 |
commit | 1759abf3ae1a38b7578df7996346544b66e508ad (patch) | |
tree | 506da7a5cf693bf8780ad013837cbd67913bedbb /contrib/ncurses/c++ | |
parent | 0e3d540892016a47f6a68ec9ba2879d35ce5f7c2 (diff) | |
download | src-1759abf3ae1a38b7578df7996346544b66e508ad.tar.gz src-1759abf3ae1a38b7578df7996346544b66e508ad.zip |
Notes
Diffstat (limited to 'contrib/ncurses/c++')
-rw-r--r-- | contrib/ncurses/c++/Makefile.in | 20 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursespad.cc | 6 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesw.cc | 33 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesw.h | 44 | ||||
-rw-r--r-- | contrib/ncurses/c++/demo.cc | 4 | ||||
-rwxr-xr-x | contrib/ncurses/c++/edit_cfg.sh | 7 | ||||
-rw-r--r-- | contrib/ncurses/c++/etip.h.in | 33 |
7 files changed, 91 insertions, 56 deletions
diff --git a/contrib/ncurses/c++/Makefile.in b/contrib/ncurses/c++/Makefile.in index 38c5bd864323..886678df2fce 100644 --- a/contrib/ncurses/c++/Makefile.in +++ b/contrib/ncurses/c++/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.48 1999/07/31 09:47:11 juergen Exp $ +# $Id: Makefile.in,v 1.51 1999/10/23 20:13:02 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -36,6 +36,10 @@ SHELL = /bin/sh +CF_MFLAGS = @cf_cv_makeflags@ +@SET_MAKE@ +x = @PROG_EXT@ + MODEL = ../@DFT_OBJ_SUBDIR@ INSTALL_PREFIX = @INSTALL_PREFIX@ srcdir = @srcdir@ @@ -63,17 +67,17 @@ CCFLAGS = $(CPPFLAGS) $(CXXFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg -CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ +CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) REL_VERSION = @cf_cv_rel_version@ ABI_VERSION = @cf_cv_abi_version@ -LINK = @LINK_PROGS@ $(CXX) +LINK = @LINK_PROGS@ $(CXX) @CXXLDFLAGS@ LIBROOT = ncurses++ -LIBNAME = lib$(LIBROOT).a +LIBNAME = @LIB_PREFIX@$(LIBROOT).a LDFLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) \ -l$(LIBROOT) \ @@ -90,7 +94,7 @@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) AUTO_SRC = \ etip.h -all: $(AUTO_SRC) ../lib/$(LIBNAME) demo +all: $(AUTO_SRC) ../lib/$(LIBNAME) demo$x sources : $(AUTO_SRC) @@ -116,7 +120,7 @@ OBJS_DEMO = $(MODEL)/demo.o $(MODEL)/demo.o : $(srcdir)/demo.cc \ $(cursesf_h) $(cursesm_h) $(cursesapp_h) -demo: $(OBJS_DEMO) \ +demo$x: $(OBJS_DEMO) \ ../lib/$(LIBNAME) \ @TEST_DEPS@ @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) @@ -140,7 +144,7 @@ mostlyclean :: -rm -f core tags TAGS *~ *.ln *.atac trace clean :: mostlyclean - -rm -f demo $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) + -rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) distclean :: clean -rm -f Makefile diff --git a/contrib/ncurses/c++/cursespad.cc b/contrib/ncurses/c++/cursespad.cc index 78af365e1451..b82d39399b45 100644 --- a/contrib/ncurses/c++/cursespad.cc +++ b/contrib/ncurses/c++/cursespad.cc @@ -35,7 +35,7 @@ #include "cursesw.h" #include "internal.h" -MODULE_ID("$Id: cursespad.cc,v 1.1 1999/07/31 09:47:21 juergen Exp $") +MODULE_ID("$Id: cursespad.cc,v 1.2 1999/09/11 23:25:54 tom Exp $") NCursesPad::NCursesPad(int lines, int cols) : NCursesWindow(), @@ -188,8 +188,8 @@ int NCursesPad::noutrefresh() { } void NCursesPad::setWindow(NCursesWindow& view, - int v_grid = 1, - int h_grid = 1) + int v_grid NCURSES_PARAM_INIT(1), + int h_grid NCURSES_PARAM_INIT(1)) { viewWin = &view; min_row = min_col = 0; diff --git a/contrib/ncurses/c++/cursesw.cc b/contrib/ncurses/c++/cursesw.cc index 4973e3a715a5..4072c3c3f693 100644 --- a/contrib/ncurses/c++/cursesw.cc +++ b/contrib/ncurses/c++/cursesw.cc @@ -19,13 +19,13 @@ modified by Ulrich Drepper (drepper@karlsruhe.gmd.de) and Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) - modified by Juergen Pfeifer (juergen.pfeifer@gmx.net) + modified by Juergen Pfeifer (juergen.pfeifer@gmx.net) */ #include "cursesw.h" #include "internal.h" -MODULE_ID("$Id: cursesw.cc,v 1.13 1999/07/31 09:46:30 juergen Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.15 1999/09/11 23:26:29 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -51,7 +51,7 @@ NCursesWindow::scanw(const char* fmt, ...) char buf[BUFSIZ]; int result = wgetstr(w, buf); if (result == OK) { - strstreambuf ss(buf, BUFSIZ); + strstreambuf ss(buf, sizeof(buf)); result = ss.vscan(fmt, (_IO_va_list)args); } va_end(args); @@ -73,7 +73,7 @@ NCursesWindow::scanw(int y, int x, const char* fmt, ...) if (result == OK) { result = wgetstr(w, buf); if (result == OK) { - strstreambuf ss(buf, BUFSIZ); + strstreambuf ss(buf, sizeof(buf)); result = ss.vscan(fmt, (_IO_va_list)args); } } @@ -144,7 +144,7 @@ NCursesWindow::initialize() { NCursesWindow::NCursesWindow() { if (!b_initialized) initialize(); - + w = (WINDOW *)0; init(); alloced = FALSE; @@ -172,7 +172,7 @@ NCursesWindow::NCursesWindow(WINDOW* &window) { if (!b_initialized) initialize(); - + w = window; init(); alloced = FALSE; @@ -183,7 +183,7 @@ NCursesWindow::NCursesWindow(WINDOW* &window) NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, int begin_y, int begin_x, char absrel) { - if (absrel == 'a') { // absolute origin + if (absrel == 'a') { // absolute origin begin_y -= win.begy(); begin_x -= win.begx(); } @@ -205,7 +205,8 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, count++; } -NCursesWindow::NCursesWindow(NCursesWindow& win, bool do_box = TRUE) +NCursesWindow::NCursesWindow(NCursesWindow& win, + bool do_box NCURSES_PARAM_INIT(TRUE)) { w = :: derwin(win.w,win.height()-2,win.width()-2,1,1); if (w == 0) { @@ -224,7 +225,7 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, bool do_box = TRUE) win.touchwin(); } } - + NCursesWindow NCursesWindow::Clone() { WINDOW *d = ::dupwin(w); NCursesWindow W(d); @@ -343,7 +344,7 @@ int NCursesWindow::colorInitialized = COLORS_NOT_INITIALIZED; void NCursesWindow::useColors(void) { - if (colorInitialized == COLORS_NOT_INITIALIZED) { + if (colorInitialized == COLORS_NOT_INITIALIZED) { if (b_initialized) { if (::has_colors()) { ::start_color(); @@ -358,12 +359,12 @@ NCursesWindow::useColors(void) } short -NCursesWindow::getcolor(int getback) const +NCursesWindow::getcolor(int getback) const { short fore, back; if (colorInitialized==COLORS_ARE_REALLY_THERE) { - if (pair_content(PAIR_NUMBER(w->_attrs), &fore, &back)) + if (pair_content((short)PAIR_NUMBER(w->_attrs), &fore, &back)) err_handler("Can't get color pair"); } else { @@ -383,7 +384,7 @@ int NCursesWindow::NumberOfColors() } short -NCursesWindow::getcolor() const +NCursesWindow::getcolor() const { if (colorInitialized==COLORS_ARE_REALLY_THERE) return PAIR_NUMBER(w->_attrs); @@ -404,7 +405,7 @@ int NCursesWindow::setpalette(short fore, short back) { if (colorInitialized==COLORS_ARE_REALLY_THERE) - return setpalette(fore, back, PAIR_NUMBER(w->_attrs)); + return setpalette(fore, back, (short)PAIR_NUMBER(w->_attrs)); else return OK; } @@ -416,7 +417,7 @@ NCursesWindow::setcolor(short pair) if (colorInitialized==COLORS_ARE_REALLY_THERE) { if ((pair < 1) || (pair > COLOR_PAIRS)) err_handler("Can't set color pair"); - + attroff(A_COLOR); attrset(COLOR_PAIR(pair)); } @@ -426,6 +427,6 @@ NCursesWindow::setcolor(short pair) extern "C" int _nc_has_mouse(void); bool NCursesWindow::has_mouse() const { - return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) + return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) ? TRUE : FALSE); } diff --git a/contrib/ncurses/c++/cursesw.h b/contrib/ncurses/c++/cursesw.h index 0d2665e30f5e..8091194cbc5e 100644 --- a/contrib/ncurses/c++/cursesw.h +++ b/contrib/ncurses/c++/cursesw.h @@ -2,7 +2,7 @@ #ifndef _CURSESW_H #define _CURSESW_H -// $Id: cursesw.h,v 1.16 1999/07/31 09:46:43 juergen Exp $ +// $Id: cursesw.h,v 1.18 1999/10/23 15:16:53 tom Exp $ #include <etip.h> #include <stdio.h> @@ -933,7 +933,7 @@ public: // position. int insch(int y, int x, chtype ch) { - return ::mvwinsch(w,y,x,ch); } + return ::mvwinsch(w,y,x,(char)ch); } // Move cursor to requested position and then insert the attributed // character before that position. @@ -958,10 +958,10 @@ public: int attron (chtype at) { return ::wattron (w, at); } // Switch on the window attributes; - int attroff(chtype at) { return ::wattroff(w, at); } + int attroff(chtype at) { return ::wattroff(w, (int) at); } // Switch off the window attributes; - int attrset(chtype at) { return ::wattrset(w, at); } + int attrset(chtype at) { return ::wattrset(w, (int) at); } // Set the window attributes; int color_set(short color_pair_number, void* opts=NULL) { @@ -1232,6 +1232,21 @@ public: useColors(); } }; +// These enum definitions really belong inside the NCursesPad class, but only +// recent compilers support that feature. + + typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT + } Pad_Request; + + const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code + const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + // ------------------------------------------------------------------------- // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. @@ -1248,21 +1263,9 @@ protected: NCursesWindow* Win(void) const { // Get the window into which the pad should be copied (if any) - return (viewSub?viewSub:(viewWin?viewWin:NULL)); + return (viewSub?viewSub:(viewWin?viewWin:0)); } - typedef enum { - REQ_PAD_REFRESH = KEY_MAX + 1, - REQ_PAD_UP, - REQ_PAD_DOWN, - REQ_PAD_LEFT, - REQ_PAD_RIGHT, - REQ_PAD_EXIT - } Pad_Request; - - static const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code - static const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code - NCursesWindow* getWindow(void) const { return viewWin; } @@ -1341,9 +1344,6 @@ public: // will be framed (by a box() command) and the interior of the box is the // viewport subwindow. On the frame we display scrollbar sliders. class NCursesFramedPad : public NCursesPad { -private: - static const char* const msg = "Operation not allowed"; - protected: virtual void OnOperation(int pad_req); @@ -1361,12 +1361,12 @@ public: } void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { - err_handler(msg); + err_handler("Operation not allowed"); } // Disable this call; the viewport is already defined void setSubWindow(NCursesWindow& sub) { - err_handler(msg); + err_handler("Operation not allowed"); } // Disable this call; the viewport subwindow is already defined diff --git a/contrib/ncurses/c++/demo.cc b/contrib/ncurses/c++/demo.cc index 6ac4650fb54c..088dc2fbc86d 100644 --- a/contrib/ncurses/c++/demo.cc +++ b/contrib/ncurses/c++/demo.cc @@ -6,7 +6,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer <juergen.pfeifer@gmx.net> * - * $Id: demo.cc,v 1.17 1999/07/31 09:47:17 juergen Exp $ + * $Id: demo.cc,v 1.18 1999/09/11 18:57:54 tom Exp $ */ #include "cursesapp.h" @@ -333,7 +333,7 @@ private: NCursesPanel* P; NCursesMenuItem** I; UserData *u; - static const int n_items = 7; + #define n_items 7 public: MyMenu () diff --git a/contrib/ncurses/c++/edit_cfg.sh b/contrib/ncurses/c++/edit_cfg.sh index 04f4e2225dca..e108074adf4e 100755 --- a/contrib/ncurses/c++/edit_cfg.sh +++ b/contrib/ncurses/c++/edit_cfg.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.4 1998/02/11 12:13:41 tom Exp $ +# $Id: edit_cfg.sh,v 1.7 1999/09/12 02:00:14 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -37,7 +37,12 @@ # $2 = etip.h # for name in \ + CPP_HAS_PARAM_INIT \ + ETIP_NEEDS_MATH_EXCEPTION \ + ETIP_NEEDS_MATH_H \ HAVE_BUILTIN_H \ + HAVE_GXX_BUILTIN_H \ + HAVE_GPP_BUILTIN_H \ HAVE_TYPEINFO \ HAVE_VALUES_H do diff --git a/contrib/ncurses/c++/etip.h.in b/contrib/ncurses/c++/etip.h.in index 0f7ae823b3cb..985cd1eb6a06 100644 --- a/contrib/ncurses/c++/etip.h.in +++ b/contrib/ncurses/c++/etip.h.in @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: etip.h.in,v 1.10 1999/05/16 17:29:47 juergen Exp $ +// $Id: etip.h.in,v 1.13 1999/09/12 02:01:59 tom Exp $ #ifndef _ETIP_H #define _ETIP_H @@ -41,6 +41,14 @@ #define HAVE_BUILTIN_H 0 #endif +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + #ifndef HAVE_TYPEINFO #define HAVE_TYPEINFO 0 #endif @@ -57,6 +65,10 @@ #define ETIP_NEEDS_MATH_EXCEPTION 0 #endif +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + #ifdef __GNUG__ # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) # if HAVE_TYPEINFO @@ -66,7 +78,7 @@ #endif #if defined(__GNUG__) -# if HAVE_BUILTIN_H +# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H # if ETIP_NEEDS_MATH_H # if ETIP_NEEDS_MATH_EXCEPTION # undef exception @@ -76,7 +88,13 @@ # endif # undef exception # define exception builtin_exception -# include <builtin.h> +# if HAVE_GPP_BUILTIN_H +# include <gpp/builtin.h> +# elif HAVE_GXX_BUILTIN_H +# include <g++/builtin.h> +# else +# include <builtin.h> +# endif # undef exception # endif #elif defined (__SUNPRO_CC) @@ -96,6 +114,13 @@ extern "C" { #include <errno.h> } +// Language features +#if CPP_HAS_PARAM_INIT +#define NCURSES_PARAM_INIT(value) = value +#else +#define NCURSES_PARAM_INIT(value) /*nothing*/ +#endif + // Forward Declarations class NCursesPanel; class NCursesMenu; |