diff options
author | peter <peter@FreeBSD.org> | 2000-10-11 07:31:01 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-10-11 07:31:01 +0000 |
commit | a81407a537bfd1ab9e48c69007eb6b30e66d271b (patch) | |
tree | 9ec00b41242bbe63b83c0ac5316c539466d9f9de /contrib/ncurses/c++ | |
parent | cc6a5cc05f3c2cde24338d35c9714f1e7ebf032e (diff) | |
download | FreeBSD-src-a81407a537bfd1ab9e48c69007eb6b30e66d271b.zip FreeBSD-src-a81407a537bfd1ab9e48c69007eb6b30e66d271b.tar.gz |
Import ncurses-5.1-20001009 onto the vendor branch
Diffstat (limited to 'contrib/ncurses/c++')
-rw-r--r-- | contrib/ncurses/c++/Makefile.in | 12 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesf.cc | 11 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesf.h | 93 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesp.cc | 19 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursesw.cc | 4 | ||||
-rw-r--r-- | contrib/ncurses/c++/cursslk.cc | 7 | ||||
-rw-r--r-- | contrib/ncurses/c++/internal.h | 6 |
7 files changed, 79 insertions, 73 deletions
diff --git a/contrib/ncurses/c++/Makefile.in b/contrib/ncurses/c++/Makefile.in index e807989..78b86db 100644 --- a/contrib/ncurses/c++/Makefile.in +++ b/contrib/ncurses/c++/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.52 2000/05/28 01:44:34 tom Exp $ +# $Id: Makefile.in,v 1.53 2000/08/19 19:12:32 tom Exp $ ############################################################################## # Copyright (c) 1998,1999 Free Software Foundation, Inc. # # # @@ -41,7 +41,7 @@ CF_MFLAGS = @cf_cv_makeflags@ x = @PROG_EXT@ MODEL = ../@DFT_OBJ_SUBDIR@ -INSTALL_PREFIX = @INSTALL_PREFIX@ +DESTDIR = @DESTDIR@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -132,16 +132,16 @@ etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh cp $(srcdir)/etip.h.in $@ sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ -$(INSTALL_PREFIX)$(libdir) : +$(DESTDIR)$(libdir) : $(srcdir)/../mkinstalldirs $@ install \ -install.libs:: ../lib/$(LIBNAME) $(INSTALL_PREFIX)$(libdir) - $(INSTALL) ../lib/$(LIBNAME) $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) +install.libs:: ../lib/$(LIBNAME) $(DESTDIR)$(libdir) + $(INSTALL) ../lib/$(LIBNAME) $(DESTDIR)$(libdir)/$(LIBNAME) uninstall \ uninstall.libs:: - -rm -f $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) + -rm -f $(DESTDIR)$(libdir)/$(LIBNAME) mostlyclean :: -rm -f core tags TAGS *~ *.ln *.atac trace diff --git a/contrib/ncurses/c++/cursesf.cc b/contrib/ncurses/c++/cursesf.cc index a993322..a3b066c 100644 --- a/contrib/ncurses/c++/cursesf.cc +++ b/contrib/ncurses/c++/cursesf.cc @@ -35,7 +35,7 @@ #include "cursesapp.h" #include "internal.h" -MODULE_ID("$Id: cursesf.cc,v 1.10 1999/10/30 23:49:28 tom Exp $") +MODULE_ID("$Id: cursesf.cc,v 1.11 2000/06/09 16:15:40 juergen Exp $") NCursesFormField::~NCursesFormField () { if (field) @@ -48,7 +48,8 @@ NCursesFormField::~NCursesFormField () { FIELD** NCursesForm::mapFields(NCursesFormField* nfields[]) { int fieldCount = 0,lcv; - + FIELD** old_fields; + assert(nfields != 0); for (lcv=0; nfields[lcv]->field; ++lcv) @@ -63,8 +64,10 @@ NCursesForm::mapFields(NCursesFormField* nfields[]) { my_fields = nfields; - if (form) - delete[] ::form_fields(form); + if (form && (old_fields = ::form_fields(form))) { + ::set_form_fields(form,(FIELD**)0); + delete[] old_fields; + } return fields; } diff --git a/contrib/ncurses/c++/cursesf.h b/contrib/ncurses/c++/cursesf.h index 89f0cbe..40f4146 100644 --- a/contrib/ncurses/c++/cursesf.h +++ b/contrib/ncurses/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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,12 +31,13 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.11 1999/10/30 23:59:37 tom Exp $ +// $Id: cursesf.h,v 1.12 2000/07/15 21:08:25 tom Exp $ #ifndef _CURSESF_H #define _CURSESF_H #include <cursesp.h> +#include <string.h> extern "C" { # include <form.h> @@ -91,10 +92,10 @@ protected: if (err != E_OK) THROW(new NCursesFormException (err)); } - + public: // Create a 'Null' field. Can be used to delimit a field list - NCursesFormField() + NCursesFormField() : field((FIELD*)0), ftype((NCursesFieldType*)0) { } @@ -104,14 +105,14 @@ public: int first_row = 0, int first_col = 0, int offscreen_rows = 0, - int additional_buffers = 0) + int additional_buffers = 0) : ftype((NCursesFieldType*)0) { field = ::new_field(rows,cols,first_row,first_col, offscreen_rows, additional_buffers); if (!field) OnError(errno); } - + virtual ~NCursesFormField (); // Duplicate the field at a new position @@ -321,12 +322,12 @@ private: static void frm_term(FORM *); static void fld_init(FORM *); static void fld_term(FORM *); - + // Calculate FIELD* array for the menu FIELD** mapFields(NCursesFormField* nfields[]); -protected: - // internal routines +protected: + // internal routines inline void set_user(void *user) { UserHook* uptr = (UserHook*)::form_userptr (form); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); @@ -337,8 +338,8 @@ protected: UserHook* uptr = (UserHook*)::form_userptr (form); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); return uptr->m_user; - } - + } + void InitForm (NCursesFormField* Fields[], bool with_frame, bool autoDeleteFields); @@ -353,14 +354,14 @@ protected: // 'Internal' constructor, builds an object without association to a // field array. - NCursesForm( int lines, - int cols, - int begin_y = 0, - int begin_x = 0) - : NCursesPanel(lines,cols,begin_y,begin_x), + NCursesForm( int lines, + int cols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(lines,cols,begin_y,begin_x), form ((FORM*)0) { } - + public: // Create form for the default panel. NCursesForm (NCursesFormField* Fields[], @@ -372,9 +373,9 @@ public: // Create a form in a panel with the given position and size. NCursesForm (NCursesFormField* Fields[], - int lines, - int cols, - int begin_y, + int lines, + int cols, + int begin_y, int begin_x, bool with_frame=FALSE, // reserve space for a frame? bool autoDelete_Fields=FALSE) // do automatic cleanup? @@ -397,17 +398,17 @@ public: // Set these fields for the form inline void setFields(NCursesFormField* Fields[]) { - OnError(::set_form_fields(form,mapFields(Fields))); + OnError(::set_form_fields(form,mapFields(Fields))); } // Remove the form from the screen - inline void unpost (void) { - OnError (::unpost_form (form)); + inline void unpost (void) { + OnError (::unpost_form (form)); } - + // Post the form to the screen if flag is true, unpost it otherwise inline void post(bool flag = TRUE) { - OnError (flag ? ::post_form(form) : ::unpost_form (form)); + OnError (flag ? ::post_form(form) : ::unpost_form (form)); } // Decorations @@ -424,7 +425,7 @@ public: else OnError(E_SYSTEM_ERROR); } - + inline void label(const char *topLabel, const char *bottomLabel) { if (b_framed) NCursesPanel::label(topLabel,bottomLabel); @@ -578,18 +579,18 @@ template<class T> class NCursesUserForm : public NCursesForm protected: // 'Internal' constructor, builds an object without association to a // field array. - NCursesUserForm( int lines, - int cols, - int begin_y = 0, + NCursesUserForm( int lines, + int cols, + int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0) + const T* p_UserData = (T*)0) : NCursesForm(lines,cols,begin_y,begin_x) { if (form) set_user ((void *)p_UserData); } public: - NCursesUserForm (NCursesFormField Fields[], + NCursesUserForm (NCursesFormField Fields[], bool with_frame=FALSE, bool autoDelete_Fields=FALSE) : NCursesForm (Fields, with_frame, autoDelete_Fields) { @@ -603,11 +604,11 @@ public: if (form) set_user ((void *)p_UserData); }; - + NCursesUserForm (NCursesFormField Fields[], - int lines, - int cols, - int begin_y = 0, + int lines, + int cols, + int begin_y = 0, int begin_x = 0, const T* p_UserData = (T*)0, bool with_frame=FALSE, @@ -616,11 +617,11 @@ public: with_frame, autoDelete_Fields) { if (form) set_user ((void *)p_UserData); - }; - + }; + virtual ~NCursesUserForm() { }; - + inline T* UserData (void) const { return (T*)get_user (); }; @@ -645,7 +646,7 @@ private: } public: - Alpha_Field(int width) + Alpha_Field(int width) : NCursesFieldType(TYPE_ALPHA), min_field_width(width) { } @@ -660,7 +661,7 @@ private: } public: - Alphanumeric_Field(int width) + Alphanumeric_Field(int width) : NCursesFieldType(TYPE_ALNUM), min_field_width(width) { } @@ -678,7 +679,7 @@ private: public: Integer_Field(int prec, long low=0L, long high=0L) - : NCursesFieldType(TYPE_INTEGER), + : NCursesFieldType(TYPE_INTEGER), precision(prec), lower_limit(low), upper_limit(high) { } }; @@ -695,7 +696,7 @@ private: public: Numeric_Field(int prec, double low=0.0, double high=0.0) - : NCursesFieldType(TYPE_NUMERIC), + : NCursesFieldType(TYPE_NUMERIC), precision(prec), lower_limit(low), upper_limit(high) { } }; @@ -757,11 +758,11 @@ public: // ------------------------------------------------------------------------- // class UserDefinedFieldType : public NCursesFieldType { - friend class UDF_Init; // Internal helper to set up statics + friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes we need only one generic lowlevel // FIELDTYPE* element. - static FIELDTYPE* generic_fieldtype; + static FIELDTYPE* generic_fieldtype; protected: // This are the functions required by the low level libforms functions @@ -793,9 +794,9 @@ public: // ------------------------------------------------------------------------- // class UserDefinedFieldType_With_Choice : public UserDefinedFieldType { - friend class UDF_Init; // Internal helper to set up statics + friend class UDF_Init; // Internal helper to set up statics private: - // For all C++ defined fieldtypes with choice functions we need only one + // For all C++ defined fieldtypes with choice functions we need only one // generic lowlevel FIELDTYPE* element. static FIELDTYPE* generic_fieldtype_with_choice; diff --git a/contrib/ncurses/c++/cursesp.cc b/contrib/ncurses/c++/cursesp.cc index 3bcf3d2..50095d3 100644 --- a/contrib/ncurses/c++/cursesp.cc +++ b/contrib/ncurses/c++/cursesp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 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 * @@ -33,8 +33,9 @@ #include "cursesp.h" #include "internal.h" +#include <string.h> -MODULE_ID("$Id: cursesp.cc,v 1.15 1999/10/30 23:59:37 tom Exp $") +MODULE_ID("$Id: cursesp.cc,v 1.16 2000/07/15 21:08:13 tom Exp $") NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; @@ -42,13 +43,13 @@ void NCursesPanel::init() { p = ::new_panel(w); if (!p) OnError(ERR); - + UserHook* hook = new UserHook; hook->m_user = NULL; hook->m_back = this; hook->m_owner = p; ::set_panel_userptr(p, (void *)hook); -} +} NCursesPanel::~NCursesPanel() { UserHook* hook = (UserHook*)::panel_userptr(p); @@ -61,7 +62,7 @@ NCursesPanel::~NCursesPanel() { void NCursesPanel::redraw() { PANEL *pan; - + pan = ::panel_above(NULL); while (pan) { ::touchwin(panel_window(pan)); @@ -95,20 +96,20 @@ NCursesPanel::frame(const char *title,const char *btitle) { int err = OK; if (!title && !btitle) { err = box(); - } + } else { err = box(); if (err==OK) - label(title,btitle); + label(title,btitle); } OnError(err); } void NCursesPanel::label(const char *tLabel, const char *bLabel) { - if (tLabel) + if (tLabel) centertext(0,tLabel); - if (bLabel) + if (bLabel) centertext(maxy(),bLabel); } diff --git a/contrib/ncurses/c++/cursesw.cc b/contrib/ncurses/c++/cursesw.cc index baae046..b61a705 100644 --- a/contrib/ncurses/c++/cursesw.cc +++ b/contrib/ncurses/c++/cursesw.cc @@ -25,7 +25,7 @@ #include "cursesw.h" #include "internal.h" -MODULE_ID("$Id: cursesw.cc,v 1.16 1999/11/13 23:42:17 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.17 2000/09/02 18:55:31 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -424,7 +424,7 @@ NCursesWindow::setcolor(short pair) return OK; } -#ifdef HAVE_HAS_KEY +#if HAVE_HAS_KEY extern "C" int _nc_has_mouse(void); bool NCursesWindow::has_mouse() const { diff --git a/contrib/ncurses/c++/cursslk.cc b/contrib/ncurses/c++/cursslk.cc index 82ff83e..236d3a5 100644 --- a/contrib/ncurses/c++/cursslk.cc +++ b/contrib/ncurses/c++/cursslk.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -34,8 +34,9 @@ #include "cursslk.h" #include "cursesapp.h" #include "internal.h" +#include <string.h> -MODULE_ID("$Id: cursslk.cc,v 1.5 1999/05/16 17:31:01 juergen Exp $") +MODULE_ID("$Id: cursslk.cc,v 1.6 2000/07/15 21:07:50 tom Exp $") void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { delete[] label; @@ -54,7 +55,7 @@ void Soft_Label_Key_Set::init() { for(int i=0; i < num_labels; i++) { slk_array[i].num = i+1; } - b_attrInit = FALSE; + b_attrInit = FALSE; } Soft_Label_Key_Set::Soft_Label_Key_Set() { diff --git a/contrib/ncurses/c++/internal.h b/contrib/ncurses/c++/internal.h index cdf256c..67bc3ff 100644 --- a/contrib/ncurses/c++/internal.h +++ b/contrib/ncurses/c++/internal.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,12 +31,12 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.5 1999/05/16 17:29:25 juergen Exp $ +// $Id: internal.h,v 1.6 2000/09/02 18:22:23 tom Exp $ #ifndef _CPLUS_INTERNAL_H #define _CPLUS_INTERNAL_H 1 -#ifdef USE_RCS_IDS +#if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else #define MODULE_ID(id) /*nothing*/ |