diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-22 18:02:21 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-22 18:02:21 +0000 |
commit | 7fe795010750d2e2889d7085abeaa1ee0926c69b (patch) | |
tree | b52138c43e052b09287afed0fb6351cd31249bda /lib | |
parent | 85db479b2362c15a2266e01737d835e86cda1b1e (diff) |
Update to ncurses-5.2-20010114
Diffstat (limited to 'lib')
255 files changed, 5344 insertions, 4900 deletions
diff --git a/lib/libcurses++/cursesapp.h b/lib/libcurses++/cursesapp.h index ccff782bd65..78e1c76a75b 100644 --- a/lib/libcurses++/cursesapp.h +++ b/lib/libcurses++/cursesapp.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,14 +31,14 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $From: cursesapp.h,v 1.5 1999/05/16 17:29:59 juergen Exp $ +// $From: cursesapp.h,v 1.6 2000/12/10 03:10:39 tom Exp $ #ifndef _CURSESAPP_H #define _CURSESAPP_H #include <cursslk.h> -class NCursesApplication { +class NCURSES_IMPEXP NCursesApplication { public: typedef struct _slk_link { // This structure is used to maintain struct _slk_link* prev; // a stack of SLKs diff --git a/lib/libcurses++/cursesf.h b/lib/libcurses++/cursesf.h index 369d109a1c7..151f5b1cc0c 100644 --- a/lib/libcurses++/cursesf.h +++ b/lib/libcurses++/cursesf.h @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $From: cursesf.h,v 1.12 2000/07/15 21:08:25 tom Exp $ +// $From: cursesf.h,v 1.13 2000/12/10 03:08:05 tom Exp $ #ifndef _CURSESF_H #define _CURSESF_H @@ -47,11 +47,11 @@ extern "C" { // The abstract base class for buitin and user defined Fieldtypes. // ------------------------------------------------------------------------- // -class NCursesFormField; // forward declaration +class NCURSES_IMPEXP NCursesFormField; // forward declaration // Class to represent builtin field types as well as C++ written new // fieldtypes (see classes UserDefineFieldType... -class NCursesFieldType { +class NCURSES_IMPEXP NCursesFieldType { friend class NCursesFormField; protected: @@ -80,7 +80,7 @@ public: // The class representing a forms field, wrapping the lowlevel FIELD struct // ------------------------------------------------------------------------- // -class NCursesFormField { +class NCURSES_IMPEXP NCursesFormField { friend class NCursesForm; protected: @@ -288,7 +288,7 @@ public: // The class representing a form, wrapping the lowlevel FORM struct // ------------------------------------------------------------------------- // -class NCursesForm : public NCursesPanel { +class NCURSES_IMPEXP NCursesForm : public NCursesPanel { protected: FORM* form; // the lowlevel structure @@ -541,7 +541,7 @@ public: // data belongs to some class T. Use T as template argument // to create a UserField. // ------------------------------------------------------------------------- -template<class T> class NCursesUserField : public NCursesFormField +template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { public: NCursesUserField (int rows, @@ -574,7 +574,7 @@ public: // The same mechanism is used to attach user data to a form // ------------------------------------------------------------------------- // -template<class T> class NCursesUserForm : public NCursesForm +template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { protected: // 'Internal' constructor, builds an object without association to a @@ -637,7 +637,7 @@ public: // Builtin Fieldtypes // ------------------------------------------------------------------------- // -class Alpha_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { private: int min_field_width; @@ -652,7 +652,7 @@ public: } }; -class Alphanumeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { private: int min_field_width; @@ -667,7 +667,7 @@ public: } }; -class Integer_Field : public NCursesFieldType { +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { private: int precision; long lower_limit, upper_limit; @@ -684,7 +684,7 @@ public: } }; -class Numeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { private: int precision; double lower_limit, upper_limit; @@ -701,7 +701,7 @@ public: } }; -class Regular_Expression_Field : public NCursesFieldType { +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { private: char* regex; @@ -721,7 +721,7 @@ public: } }; -class Enumeration_Field : public NCursesFieldType { +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { private: char** list; int case_sensitive; @@ -742,7 +742,7 @@ public: } }; -class IPV4_Address_Field : public NCursesFieldType { +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { private: void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype)); @@ -757,7 +757,7 @@ public: // Abstract base class for User-Defined Fieldtypes // ------------------------------------------------------------------------- // -class UserDefinedFieldType : public NCursesFieldType { +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes we need only one generic lowlevel @@ -793,7 +793,7 @@ public: // Abstract base class for User-Defined Fieldtypes with Choice functions // ------------------------------------------------------------------------- // -class UserDefinedFieldType_With_Choice : public UserDefinedFieldType { +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes with choice functions we need only one diff --git a/lib/libcurses++/cursesm.h b/lib/libcurses++/cursesm.h index 91dc0149a29..1c7dc5f735c 100644 --- a/lib/libcurses++/cursesm.h +++ b/lib/libcurses++/cursesm.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,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $From: cursesm.h,v 1.13 1999/10/30 23:59:37 tom Exp $ +// $From: cursesm.h,v 1.14 2000/12/10 03:10:39 tom Exp $ #ifndef _CURSESM_H #define _CURSESM_H @@ -46,7 +46,7 @@ extern "C" { // This wraps the ITEM type of <menu.h> // ------------------------------------------------------------------------- // -class NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuItem { friend class NCursesMenu; protected: @@ -135,7 +135,7 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&); // If you don't like to create a child class for individual items to // overload action(), you may use this class and provide a callback // function pointer for items. -class NCursesMenuCallbackItem : public NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { private: ITEMCALLBACK* p_fct; @@ -156,7 +156,7 @@ public: // This wraps the MENU type of <menu.h> // ------------------------------------------------------------------------- // -class NCursesMenu : public NCursesPanel { +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { protected: MENU *menu; @@ -514,7 +514,7 @@ public: // to create a UserItem. // ------------------------------------------------------------------------- // -template<class T> class NCursesUserItem : public NCursesMenuItem +template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { public: NCursesUserItem (const char* p_name, @@ -541,7 +541,7 @@ public: // The same mechanism is used to attach user data to a menu // ------------------------------------------------------------------------- // -template<class T> class NCursesUserMenu : public NCursesMenu +template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { protected: NCursesUserMenu( int lines, diff --git a/lib/libcurses++/cursesp.h b/lib/libcurses++/cursesp.h index 7c4350ccd03..8839c173fae 100644 --- a/lib/libcurses++/cursesp.h +++ b/lib/libcurses++/cursesp.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 * @@ -34,7 +34,7 @@ #ifndef _CURSESP_H #define _CURSESP_H -// $From: cursesp.h,v 1.12 1999/10/31 00:00:02 tom Exp $ +// $From: cursesp.h,v 1.13 2000/12/10 03:10:39 tom Exp $ #include <cursesw.h> @@ -42,7 +42,7 @@ extern "C" { # include <panel.h> } -class NCursesPanel : public NCursesWindow { +class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { protected: PANEL *p; static NCursesPanel *dummy; diff --git a/lib/libcurses++/cursesw.h b/lib/libcurses++/cursesw.h index c76b04e9ba5..fab04b960e4 100644 --- a/lib/libcurses++/cursesw.h +++ b/lib/libcurses++/cursesw.h @@ -2,7 +2,7 @@ #ifndef _CURSESW_H #define _CURSESW_H -// $From: cursesw.h,v 1.18 1999/10/23 15:16:53 tom Exp $ +// $From: cursesw.h,v 1.20 2000/12/10 03:22:35 tom Exp $ #include <etip.h> #include <stdio.h> @@ -118,7 +118,7 @@ inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); } #undef clearok #define clearok UNDEF(clearok) #else -extern "C" int clearok(WINDOW*, bool); +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); #endif #ifdef clrtobot @@ -301,7 +301,7 @@ inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } #undef leaveok #define leaveok UNDEF(leaveok) #else -extern "C" int leaveok(WINDOW* win, bool bf); +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); #endif #ifdef move @@ -340,9 +340,9 @@ inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } #define scrollok UNDEF(scrollok) #else #if defined(__NCURSES_H) -extern "C" int scrollok(WINDOW*, bool); +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); #else -extern "C" int scrollok(WINDOW*, char); +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); #endif #endif @@ -671,7 +671,7 @@ inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } * */ -class NCursesWindow +class NCURSES_IMPEXP NCursesWindow { friend class NCursesMenu; friend class NCursesForm; @@ -1207,7 +1207,7 @@ public: // ------------------------------------------------------------------------- // We leave this here for compatibility reasons. // ------------------------------------------------------------------------- -class NCursesColorWindow : public NCursesWindow { +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr : NCursesWindow(window) { @@ -1251,7 +1251,7 @@ public: // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. // ------------------------------------------------------------------------- -class NCursesPad : public NCursesWindow { +class NCURSES_IMPEXP NCursesPad : public NCursesWindow { private: NCursesWindow* viewWin; // the "viewport" window NCursesWindow* viewSub; // the "viewport" subwindow @@ -1343,7 +1343,7 @@ public: // A FramedPad is constructed always with a viewport window. This viewport // 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 { +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { protected: virtual void OnOperation(int pad_req); diff --git a/lib/libcurses++/cursslk.cc b/lib/libcurses++/cursslk.cc index 58afd5d4914..37037514664 100644 --- a/lib/libcurses++/cursslk.cc +++ b/lib/libcurses++/cursslk.cc @@ -36,7 +36,7 @@ #include "internal.h" #include <string.h> -MODULE_ID("$From: cursslk.cc,v 1.6 2000/07/15 21:07:50 tom Exp $") +MODULE_ID("$From: cursslk.cc,v 1.7 2000/12/09 23:46:12 tom Exp $") void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { delete[] label; @@ -47,7 +47,7 @@ void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { long Soft_Label_Key_Set::count = 0L; int Soft_Label_Key_Set::num_labels = 0; -Soft_Label_Key_Set::Label_Layout +Soft_Label_Key_Set::Label_Layout Soft_Label_Key_Set::format = None; void Soft_Label_Key_Set::init() { diff --git a/lib/libcurses++/cursslk.h b/lib/libcurses++/cursslk.h index 7a8efde88e9..ebc5c7b3f28 100644 --- a/lib/libcurses++/cursslk.h +++ b/lib/libcurses++/cursslk.h @@ -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 * @@ -31,17 +31,17 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $From: cursslk.h,v 1.5 1999/05/16 17:30:08 juergen Exp $ +// $From: cursslk.h,v 1.6 2000/12/10 03:10:39 tom Exp $ #ifndef _CURSSLK_H #define _CURSSLK_H #include <cursesw.h> -class Soft_Label_Key_Set { +class NCURSES_IMPEXP Soft_Label_Key_Set { public: // This inner class represents the attributes of a Soft Label Key (SLK) - class Soft_Label_Key { + class NCURSES_IMPEXP Soft_Label_Key { friend class Soft_Label_Key_Set; public: typedef enum { Left=0, Center=1, Right=2 } Justification; @@ -83,10 +83,10 @@ public: } Label_Layout; private: - static long count; // Number of Key Sets - static Label_Layout format; // Layout of the Key Sets - static int num_labels; // Number Of Labels in Key Sets - bool b_attrInit; // Are attributes initialized + static long NCURSES_IMPEXP count; // Number of Key Sets + static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets + static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets + bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized Soft_Label_Key *slk_array; // The array of SLK's @@ -126,12 +126,12 @@ public: // This constructor assumes, that you already constructed a Key Set // with a layout by the constructor above. This layout will be reused. - Soft_Label_Key_Set(); + NCURSES_IMPEXP Soft_Label_Key_Set(); virtual ~Soft_Label_Key_Set(); // Get Label# i. Label counting starts with 1! - Soft_Label_Key& operator[](int i); + NCURSES_IMPEXP Soft_Label_Key& operator[](int i); // Retrieve number of Labels inline int labels() const { return num_labels; } diff --git a/lib/libcurses++/demo.cc b/lib/libcurses++/demo.cc index cbd91a85e18..f08cbe9a874 100644 --- a/lib/libcurses++/demo.cc +++ b/lib/libcurses++/demo.cc @@ -6,7 +6,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer <juergen.pfeifer@gmx.net> * - * $From: demo.cc,v 1.18 1999/09/11 18:57:54 tom Exp $ + * $From: demo.cc,v 1.19 2000/12/09 23:46:12 tom Exp $ */ #include "cursesapp.h" @@ -446,4 +446,12 @@ int TestApplication::run() { // // ------------------------------------------------------------------------- // -static TestApplication Demo; +// static TestApplication Demo; + +int main() +{ + TestApplication * Demo = new TestApplication(); + Demo->run(); + return 0; +} + diff --git a/lib/libcurses++/etip.h b/lib/libcurses++/etip.h index cce248dbac6..32cd284090c 100644 --- a/lib/libcurses++/etip.h +++ b/lib/libcurses++/etip.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,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $From: etip.h.in,v 1.13 1999/09/12 02:01:59 tom Exp $ +// $From: etip.h.in,v 1.14 2000/12/10 03:10:39 tom Exp $ #ifndef _ETIP_H #define _ETIP_H @@ -104,6 +104,19 @@ # include <string.h> #endif +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + extern "C" { #if HAVE_VALUES_H # include <values.h> @@ -122,11 +135,11 @@ extern "C" { #endif // Forward Declarations -class NCursesPanel; -class NCursesMenu; -class NCursesForm; +class NCURSES_IMPEXP NCursesPanel; +class NCURSES_IMPEXP NCursesMenu; +class NCURSES_IMPEXP NCursesForm; -class NCursesException +class NCURSES_IMPEXP NCursesException { public: const char *message; @@ -145,7 +158,7 @@ public: } }; -class NCursesPanelException : public NCursesException +class NCURSES_IMPEXP NCursesPanelException : public NCursesException { public: const NCursesPanel* p; @@ -179,7 +192,7 @@ public: }; -class NCursesMenuException : public NCursesException +class NCURSES_IMPEXP NCursesMenuException : public NCursesException { public: const NCursesMenu* m; @@ -213,7 +226,7 @@ public: }; -class NCursesFormException : public NCursesException +class NCURSES_IMPEXP NCursesFormException : public NCursesException { public: const NCursesForm* f; diff --git a/lib/libcurses/SigAction.h b/lib/libcurses/SigAction.h index 1f06fc2c3b6..5faf7c43e53 100644 --- a/lib/libcurses/SigAction.h +++ b/lib/libcurses/SigAction.h @@ -1,7 +1,7 @@ -/* $OpenBSD: SigAction.h,v 1.2 1999/06/27 08:15:19 millert Exp $ */ +/* $OpenBSD: SigAction.h,v 1.3 2001/01/22 18:01:32 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ ****************************************************************************/ /* - * $From: SigAction.h,v 1.5 1999/06/19 23:00:54 tom Exp $ + * $From: SigAction.h,v 1.6 2000/12/10 02:36:10 tom Exp $ * * This file exists to handle non-POSIX systems which don't have <unistd.h>, * and usually no sigaction() nor <termios.h> @@ -107,12 +107,12 @@ typedef unsigned long sigset_t; #undef sigaddset #define sigaddset _nc_sigaddset -extern int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); -extern int sigprocmask (int how, sigset_t *mask, sigset_t *omask); -extern int sigemptyset (sigset_t *mask); -extern int sigsuspend (sigset_t *mask); -extern int sigdelset (sigset_t *mask, int sig); -extern int sigaddset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); +extern NCURSES_EXPORT(int) sigprocmask (int how, sigset_t *mask, sigset_t *omask); +extern NCURSES_EXPORT(int) sigemptyset (sigset_t *mask); +extern NCURSES_EXPORT(int) sigsuspend (sigset_t *mask); +extern NCURSES_EXPORT(int) sigdelset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaddset (sigset_t *mask, int sig); #endif /* HAVE_SIGVEC */ #endif /* HAVE_SIGACTION */ diff --git a/lib/libcurses/base/MKkeyname.awk b/lib/libcurses/base/MKkeyname.awk index df70e9b89d3..0bf3da063a6 100644 --- a/lib/libcurses/base/MKkeyname.awk +++ b/lib/libcurses/base/MKkeyname.awk @@ -1,7 +1,7 @@ -# $OpenBSD: MKkeyname.awk,v 1.2 1999/02/24 06:31:07 millert Exp $ -# $From: MKkeyname.awk,v 1.17 1999/02/18 11:18:06 tom Exp $ +# $OpenBSD: MKkeyname.awk,v 1.3 2001/01/22 18:01:36 millert Exp $ +# $From: MKkeyname.awk,v 1.18 2000/12/10 02:25:23 tom Exp $ ############################################################################## -# Copyright (c) 1999 Free Software Foundation, Inc. # +# Copyright (c) 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 "Software"), # @@ -46,7 +46,7 @@ BEGIN { END { printf "\t{ 0, 0 }};\n" print "" - print "NCURSES_CONST char *keyname(int c)" + print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)" print "{" print "int i;" print "static char name[20];" diff --git a/lib/libcurses/base/MKlib_gen.sh b/lib/libcurses/base/MKlib_gen.sh index 2efe9091a08..ad30cb2b149 100644 --- a/lib/libcurses/base/MKlib_gen.sh +++ b/lib/libcurses/base/MKlib_gen.sh @@ -2,8 +2,8 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# $OpenBSD: MKlib_gen.sh,v 1.2 2000/10/08 22:46:58 millert Exp $ -# ($From: MKlib_gen.sh,v 1.12 2000/07/29 16:30:11 tom Exp $) +# $OpenBSD: MKlib_gen.sh,v 1.3 2001/01/22 18:01:36 millert Exp $ +# ($From: MKlib_gen.sh,v 1.13 2000/12/10 00:30:25 tom Exp $) # # The XSI Curses standard requires all curses entry points to exist as # functions, even though many definitions would normally be shadowed @@ -227,7 +227,9 @@ BEGIN { } EOF1 -sed -n -f $ED1 | sed -f $ED2 \ +sed -n -f $ED1 \ +| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \ +| sed -f $ED2 \ | $AWK -f $AW1 ) \ | sed \ -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP @@ -256,5 +258,7 @@ BEGIN { | sed -f $ED3 \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ - -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' + -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' \ +| sed \ + -e 's/^\(.*\) \(.*\) (\(.*\))$/NCURSES_EXPORT(\1) \2 (\3)/' diff --git a/lib/libcurses/base/MKunctrl.awk b/lib/libcurses/base/MKunctrl.awk index 2084622303c..ee9423558c5 100644 --- a/lib/libcurses/base/MKunctrl.awk +++ b/lib/libcurses/base/MKunctrl.awk @@ -1,7 +1,7 @@ -# $OpenBSD: MKunctrl.awk,v 1.2 2000/04/04 16:49:59 millert Exp $ -# $From: MKunctrl.awk,v 1.7 2000/04/01 19:49:26 tom Exp $ +# $OpenBSD: MKunctrl.awk,v 1.3 2001/01/22 18:01:36 millert Exp $ +# $From: MKunctrl.awk,v 1.8 2000/12/10 02:25:37 tom Exp $ ############################################################################## -# 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 "Software"), # @@ -40,7 +40,7 @@ BEGIN { print "" } END { - print "NCURSES_CONST char *unctrl(register chtype ch)" + print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)" print "{" printf "static const char* const table[] = {" for ( ch = 0; ch < 256; ch++ ) { diff --git a/lib/libcurses/base/define_key.c b/lib/libcurses/base/define_key.c index 97d2b6e9558..5dd6dcda7ea 100644 --- a/lib/libcurses/base/define_key.c +++ b/lib/libcurses/base/define_key.c @@ -1,7 +1,7 @@ -/* $OpenBSD: define_key.c,v 1.3 1999/03/02 06:23:27 millert Exp $ */ +/* $OpenBSD: define_key.c,v 1.4 2001/01/22 18:01:36 millert Exp $ */ /**************************************************************************** - * 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,28 +34,29 @@ #include <curses.priv.h> -MODULE_ID("$From: define_key.c,v 1.4 1999/02/21 13:03:55 tom Exp $") +MODULE_ID("$From: define_key.c,v 1.6 2000/12/10 02:43:26 tom Exp $") -int -define_key(char *str, int keycode) +NCURSES_EXPORT(int) +define_key +(char *str, int keycode) { - int code = ERR; + int code = ERR; - T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); - if (keycode > 0) { - if (str != 0) { - define_key(str, 0); - } else if (has_key(keycode)) { - while (_nc_remove_key(&(SP->_keytry), keycode)) - code = OK; - } - if (str != 0) { - (void) _nc_add_to_try(&(SP->_keytry), str, keycode); - code = OK; - } - } else { - while (_nc_remove_string(&(SP->_keytry), str)) - code = OK; + T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); + if (keycode > 0) { + if (str != 0) { + define_key(str, 0); + } else if (has_key(keycode)) { + while (_nc_remove_key(&(SP->_keytry), keycode)) + code = OK; } - returnCode(code); + if (str != 0) { + (void) _nc_add_to_try(&(SP->_keytry), str, keycode); + code = OK; + } + } else { + while (_nc_remove_string(&(SP->_keytry), str)) + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/keybound.c b/lib/libcurses/base/keybound.c index c1c8506a4a5..adee55cd0e4 100644 --- a/lib/libcurses/base/keybound.c +++ b/lib/libcurses/base/keybound.c @@ -1,7 +1,7 @@ -/* $OpenBSD: keybound.c,v 1.1 1999/02/24 06:31:07 millert Exp $ */ +/* $OpenBSD: keybound.c,v 1.2 2001/01/22 18:01:36 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -34,14 +34,15 @@ #include <curses.priv.h> -MODULE_ID("$From: keybound.c,v 1.1 1999/02/19 11:55:56 tom Exp $") +MODULE_ID("$From: keybound.c,v 1.3 2000/12/10 02:43:26 tom Exp $") /* * Returns the count'th string definition which is associated with the * given keycode. The result is malloc'd, must be freed by the caller. */ -char *keybound(int code, int count) +NCURSES_EXPORT(char *) +keybound(int code, int count) { - return _nc_expand_try(SP->_key_ok, code, &count, 0); + return _nc_expand_try(SP->_key_ok, code, &count, 0); } diff --git a/lib/libcurses/base/keyok.c b/lib/libcurses/base/keyok.c index 24736fe8d93..5e4b5880e86 100644 --- a/lib/libcurses/base/keyok.c +++ b/lib/libcurses/base/keyok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: keyok.c,v 1.2 1999/02/24 06:31:08 millert Exp $ */ +/* $OpenBSD: keyok.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include <curses.priv.h> -MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") +MODULE_ID("$From: keyok.c,v 1.5 2000/12/10 02:43:26 tom Exp $") /* * Enable (or disable) ncurses' interpretation of a keycode by adding (or @@ -46,29 +46,30 @@ MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") * corresponding tree. */ -int keyok(int c, bool flag) +NCURSES_EXPORT(int) +keyok(int c, bool flag) { - int code = ERR; - int count = 0; - char *s; + int code = ERR; + int count = 0; + char *s; - T((T_CALLED("keyok(%d,%d)"), c, flag)); - if (flag) { - while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_key_ok), c)) { - _nc_add_to_try(&(SP->_keytry), s, c); - free(s); - code = OK; - count = 0; - } - } else { - while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_keytry), c)) { - _nc_add_to_try(&(SP->_key_ok), s, c); - free(s); - code = OK; - count = 0; - } + T((T_CALLED("keyok(%d,%d)"), c, flag)); + if (flag) { + while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_key_ok), c)) { + _nc_add_to_try(&(SP->_keytry), s, c); + free(s); + code = OK; + count = 0; } - returnCode(code); + } else { + while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_keytry), c)) { + _nc_add_to_try(&(SP->_key_ok), s, c); + free(s); + code = OK; + count = 0; + } + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_addch.c b/lib/libcurses/base/lib_addch.c index 43dc5aca13b..4408a6cc43c 100644 --- a/lib/libcurses/base/lib_addch.c +++ b/lib/libcurses/base/lib_addch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_addch.c,v 1.3 2000/06/19 03:53:38 millert Exp $ */ +/* $OpenBSD: lib_addch.c,v 1.4 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_addch.c,v 1.44 2000/05/20 21:13:11 tom Exp $") +MODULE_ID("$From: lib_addch.c,v 1.47 2000/12/10 02:43:26 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -75,20 +75,22 @@ render_char(WINDOW *win, chtype ch) } TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, - win->_attrs, ch)); + win->_attrs, ch)); return (ch); } -chtype -_nc_background(WINDOW *win) +NCURSES_EXPORT(chtype) +_nc_background +(WINDOW *win) /* make render_char() visible while still allowing us to inline it below */ { return (win->_bkgd); } -chtype -_nc_render(WINDOW *win, chtype ch) +NCURSES_EXPORT(chtype) +_nc_render +(WINDOW *win, chtype ch) /* make render_char() visible while still allowing us to inline it below */ { return render_char(win, ch); @@ -124,7 +126,7 @@ waddch_literal(WINDOW *win, chtype ch) * If we're trying to add a character at the lower-right corner more * than once, fail. (Moving the cursor will clear the flag). */ -#if 0 /* Solaris 2.6 allows updating the corner more than once */ +#if 0 /* Solaris 2.6 allows updating the corner more than once */ if (win->_flags & _WRAPPED) { if (x >= win->_maxx) return (ERR); @@ -173,7 +175,7 @@ waddch_nosync(WINDOW *win, const chtype ch) /* the workhorse function -- add a character to the given window */ { int x, y; - int t = 0; + chtype t = 0; const char *s = 0; if ((ch & A_ALTCHARSET) @@ -248,8 +250,9 @@ waddch_nosync(WINDOW *win, const chtype ch) return (OK); } -int -_nc_waddch_nosync(WINDOW *win, const chtype c) +NCURSES_EXPORT(int) +_nc_waddch_nosync +(WINDOW *win, const chtype c) /* export copy of waddch_nosync() so the string-put functions can use it */ { return (waddch_nosync(win, c)); @@ -263,13 +266,14 @@ _nc_waddch_nosync(WINDOW *win, const chtype c) /* These are actual entry points */ -int -waddch(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +waddch +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { _nc_synchook(win); @@ -280,13 +284,14 @@ waddch(WINDOW *win, const chtype ch) return (code); } -int -wechochar(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wechochar +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { bool save_immed = win->_immed; diff --git a/lib/libcurses/base/lib_addstr.c b/lib/libcurses/base/lib_addstr.c index 99d76a18aa8..79e9f9eec87 100644 --- a/lib/libcurses/base/lib_addstr.c +++ b/lib/libcurses/base/lib_addstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_addstr.c,v 1.3 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_addstr.c,v 1.4 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,10 +42,11 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_addstr.c,v 1.18 2000/07/29 16:42:41 tom Exp $") +MODULE_ID("$From: lib_addstr.c,v 1.19 2000/12/10 01:24:50 tom Exp $") -int -waddnstr(WINDOW *win, const char *const astr, int n) +NCURSES_EXPORT(int) +waddnstr +(WINDOW *win, const char *const astr, int n) { unsigned const char *str = (unsigned const char *) astr; int code = ERR; @@ -72,8 +73,9 @@ waddnstr(WINDOW *win, const char *const astr, int n) returnCode(code); } -int -waddchnstr(WINDOW *win, const chtype * const astr, int n) +NCURSES_EXPORT(int) +waddchnstr +(WINDOW *win, const chtype * const astr, int n) { NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; diff --git a/lib/libcurses/base/lib_beep.c b/lib/libcurses/base/lib_beep.c index 071eec1b2e3..fa30974bbeb 100644 --- a/lib/libcurses/base/lib_beep.c +++ b/lib/libcurses/base/lib_beep.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_beep.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_beep.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * beep.c * @@ -42,9 +41,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$From: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") +MODULE_ID("$From: lib_beep.c,v 1.9 2000/12/10 02:43:26 tom Exp $") /* * beep() @@ -54,22 +53,23 @@ MODULE_ID("$From: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") * */ -int beep(void) +NCURSES_EXPORT(int) +beep(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("beep()"))); + T((T_CALLED("beep()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } else if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } else if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/lib/libcurses/base/lib_bkgd.c b/lib/libcurses/base/lib_bkgd.c index eacb4c36510..88a7461eb0e 100644 --- a/lib/libcurses/base/lib_bkgd.c +++ b/lib/libcurses/base/lib_bkgd.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_bkgd.c,v 1.1 1999/01/18 19:09:36 millert Exp $ */ +/* $OpenBSD: lib_bkgd.c,v 1.2 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * 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 * @@ -35,54 +35,56 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_bkgd.c,v 1.12 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_bkgd.c,v 1.14 2000/12/10 02:43:26 tom Exp $") -void wbkgdset(WINDOW *win, chtype ch) +NCURSES_EXPORT(void) +wbkgdset(WINDOW *win, chtype ch) { - T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); - - if (win) { - chtype off = AttrOf(win->_bkgd); - chtype on = AttrOf(ch); - - toggle_attr_off(win->_attrs,off); - toggle_attr_on (win->_attrs,on); - - if (TextOf(ch)==0) - ch |= BLANK; - win->_bkgd = ch; - } - returnVoid; + T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); + + if (win) { + chtype off = AttrOf(win->_bkgd); + chtype on = AttrOf(ch); + + toggle_attr_off(win->_attrs, off); + toggle_attr_on(win->_attrs, on); + + if (TextOf(ch) == 0) + ch |= BLANK; + win->_bkgd = ch; + } + returnVoid; } -int wbkgd(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wbkgd(WINDOW *win, const chtype ch) { - int code = ERR; - int x, y; - chtype new_bkgd = ch; + int code = ERR; + int x, y; + chtype new_bkgd = ch; + + T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); - T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + if (win) { + chtype old_bkgd = getbkgd(win); - if (win) { - chtype old_bkgd = getbkgd(win); + wbkgdset(win, new_bkgd); + wattrset(win, AttrOf(win->_bkgd)); - wbkgdset(win, new_bkgd); - wattrset(win, AttrOf(win->_bkgd)); - - for (y = 0; y <= win->_maxy; y++) { - for (x = 0; x <= win->_maxx; x++) { - if (win->_line[y].text[x] == old_bkgd) - win->_line[y].text[x] = win->_bkgd; - else - win->_line[y].text[x] = - _nc_render(win,(A_ALTCHARSET & - AttrOf(win->_line[y].text[x])) - | TextOf(win->_line[y].text[x])); - } + for (y = 0; y <= win->_maxy; y++) { + for (x = 0; x <= win->_maxx; x++) { + if (win->_line[y].text[x] == old_bkgd) + win->_line[y].text[x] = win->_bkgd; + else + win->_line[y].text[x] = + _nc_render(win, (A_ALTCHARSET & + AttrOf(win->_line[y].text[x])) + | TextOf(win->_line[y].text[x])); + } + } + touchwin(win); + _nc_synchook(win); + code = OK; } - touchwin(win); - _nc_synchook(win); - code = OK; - } - returnCode(code); + returnCode(code); } diff --git a/lib/libcurses/base/lib_box.c b/lib/libcurses/base/lib_box.c index 0593b769e4e..f97ee247c99 100644 --- a/lib/libcurses/base/lib_box.c +++ b/lib/libcurses/base/lib_box.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_box.c,v 1.2 2000/06/19 03:53:39 millert Exp $ */ +/* $OpenBSD: lib_box.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,26 +42,27 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_box.c,v 1.11 2000/04/29 21:12:37 tom Exp $") +MODULE_ID("$From: lib_box.c,v 1.13 2000/12/10 02:43:26 tom Exp $") -int -wborder(WINDOW *win, - chtype ls, chtype rs, chtype ts, chtype bs, - chtype tl, chtype tr, chtype bl, chtype br) +NCURSES_EXPORT(int) +wborder +(WINDOW *win, + chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) { NCURSES_SIZE_T i; NCURSES_SIZE_T endx, endy; T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), - win, - _tracechtype2(1, ls), - _tracechtype2(2, rs), - _tracechtype2(3, ts), - _tracechtype2(4, bs), - _tracechtype2(5, tl), - _tracechtype2(6, tr), - _tracechtype2(7, bl), - _tracechtype2(8, br))); + win, + _tracechtype2(1, ls), + _tracechtype2(2, rs), + _tracechtype2(3, ts), + _tracechtype2(4, bs), + _tracechtype2(5, tl), + _tracechtype2(6, tr), + _tracechtype2(7, bl), + _tracechtype2(8, br))); if (!win) returnCode(ERR); @@ -93,7 +94,7 @@ wborder(WINDOW *win, br = _nc_render(win, br); T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", - ls, rs, ts, bs, tl, tr, bl, br)); + ls, rs, ts, bs, tl, tr, bl, br)); endx = win->_maxx; endy = win->_maxy; diff --git a/lib/libcurses/base/lib_chgat.c b/lib/libcurses/base/lib_chgat.c index 1ed997d1499..d48c9aba297 100644 --- a/lib/libcurses/base/lib_chgat.c +++ b/lib/libcurses/base/lib_chgat.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_chgat.c,v 1.1 1999/01/18 19:09:37 millert Exp $ */ +/* $OpenBSD: lib_chgat.c,v 1.2 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,23 +42,24 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_chgat.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$From: lib_chgat.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wchgat +(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) { - int i; + int i; T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); if (win) { - toggle_attr_on(attr,COLOR_PAIR(color)); + toggle_attr_on(attr, COLOR_PAIR(color)); - for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) - win->_line[win->_cury].text[i] - = TextOf(win->_line[win->_cury].text[i]) | attr; + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) + win->_line[win->_cury].text[i] + = TextOf(win->_line[win->_cury].text[i]) | attr; - returnCode(OK); - } - else - returnCode(ERR); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_clear.c b/lib/libcurses/base/lib_clear.c index c668ea1c42b..6cb0a2f7929 100644 --- a/lib/libcurses/base/lib_clear.c +++ b/lib/libcurses/base/lib_clear.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_clear.c,v 1.1 1999/01/18 19:09:38 millert Exp $ */ +/* $OpenBSD: lib_clear.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,16 +42,17 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clear.c,v 1.5 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$From: lib_clear.c,v 1.7 2000/12/10 02:43:26 tom Exp $") -int wclear(WINDOW *win) +NCURSES_EXPORT(int) +wclear(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wclear(%p)"), win)); + T((T_CALLED("wclear(%p)"), win)); - if ((code = werase(win))!=ERR) - win->_clear = TRUE; - - returnCode(code); + if ((code = werase(win)) != ERR) + win->_clear = TRUE; + + returnCode(code); } diff --git a/lib/libcurses/base/lib_clearok.c b/lib/libcurses/base/lib_clearok.c index 3c51e6fac99..ccf11335497 100644 --- a/lib/libcurses/base/lib_clearok.c +++ b/lib/libcurses/base/lib_clearok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_clearok.c,v 1.1 1999/01/18 19:09:38 millert Exp $ */ +/* $OpenBSD: lib_clearok.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_clearok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clearok.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$From: lib_clearok.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int clearok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +clearok(WINDOW *win, bool flag) { - T((T_CALLED("clearok(%p,%d)"), win, flag)); + T((T_CALLED("clearok(%p,%d)"), win, flag)); - if (win) { - win->_clear = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_clear = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_clrbot.c b/lib/libcurses/base/lib_clrbot.c index 683b4f923d6..c947b668613 100644 --- a/lib/libcurses/base/lib_clrbot.c +++ b/lib/libcurses/base/lib_clrbot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_clrbot.c,v 1.2 2000/06/19 03:53:39 millert Exp $ */ +/* $OpenBSD: lib_clrbot.c,v 1.3 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clrbot.c,v 1.15 2000/04/29 21:15:26 tom Exp $") +MODULE_ID("$From: lib_clrbot.c,v 1.17 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtobot(WINDOW *win) { int code = ERR; @@ -57,7 +57,7 @@ wclrtobot(WINDOW *win) chtype blank = _nc_background(win); T(("clearing from y = %d to y = %d with maxx = %d", - win->_cury, win->_maxy, win->_maxx)); + win->_cury, win->_maxy, win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); diff --git a/lib/libcurses/base/lib_clreol.c b/lib/libcurses/base/lib_clreol.c index 29c417f5ed3..7c00cd16d5b 100644 --- a/lib/libcurses/base/lib_clreol.c +++ b/lib/libcurses/base/lib_clreol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_clreol.c,v 1.2 2000/06/19 03:53:40 millert Exp $ */ +/* $OpenBSD: lib_clreol.c,v 1.3 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_clreol.c,v 1.16 2000/04/29 21:14:54 tom Exp $") +MODULE_ID("$From: lib_clreol.c,v 1.19 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtoeol(WINDOW *win) { int code = ERR; @@ -62,7 +62,7 @@ wclrtoeol(WINDOW *win) * If we have just wrapped the cursor, the clear applies to the * new line, unless we are at the lower right corner. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 && y < win->_maxy) { win->_flags &= ~_WRAPPED; } @@ -71,7 +71,7 @@ wclrtoeol(WINDOW *win) * There's no point in clearing if we're not on a legal * position, either. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 || y > win->_maxy || x > win->_maxx) returnCode(ERR); diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c index 952698083d0..06b88fe43e5 100644 --- a/lib/libcurses/base/lib_color.c +++ b/lib/libcurses/base/lib_color.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_color.c,v 1.9 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_color.c,v 1.10 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,15 +43,17 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_color.c,v 1.53 2000/09/02 18:02:15 tom Exp $") +MODULE_ID("$From: lib_color.c,v 1.55 2000/12/10 02:43:27 tom Exp $") /* * These should be screen structure members. They need to be globals for * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ -int COLOR_PAIRS = 0; -int COLORS = 0; +NCURSES_EXPORT_VAR(int) +COLOR_PAIRS = 0; +NCURSES_EXPORT_VAR(int) +COLORS = 0; /* * Given a RGB range of 0..1000, we'll normally set the individual values @@ -92,8 +94,8 @@ static const color_t hls_palette[] = * These are called from _nc_do_color(), which in turn is called from * vidattr - so we have to assume that SP may be null. */ -static int -default_fg(void) + static int + default_fg(void) { return (SP != 0) ? SP->_default_fg : COLOR_WHITE; } @@ -113,13 +115,13 @@ default_bg(void) * to maintain compatibility with a pre-ANSI scheme. The same scheme is * also used in the FreeBSD syscons. */ -static int -toggled_colors(int c) + static int + toggled_colors(int c) { if (c < 16) { static const int table[] = {0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15}; + 8, 12, 10, 14, 9, 13, 11, 15}; c = table[c]; } return c; @@ -164,7 +166,7 @@ set_original_colors(void) return FALSE; } -int +NCURSES_EXPORT(int) start_color(void) { int n; @@ -258,8 +260,9 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s) * Extension (1997/1/18) - Allow negative f/b values to set default color * values. */ -int -init_pair(short pair, short f, short b) +NCURSES_EXPORT(int) +init_pair +(short pair, short f, short b) { unsigned result; @@ -321,24 +324,25 @@ init_pair(short pair, short f, short b) const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); if (initialize_pair) { TPUTS_TRACE("initialize_pair"); putp(tparm(initialize_pair, - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); } } returnCode(OK); } -int -init_color(short color, short r, short g, short b) +NCURSES_EXPORT(int) +init_color +(short color, short r, short g, short b) { T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); @@ -352,9 +356,9 @@ init_color(short color, short r, short g, short b) if (hue_lightness_saturation) rgb2hls(r, g, b, - &SP->_color_table[color].red, - &SP->_color_table[color].green, - &SP->_color_table[color].blue); + &SP->_color_table[color].red, + &SP->_color_table[color].green, + &SP->_color_table[color].blue); else { SP->_color_table[color].red = r; SP->_color_table[color].green = g; @@ -368,27 +372,28 @@ init_color(short color, short r, short g, short b) returnCode(OK); } -bool +NCURSES_EXPORT(bool) can_change_color(void) { T((T_CALLED("can_change_color()"))); returnCode((can_change != 0) ? TRUE : FALSE); } -bool +NCURSES_EXPORT(bool) has_colors(void) { T((T_CALLED("has_colors()"))); returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) - && (((set_foreground != NULL) - && (set_background != NULL)) - || ((set_a_foreground != NULL) - && (set_a_background != NULL)) - || set_color_pair)) ? TRUE : FALSE); + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); } -int -color_content(short color, short *r, short *g, short *b) +NCURSES_EXPORT(int) +color_content +(short color, short *r, short *g, short *b) { T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); if (color < 0 || color >= COLORS) @@ -403,8 +408,9 @@ color_content(short color, short *r, short *g, short *b) returnCode(OK); } -int -pair_content(short pair, short *f, short *b) +NCURSES_EXPORT(int) +pair_content +(short pair, short *f, short *b) { T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); @@ -418,8 +424,9 @@ pair_content(short pair, short *f, short *b) returnCode(OK); } -void -_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) +NCURSES_EXPORT(void) +_nc_do_color +(int old_pair, int pair, bool reverse, int (*outc) (int)) { NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; NCURSES_COLOR_T old_fg, old_bg; @@ -473,7 +480,8 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) bg = xx; } - TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, + fg, bg)); if (fg != C_MASK) { set_foreground_color(fg, outc); diff --git a/lib/libcurses/base/lib_colorset.c b/lib/libcurses/base/lib_colorset.c index 0c03674baab..73cd69e609c 100644 --- a/lib/libcurses/base/lib_colorset.c +++ b/lib/libcurses/base/lib_colorset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_colorset.c,v 1.3 2000/10/08 22:46:58 millert Exp $ */ +/* $OpenBSD: lib_colorset.c,v 1.4 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,10 +42,11 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_colorset.c,v 1.6 2000/07/29 16:37:19 tom Exp $") +MODULE_ID("$From: lib_colorset.c,v 1.7 2000/12/10 01:24:50 tom Exp $") -int -wcolor_set(WINDOW *win, short color_pair_number, void *opts) +NCURSES_EXPORT(int) +wcolor_set +(WINDOW *win, short color_pair_number, void *opts) { T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number)); if (win diff --git a/lib/libcurses/base/lib_delch.c b/lib/libcurses/base/lib_delch.c index 7832e20db1d..d07198c60a4 100644 --- a/lib/libcurses/base/lib_delch.c +++ b/lib/libcurses/base/lib_delch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_delch.c,v 1.1 1999/01/18 19:09:40 millert Exp $ */ +/* $OpenBSD: lib_delch.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,29 +42,30 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_delch.c,v 1.8 1998/06/28 00:28:17 tom Exp $") +MODULE_ID("$From: lib_delch.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int wdelch(WINDOW *win) +NCURSES_EXPORT(int) +wdelch(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wdelch(%p)"), win)); + T((T_CALLED("wdelch(%p)"), win)); - if (win) { - chtype blank = _nc_background(win); - struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_maxx]); - chtype *temp2 = &(line->text[win->_curx + 1]); - chtype *temp1 = temp2 - 1; + if (win) { + chtype blank = _nc_background(win); + struct ldat *line = &(win->_line[win->_cury]); + chtype *end = &(line->text[win->_maxx]); + chtype *temp2 = &(line->text[win->_curx + 1]); + chtype *temp1 = temp2 - 1; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 < end) - *temp1++ = *temp2++; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 < end) + *temp1++ = *temp2++; - *temp1 = blank; + *temp1 = blank; - _nc_synchook(win); - code = OK; - } - returnCode(code); + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_delwin.c b/lib/libcurses/base/lib_delwin.c index 0ef17261a65..5358ae94f00 100644 --- a/lib/libcurses/base/lib_delwin.c +++ b/lib/libcurses/base/lib_delwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_delwin.c,v 1.1 1999/01/18 19:09:41 millert Exp $ */ +/* $OpenBSD: lib_delwin.c,v 1.2 2001/01/22 18:01:38 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,33 +42,39 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_delwin.c,v 1.9 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$From: lib_delwin.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -static bool have_children(WINDOW *win) +static bool +cannot_delete(WINDOW *win) { - WINDOWLIST *p; - for (p = _nc_windows; p != 0; p = p->next) { - if (p->win->_flags & _SUBWIN - && p->win->_parent == win) - return TRUE; + WINDOWLIST *p; + bool result = TRUE; + + for (p = _nc_windows; p != 0; p = p->next) { + if (p->win == win) { + result = FALSE; + } else if ((p->win->_flags & _SUBWIN) != 0 + && p->win->_parent == win) { + result = TRUE; + break; } - return FALSE; + } + return result; } -int delwin(WINDOW *win) +NCURSES_EXPORT(int) +delwin(WINDOW *win) { - T((T_CALLED("delwin(%p)"), win)); - - if (win == 0 - || have_children(win)) - returnCode(ERR); + T((T_CALLED("delwin(%p)"), win)); - if (win->_flags & _SUBWIN) - touchwin(win->_parent); - else if (curscr != 0) - touchwin(curscr); + if (win == 0 + || cannot_delete(win)) + returnCode(ERR); - _nc_freewin(win); + if (win->_flags & _SUBWIN) + touchwin(win->_parent); + else if (curscr != 0) + touchwin(curscr); - returnCode(OK); + returnCode(_nc_freewin(win)); } diff --git a/lib/libcurses/base/lib_dft_fgbg.c b/lib/libcurses/base/lib_dft_fgbg.c index 3604fc151f0..45aeac0c4dd 100644 --- a/lib/libcurses/base/lib_dft_fgbg.c +++ b/lib/libcurses/base/lib_dft_fgbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_dft_fgbg.c,v 1.6 2000/07/10 03:06:12 millert Exp $ */ +/* $OpenBSD: lib_dft_fgbg.c,v 1.7 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,13 +35,13 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_dft_fgbg.c,v 1.13 2000/07/07 16:50:27 tom Exp $") +MODULE_ID("$From: lib_dft_fgbg.c,v 1.15 2000/12/10 02:43:27 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that * it is white on black. This is an extension to XSI curses. */ -int +NCURSES_EXPORT(int) use_default_colors(void) { T((T_CALLED("use_default_colors()"))); @@ -52,7 +52,7 @@ use_default_colors(void) * Modify the behavior of color-pair 0 so that the library assumes that it * is something specific, possibly not white on black. */ -int +NCURSES_EXPORT(int) assume_default_colors(int fg, int bg) { T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg)); diff --git a/lib/libcurses/base/lib_echo.c b/lib/libcurses/base/lib_echo.c index 5ca72d31a42..6f101ba3399 100644 --- a/lib/libcurses/base/lib_echo.c +++ b/lib/libcurses/base/lib_echo.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_echo.c,v 1.1 1999/01/18 19:09:42 millert Exp $ */ +/* $OpenBSD: lib_echo.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * echo.c * @@ -45,18 +44,20 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_echo.c,v 1.3 1998/10/12 13:15:33 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_echo.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int echo(void) +NCURSES_EXPORT(int) +echo(void) { - T((T_CALLED("echo()"))); - SP->_echo = TRUE; - returnCode(OK); + T((T_CALLED("echo()"))); + SP->_echo = TRUE; + returnCode(OK); } -int noecho(void) +NCURSES_EXPORT(int) +noecho(void) { - T((T_CALLED("noecho()"))); - SP->_echo = FALSE; - returnCode(OK); + T((T_CALLED("noecho()"))); + SP->_echo = FALSE; + returnCode(OK); } diff --git a/lib/libcurses/base/lib_endwin.c b/lib/libcurses/base/lib_endwin.c index 1a6614a3ebc..971bc9a06c8 100644 --- a/lib/libcurses/base/lib_endwin.c +++ b/lib/libcurses/base/lib_endwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_endwin.c,v 1.2 1999/06/14 02:29:15 millert Exp $ */ +/* $OpenBSD: lib_endwin.c,v 1.3 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -44,20 +43,20 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_endwin.c,v 1.17 1999/06/12 23:01:46 tom Exp $") +MODULE_ID("$From: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) endwin(void) { - T((T_CALLED("endwin()"))); + T((T_CALLED("endwin()"))); - if (SP) { - SP->_endwin = TRUE; - SP->_mouse_wrap(SP); - _nc_screen_wrap(); - _nc_mvcur_wrap(); /* wrap up cursor addressing */ - returnCode(reset_shell_mode()); - } + if (SP) { + SP->_endwin = TRUE; + SP->_mouse_wrap(SP); + _nc_screen_wrap(); + _nc_mvcur_wrap(); /* wrap up cursor addressing */ + returnCode(reset_shell_mode()); + } - returnCode(ERR); + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_erase.c b/lib/libcurses/base/lib_erase.c index e341ed6064e..44e51e8ce27 100644 --- a/lib/libcurses/base/lib_erase.c +++ b/lib/libcurses/base/lib_erase.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_erase.c,v 1.1 1999/01/18 19:09:42 millert Exp $ */ +/* $OpenBSD: lib_erase.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_erase.c ** @@ -43,33 +42,34 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_erase.c,v 1.11 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_erase.c,v 1.13 2000/12/10 02:43:27 tom Exp $") -int werase(WINDOW *win) +NCURSES_EXPORT(int) +werase(WINDOW *win) { -int code = ERR; -int y; -chtype blank; -chtype *sp, *end, *start; + int code = ERR; + int y; + chtype blank; + chtype *sp, *end, *start; - T((T_CALLED("werase(%p)"), win)); + T((T_CALLED("werase(%p)"), win)); - if (win) { - blank = _nc_background(win); - for (y = 0; y <= win->_maxy; y++) { + if (win) { + blank = _nc_background(win); + for (y = 0; y <= win->_maxy; y++) { start = win->_line[y].text; end = &start[win->_maxx]; - + for (sp = start; sp <= end; sp++) - *sp = blank; - + *sp = blank; + win->_line[y].firstchar = 0; win->_line[y].lastchar = win->_maxx; - } - win->_curx = win->_cury = 0; - win->_flags &= ~_WRAPPED; - _nc_synchook(win); - code = OK; } - returnCode(code); + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_flash.c b/lib/libcurses/base/lib_flash.c index df42bd6e5cf..fd4c3c07658 100644 --- a/lib/libcurses/base/lib_flash.c +++ b/lib/libcurses/base/lib_flash.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_flash.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_flash.c,v 1.3 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * flash.c * @@ -42,9 +41,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$From: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") +MODULE_ID("$From: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $") /* * flash() @@ -54,22 +53,23 @@ MODULE_ID("$From: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") * */ -int flash(void) +NCURSES_EXPORT(int) +flash(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("flash()"))); + T((T_CALLED("flash()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } else if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } else if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/lib/libcurses/base/lib_freeall.c b/lib/libcurses/base/lib_freeall.c index 116d0fcb4b7..5fc67234223 100644 --- a/lib/libcurses/base/lib_freeall.c +++ b/lib/libcurses/base/lib_freeall.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_freeall.c,v 1.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_freeall.c,v 1.4 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,10 +41,10 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$From: lib_freeall.c,v 1.16 1999/11/28 01:34:11 tom Exp $") +MODULE_ID("$From: lib_freeall.c,v 1.18 2000/12/10 02:43:27 tom Exp $") static void -free_slk(SLK *p) +free_slk(SLK * p) { if (p != 0) { FreeIfNeeded(p->ent); @@ -71,7 +71,7 @@ free_tries(struct tries *p) * Free all ncurses data. This is used for testing only (there's no practical * use for it as an extension). */ -void +NCURSES_EXPORT(void) _nc_freeall(void) { WINDOWLIST *p, *q; @@ -126,7 +126,7 @@ _nc_freeall(void) #endif } -void +NCURSES_EXPORT(void) _nc_free_and_exit(int code) { _nc_freeall(); @@ -134,7 +134,7 @@ _nc_free_and_exit(int code) } #else -void +NCURSES_EXPORT(void) _nc_freeall(void) { } diff --git a/lib/libcurses/base/lib_getch.c b/lib/libcurses/base/lib_getch.c index 97cf02ccc55..0b17a36d043 100644 --- a/lib/libcurses/base/lib_getch.c +++ b/lib/libcurses/base/lib_getch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_getch.c,v 1.9 2000/10/22 18:27:22 millert Exp $ */ +/* $OpenBSD: lib_getch.c,v 1.10 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,14 +42,15 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_getch.c,v 1.50 2000/10/09 23:53:57 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_getch.c,v 1.54 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> -int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ +NCURSES_EXPORT_VAR(int) +ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ -static inline int -fifo_peek(void) + static inline int + fifo_peek(void) { int ch = SP->_fifo[peek]; TR(TRACE_IEVENT, ("peeking at %d", peek)); @@ -82,7 +83,7 @@ static inline int fifo_push(void) { int n; - unsigned int ch; + int ch; if (tail == -1) return ERR; @@ -103,7 +104,7 @@ fifo_push(void) { unsigned char c2 = 0; n = read(SP->_ifd, &c2, 1); - ch = c2 & 0xff; + ch = CharOf(c2); } #ifdef HIDE_EINTR @@ -155,7 +156,7 @@ static int kgetch(WINDOW *); (is_wintouched(win) || (win->_flags & _HASMOVED)) \ && !(win->_flags & _ISPAD)) -int +NCURSES_EXPORT(int) wgetch(WINDOW *win) { int ch; @@ -237,8 +238,8 @@ wgetch(WINDOW *win) } } while (ch == KEY_MOUSE - && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) - || !SP->_mouse_parse(runcount))); + && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) + || !SP->_mouse_parse(runcount))); if (runcount > 0 && ch != KEY_MOUSE) { /* mouse event sequence ended by keystroke, push it */ ungetch(ch); @@ -359,7 +360,7 @@ kgetch(WINDOW *win GCC_UNUSED) TR(TRACE_IEVENT, ("ptr is null")); } else TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); + ptr, ptr->ch, ptr->value)); #endif /* TRACE */ if (ptr == NULL) diff --git a/lib/libcurses/base/lib_getstr.c b/lib/libcurses/base/lib_getstr.c index 431a60cef5c..0744f96f40e 100644 --- a/lib/libcurses/base/lib_getstr.c +++ b/lib/libcurses/base/lib_getstr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_getstr.c,v 1.1 1999/01/18 19:09:46 millert Exp $ */ +/* $OpenBSD: lib_getstr.c,v 1.2 2001/01/22 18:01:39 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_getstr.c ** @@ -44,151 +43,153 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_getstr.c,v 1.20 1998/12/20 00:16:01 tom Exp $") +MODULE_ID("$From: lib_getstr.c,v 1.23 2000/12/10 02:43:27 tom Exp $") /* * This wipes out the last character, no matter whether it was a tab, control * or other character, and handles reverse wraparound. */ -static char *WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) +static char * +WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) { - if (last > first) { - *--last = '\0'; - if (echoed) { - int y1 = win->_cury; - int x1 = win->_curx; - - wmove(win, y, x); - waddstr(win, first); - getyx(win, y, x); - while (win->_cury < y1 - || (win->_cury == y1 && win->_curx < x1)) - waddch(win, ' '); - - wmove(win, y, x); - } + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddstr(win, first); + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, (chtype) ' '); + + wmove(win, y, x); } - return last; + } + return last; } -int wgetnstr(WINDOW *win, char *str, int maxlen) +NCURSES_EXPORT(int) +wgetnstr(WINDOW *win, char *str, int maxlen) { -TTY buf; -bool oldnl, oldecho, oldraw, oldcbreak; -char erasec; -char killc; -char *oldstr; -int ch; -int y, x; + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + char erasec; + char killc; + char *oldstr; + int ch; + int y, x; - T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); + T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); - if (!win) - returnCode(ERR); + if (!win) + returnCode(ERR); - _nc_get_tty_mode(&buf); + _nc_get_tty_mode(&buf); - oldnl = SP->_nl; - oldecho = SP->_echo; - oldraw = SP->_raw; - oldcbreak = SP->_cbreak; - nl(); - noecho(); - noraw(); - cbreak(); + oldnl = SP->_nl; + oldecho = SP->_echo; + oldraw = SP->_raw; + oldcbreak = SP->_cbreak; + nl(); + noecho(); + noraw(); + cbreak(); - erasec = erasechar(); - killc = killchar(); + erasec = erasechar(); + killc = killchar(); - oldstr = str; - getyx(win, y, x); + oldstr = str; + getyx(win, y, x); - if (is_wintouched(win) || (win->_flags & _HASMOVED)) - wrefresh(win); + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); - while ((ch = wgetch(win)) != ERR) { - /* - * Some terminals (the Wyse-50 is the most common) generate - * a \n from the down-arrow key. With this logic, it's the - * user's choice whether to set kcud=\n for wgetch(); - * terminating *getstr() with \n should work either way. - */ - if (ch == '\n' - || ch == '\r' - || ch == KEY_DOWN - || ch == KEY_ENTER) { - if (oldecho == TRUE - && win->_cury == win->_maxy - && win->_scroll) - wechochar(win, '\n'); - break; - } - if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { - if (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch == killc) { - while (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch >= KEY_MIN - || (maxlen >= 0 && str - oldstr >= maxlen)) { - beep(); - } else { - *str++ = ch; - if (oldecho == TRUE) { - int oldy = win->_cury; - if (waddch(win, ch) == ERR) { - /* - * We can't really use the lower-right - * corner for input, since it'll mess - * up bookkeeping for erases. - */ - win->_flags &= ~_WRAPPED; - waddch(win, ' '); - str = WipeOut(win, y, x, oldstr, str, oldecho); - continue; - } else if (win->_flags & _WRAPPED) { - /* - * If the last waddch forced a wrap & - * scroll, adjust our reference point - * for erasures. - */ - if (win->_scroll - && oldy == win->_maxy - && win->_cury == win->_maxy) { - if (--y <= 0) { - y = 0; - } - } - win->_flags &= ~_WRAPPED; - } - wrefresh(win); + while ((ch = wgetch(win)) != ERR) { + /* + * Some terminals (the Wyse-50 is the most common) generate + * a \n from the down-arrow key. With this logic, it's the + * user's choice whether to set kcud=\n for wgetch(); + * terminating *getstr() with \n should work either way. + */ + if (ch == '\n' + || ch == '\r' + || ch == KEY_DOWN + || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, (chtype) '\n'); + break; + } + if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch == killc) { + while (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch >= KEY_MIN + || (maxlen >= 0 && str - oldstr >= maxlen)) { + beep(); + } else { + *str++ = ch; + if (oldecho == TRUE) { + int oldy = win->_cury; + if (waddch(win, (chtype) ch) == ERR) { + /* + * We can't really use the lower-right + * corner for input, since it'll mess + * up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, (chtype) ' '); + str = WipeOut(win, y, x, oldstr, str, oldecho); + continue; + } else if (win->_flags & _WRAPPED) { + /* + * If the last waddch forced a wrap & + * scroll, adjust our reference point + * for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; } + } + win->_flags &= ~_WRAPPED; } + wrefresh(win); + } } + } - win->_curx = 0; - win->_flags &= ~_WRAPPED; - if (win->_cury < win->_maxy) - win->_cury++; - wrefresh(win); + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); - /* Restore with a single I/O call, to fix minor asymmetry between - * raw/noraw, etc. - */ - SP->_nl = oldnl; - SP->_echo = oldecho; - SP->_raw = oldraw; - SP->_cbreak = oldcbreak; + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + SP->_nl = oldnl; + SP->_echo = oldecho; + SP->_raw = oldraw; + SP->_cbreak = oldcbreak; - _nc_set_tty_mode(&buf); + _nc_set_tty_mode(&buf); - *str = '\0'; - if (ch == ERR) - returnCode(ERR); + *str = '\0'; + if (ch == ERR) + returnCode(ERR); - T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + T(("wgetnstr returns %s", _nc_visbuf(oldstr))); - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_hline.c b/lib/libcurses/base/lib_hline.c index 1cb06b44664..6854c5a61a1 100644 --- a/lib/libcurses/base/lib_hline.c +++ b/lib/libcurses/base/lib_hline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_hline.c,v 1.3 2000/07/10 03:06:14 millert Exp $ */ +/* $OpenBSD: lib_hline.c,v 1.4 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_hline.c,v 1.6 2000/07/04 14:08:09 Philippe.Blain Exp $") +MODULE_ID("$From: lib_hline.c,v 1.8 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) whline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/lib/libcurses/base/lib_immedok.c b/lib/libcurses/base/lib_immedok.c index 4bd7234bef6..f5925446e8d 100644 --- a/lib/libcurses/base/lib_immedok.c +++ b/lib/libcurses/base/lib_immedok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_immedok.c,v 1.1 1999/01/18 19:09:47 millert Exp $ */ +/* $OpenBSD: lib_immedok.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_immedok.c ** @@ -43,14 +42,15 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_immedok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: lib_immedok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -void immedok(WINDOW *win, bool flag) +NCURSES_EXPORT(void) +immedok(WINDOW *win, bool flag) { - T((T_CALLED("immedok(%p,%d)"), win, flag)); + T((T_CALLED("immedok(%p,%d)"), win, flag)); - if (win) - win->_immed = flag; + if (win) + win->_immed = flag; - returnVoid; + returnVoid; } diff --git a/lib/libcurses/base/lib_inchstr.c b/lib/libcurses/base/lib_inchstr.c index ee0b93d7332..0965de4ffdb 100644 --- a/lib/libcurses/base/lib_inchstr.c +++ b/lib/libcurses/base/lib_inchstr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_inchstr.c,v 1.1 1999/01/18 19:09:48 millert Exp $ */ +/* $OpenBSD: lib_inchstr.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_inchstr.c ** @@ -43,22 +42,23 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_inchstr.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int winchnstr(WINDOW *win, chtype *str, int n) +NCURSES_EXPORT(int) +winchnstr(WINDOW *win, chtype * str, int n) { - int i = 0; + int i = 0; - T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); + T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); - if (!str) - returnCode(0); + if (!str) + returnCode(0); - if (win) { - for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) + if (win) { + for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) str[i] = win->_line[win->_cury].text[win->_curx + i]; - } - str[i] = (chtype)0; + } + str[i] = (chtype) 0; - returnCode(i); + returnCode(i); } diff --git a/lib/libcurses/base/lib_initscr.c b/lib/libcurses/base/lib_initscr.c index 8d179b4bc7e..c3fa8fecbdd 100644 --- a/lib/libcurses/base/lib_initscr.c +++ b/lib/libcurses/base/lib_initscr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_initscr.c,v 1.1 1999/01/18 19:09:48 millert Exp $ */ +/* $OpenBSD: lib_initscr.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,40 +41,41 @@ */ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H -#include <sys/termio.h> /* needed for ISC */ +#include <sys/termio.h> /* needed for ISC */ #endif -MODULE_ID("$From: lib_initscr.c,v 1.26 1998/12/19 23:10:09 tom Exp $") +MODULE_ID("$From: lib_initscr.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -WINDOW *initscr(void) +NCURSES_EXPORT(WINDOW *) +initscr(void) { -static bool initialized = FALSE; -NCURSES_CONST char *name; -int value; + static bool initialized = FALSE; + NCURSES_CONST char *name; + int value; - T((T_CALLED("initscr()"))); - /* Portable applications must not call initscr() more than once */ - if (!initialized) { - initialized = TRUE; + T((T_CALLED("initscr()"))); + /* Portable applications must not call initscr() more than once */ + if (!initialized) { + initialized = TRUE; - if ((name = getenv("TERM")) == 0 - || *name == '\0') - name = "unknown"; - if (newterm(name, stdout, stdin) == 0) { - fprintf(stderr, "Error opening terminal: %s.\n", name); - exit(EXIT_FAILURE); - } - - /* allow user to set maximum escape delay from the environment */ - if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { - ESCDELAY = value; - } + if ((name = getenv("TERM")) == 0 + || *name == '\0') + name = "unknown"; + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + exit(EXIT_FAILURE); + } - /* def_shell_mode - done in newterm/_nc_setupscreen */ - def_prog_mode(); + /* allow user to set maximum escape delay from the environment */ + if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { + ESCDELAY = value; } - returnWin(stdscr); + + /* def_shell_mode - done in newterm/_nc_setupscreen */ + def_prog_mode(); + } + returnWin(stdscr); } diff --git a/lib/libcurses/base/lib_insch.c b/lib/libcurses/base/lib_insch.c index dae6ce048ea..5d6ef421df9 100644 --- a/lib/libcurses/base/lib_insch.c +++ b/lib/libcurses/base/lib_insch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_insch.c,v 1.1 1999/01/18 19:09:49 millert Exp $ */ +/* $OpenBSD: lib_insch.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_insch.c ** @@ -44,26 +42,27 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_insch.c,v 1.10 1998/06/28 00:26:52 tom Exp $") +MODULE_ID("$From: lib_insch.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -int winsch(WINDOW *win, chtype c) +NCURSES_EXPORT(int) +winsch(WINDOW *win, chtype c) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); + T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); - if (win) { - struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_curx]); - chtype *temp1 = &(line->text[win->_maxx]); - chtype *temp2 = temp1 - 1; + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + chtype *end = &(line->text[win->_curx]); + chtype *temp1 = &(line->text[win->_maxx]); + chtype *temp2 = temp1 - 1; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 > end) - *temp1-- = *temp2--; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; - *temp1 = _nc_render(win, c); - code = OK; - } - returnCode(code); + *temp1 = _nc_render(win, c); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_insdel.c b/lib/libcurses/base/lib_insdel.c index 51dcc51124e..9c02cfda019 100644 --- a/lib/libcurses/base/lib_insdel.c +++ b/lib/libcurses/base/lib_insdel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_insdel.c,v 1.1 1999/01/18 19:09:49 millert Exp $ */ +/* $OpenBSD: lib_insdel.c,v 1.2 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** - * 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 * @@ -44,21 +44,22 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_insdel.c,v 1.8 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_insdel.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsdelln(WINDOW *win, int n) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsdel(%p,%d)"), win, n)); + T((T_CALLED("winsdel(%p,%d)"), win, n)); - if (win) { - if (n != 0) { - _nc_scroll_window(win, -n, win->_cury, win->_maxy, _nc_background(win)); + if (win) { + if (n != 0) { + _nc_scroll_window(win, -n, win->_cury, win->_maxy, + _nc_background(win)); _nc_synchook(win); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } diff --git a/lib/libcurses/base/lib_insstr.c b/lib/libcurses/base/lib_insstr.c index 69b1777f172..20ed15f9f60 100644 --- a/lib/libcurses/base/lib_insstr.c +++ b/lib/libcurses/base/lib_insstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_insstr.c,v 1.3 2000/06/19 03:53:42 millert Exp $ */ +/* $OpenBSD: lib_insstr.c,v 1.4 2001/01/22 18:01:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,9 +43,9 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $") +MODULE_ID("$From: lib_insstr.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) { int code = ERR; @@ -64,7 +64,7 @@ winsnstr(WINDOW *win, const char *s, int n) _nc_waddch_nosync(win, (chtype) (*cp)); else if (is7bits(*cp) && iscntrl(*cp)) { winsch(win, ' ' + (chtype) (*cp)); - winsch(win, '^'); + winsch(win, (chtype) '^'); win->_curx += 2; } else { winsch(win, (chtype) (*cp)); diff --git a/lib/libcurses/base/lib_instr.c b/lib/libcurses/base/lib_instr.c index 78127c403df..8977e40484a 100644 --- a/lib/libcurses/base/lib_instr.c +++ b/lib/libcurses/base/lib_instr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_instr.c,v 1.1 1999/01/18 19:09:50 millert Exp $ */ +/* $OpenBSD: lib_instr.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_instr.c ** @@ -43,33 +42,33 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_instr.c,v 1.8 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_instr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int winnstr(WINDOW *win, char *str, int n) +NCURSES_EXPORT(int) +winnstr(WINDOW *win, char *str, int n) { - int i=0, row, col; + int i = 0, row, col; + + T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); - T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); + if (!str) + returnCode(0); - if (!str) - returnCode(0); - - if (win) { - getyx(win, row, col); + if (win) { + getyx(win, row, col); - if (n < 0) + if (n < 0) n = win->_maxx - win->_curx + 1; - for (; i < n;) { + for (; i < n;) { str[i++] = TextOf(win->_line[row].text[col]); if (++col > win->_maxx) { - col = 0; - if (++row > win->_maxy) - break; + col = 0; + if (++row > win->_maxy) + break; } - } } - str[i] = '\0'; /* SVr4 does not seem to count the null */ - returnCode(i); + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + returnCode(i); } - diff --git a/lib/libcurses/base/lib_isendwin.c b/lib/libcurses/base/lib_isendwin.c index 093bf9311f2..55495476584 100644 --- a/lib/libcurses/base/lib_isendwin.c +++ b/lib/libcurses/base/lib_isendwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_isendwin.c,v 1.1 1999/01/18 19:09:51 millert Exp $ */ +/* $OpenBSD: lib_isendwin.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -43,11 +42,12 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_isendwin.c,v 1.4 1998/04/11 22:52:32 tom Exp $") +MODULE_ID("$From: lib_isendwin.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -bool isendwin(void) +NCURSES_EXPORT(bool) +isendwin(void) { - if (SP == NULL) - return FALSE; - return SP->_endwin; + if (SP == NULL) + return FALSE; + return SP->_endwin; } diff --git a/lib/libcurses/base/lib_leaveok.c b/lib/libcurses/base/lib_leaveok.c index f89eb5eb35b..a496d226c42 100644 --- a/lib/libcurses/base/lib_leaveok.c +++ b/lib/libcurses/base/lib_leaveok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_leaveok.c,v 1.1 1999/01/18 19:09:51 millert Exp $ */ +/* $OpenBSD: lib_leaveok.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_leaveok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_leaveok.c,v 1.3 1998/03/21 22:54:20 jtc Exp $") +MODULE_ID("$From: lib_leaveok.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int leaveok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +leaveok(WINDOW *win, bool flag) { - T((T_CALLED("leaveok(%p,%d)"), win, flag)); + T((T_CALLED("leaveok(%p,%d)"), win, flag)); - if (win) { - win->_leaveok = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_leaveok = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c index 28546dc0853..a6108e32517 100644 --- a/lib/libcurses/base/lib_mouse.c +++ b/lib/libcurses/base/lib_mouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mouse.c,v 1.12 2000/10/22 18:27:22 millert Exp $ */ +/* $OpenBSD: lib_mouse.c,v 1.13 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -86,7 +86,7 @@ #endif #endif -MODULE_ID("$From: lib_mouse.c,v 1.55 2000/10/10 00:07:28 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_mouse.c,v 1.57 2000/12/10 02:43:27 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -867,7 +867,7 @@ _nc_mouse_resume(SCREEN * sp GCC_UNUSED) * **************************************************************************/ -int +NCURSES_EXPORT(int) getmouse(MEVENT * aevent) /* grab a copy of the current mouse event */ { @@ -890,7 +890,7 @@ getmouse(MEVENT * aevent) returnCode(ERR); } -int +NCURSES_EXPORT(int) ungetmouse(MEVENT * aevent) /* enqueue a synthesized mouse event to be seen by the next wgetch() */ { @@ -904,7 +904,7 @@ ungetmouse(MEVENT * aevent) return ungetch(KEY_MOUSE); } -mmask_t +NCURSES_EXPORT(mmask_t) mousemask(mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { @@ -937,7 +937,7 @@ mousemask(mmask_t newmask, mmask_t * oldmask) returnCode(result); } -bool +NCURSES_EXPORT(bool) wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { @@ -951,7 +951,7 @@ wenclose(const WINDOW *win, int y, int x) return FALSE; } -int +NCURSES_EXPORT(int) mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { @@ -970,14 +970,15 @@ mouseinterval(int maxclick) /* This may be used by other routines to ask for the existence of mouse support */ -int +NCURSES_EXPORT(int) _nc_has_mouse(void) { return (mousetype == M_NONE ? 0 : 1); } -bool -wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) +NCURSES_EXPORT(bool) +wmouse_trafo +(const WINDOW *win, int *pY, int *pX, bool to_screen) { bool result = FALSE; diff --git a/lib/libcurses/base/lib_move.c b/lib/libcurses/base/lib_move.c index ce700863e59..629dacbd719 100644 --- a/lib/libcurses/base/lib_move.c +++ b/lib/libcurses/base/lib_move.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_move.c,v 1.2 2000/06/19 03:53:43 millert Exp $ */ +/* $OpenBSD: lib_move.c,v 1.3 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_move.c,v 1.9 2000/04/29 21:11:19 tom Exp $") +MODULE_ID("$From: lib_move.c,v 1.11 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wmove(WINDOW *win, int y, int x) { T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); diff --git a/lib/libcurses/base/lib_mvwin.c b/lib/libcurses/base/lib_mvwin.c index b41bea721be..dbd28576f1b 100644 --- a/lib/libcurses/base/lib_mvwin.c +++ b/lib/libcurses/base/lib_mvwin.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_mvwin.c,v 1.1 1999/01/18 19:09:53 millert Exp $ */ +/* $OpenBSD: lib_mvwin.c,v 1.2 2001/01/22 18:01:41 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_mvwin.c ** @@ -44,68 +42,68 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_mvwin.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$From: lib_mvwin.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int mvwin(WINDOW *win, int by, int bx) +NCURSES_EXPORT(int) +mvwin(WINDOW *win, int by, int bx) { - T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); + T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); - if (!win || (win->_flags & _ISPAD)) - returnCode(ERR); + if (!win || (win->_flags & _ISPAD)) + returnCode(ERR); - /* Copying subwindows is allowed, but it is expensive... */ - if (win->_flags & _SUBWIN) { - int err = ERR; - WINDOW *parent = win->_parent; - if (parent) - { /* Now comes the complicated and costly part, you should really - * try to avoid to move subwindows. Because a subwindow shares - * the text buffers with its parent, one can't do a simple - * memmove of the text buffers. One has to create a copy, then - * to relocate the subwindow and then to do a copy. - */ - if ((by - parent->_begy == win->_pary) && - (bx - parent->_begx == win->_parx)) - err=OK; /* we don't actually move */ - else { - WINDOW* clone = dupwin(win); + /* Copying subwindows is allowed, but it is expensive... */ + if (win->_flags & _SUBWIN) { + int err = ERR; + WINDOW *parent = win->_parent; + if (parent) { /* Now comes the complicated and costly part, you should really + * try to avoid to move subwindows. Because a subwindow shares + * the text buffers with its parent, one can't do a simple + * memmove of the text buffers. One has to create a copy, then + * to relocate the subwindow and then to do a copy. + */ + if ((by - parent->_begy == win->_pary) && + (bx - parent->_begx == win->_parx)) + err = OK; /* we don't actually move */ + else { + WINDOW *clone = dupwin(win); if (clone) { - /* now we have the clone, so relocate win */ - - werase(win); /* Erase the original place */ - wbkgd(win,parent->_bkgd);/* fill with parents background */ - wsyncup(win); /* Tell the parent(s) */ - - err = mvderwin(win, - by - parent->_begy, - bx - parent->_begx); - if (err!=ERR) { - err = copywin(clone,win, - 0, 0, 0, 0, win->_maxy, win->_maxx, 0); - if (ERR!=err) - wsyncup(win); - } - if (ERR==delwin(clone)) - err=ERR; + /* now we have the clone, so relocate win */ + + werase(win); /* Erase the original place */ + wbkgd(win, parent->_bkgd); /* fill with parents background */ + wsyncup(win); /* Tell the parent(s) */ + + err = mvderwin(win, + by - parent->_begy, + bx - parent->_begx); + if (err != ERR) { + err = copywin(clone, win, + 0, 0, 0, 0, win->_maxy, win->_maxx, 0); + if (ERR != err) + wsyncup(win); + } + if (ERR == delwin(clone)) + err = ERR; } - } } - returnCode(err); } + returnCode(err); + } - if (by + win->_maxy > screen_lines - 1 - || bx + win->_maxx > screen_columns - 1 - || by < 0 - || bx < 0) - returnCode(ERR); + if (by + win->_maxy > screen_lines - 1 + || bx + win->_maxx > screen_columns - 1 + || by < 0 + || bx < 0) + returnCode(ERR); - /* - * Whether or not the window is moved, touch the window's contents so - * that a following call to 'wrefresh()' will paint the window at the - * new location. This ensures that if the caller has refreshed another - * window at the same location, that this one will be displayed. - */ - win->_begy = by; - win->_begx = bx; - returnCode(touchwin(win)); + /* + * Whether or not the window is moved, touch the window's contents so + * that a following call to 'wrefresh()' will paint the window at the + * new location. This ensures that if the caller has refreshed another + * window at the same location, that this one will be displayed. + */ + win->_begy = by; + win->_begx = bx; + returnCode(touchwin(win)); } diff --git a/lib/libcurses/base/lib_newterm.c b/lib/libcurses/base/lib_newterm.c index 2dbe3e87230..0dc1f85592d 100644 --- a/lib/libcurses/base/lib_newterm.c +++ b/lib/libcurses/base/lib_newterm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_newterm.c,v 1.11 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_newterm.c,v 1.12 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #include <term.h> /* clear_screen, cup & friends, cur_term */ #include <tic.h> -MODULE_ID("$From: lib_newterm.c,v 1.48 2000/09/02 18:11:42 tom Exp $") +MODULE_ID("$From: lib_newterm.c,v 1.50 2000/12/10 02:43:27 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -88,14 +88,15 @@ _nc_initscr(void) */ static int filter_mode = FALSE; -void +NCURSES_EXPORT(void) filter(void) { filter_mode = TRUE; } -SCREEN * -newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) +NCURSES_EXPORT(SCREEN *) +newterm +(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) { int errret; int slk_format = _nc_slk_format; @@ -140,7 +141,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) if (num_labels <= 0 || !SLK_STDFMT(slk_format)) if (slk_format) { if (ERR == _nc_ripoffline(-SLK_LINES(slk_format), - _nc_slk_initialize)) + _nc_slk_initialize)) return 0; } /* this actually allocates the screen structure, and saves the @@ -162,7 +163,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) typeahead(fileno(ifp)); #ifdef TERMIOS SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && - !(cur_term->Ottyb.c_iflag & ISTRIP)); + !(cur_term->Ottyb.c_iflag & ISTRIP)); #else SP->_use_meta = FALSE; #endif @@ -173,8 +174,8 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) * will be useless. */ SP->_scrolling = ((scroll_forward && scroll_reverse) || - ((parm_rindex || parm_insert_line || insert_line) && - (parm_index || parm_delete_line || delete_line))); + ((parm_rindex || parm_insert_line || insert_line) && + (parm_index || parm_delete_line || delete_line))); baudrate(); /* sets a field in the SP structure */ diff --git a/lib/libcurses/base/lib_newwin.c b/lib/libcurses/base/lib_newwin.c index e7d2def4ebf..d8d4536b651 100644 --- a/lib/libcurses/base/lib_newwin.c +++ b/lib/libcurses/base/lib_newwin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_newwin.c,v 1.3 2000/06/19 03:53:43 millert Exp $ */ +/* $OpenBSD: lib_newwin.c,v 1.4 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,13 +42,14 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_newwin.c,v 1.24 2000/04/29 18:49:51 tom Exp $") +MODULE_ID("$From: lib_newwin.c,v 1.27 2000/12/10 02:43:27 tom Exp $") -void +NCURSES_EXPORT(int) _nc_freewin(WINDOW *win) { WINDOWLIST *p, *q; int i; + int result = ERR; if (win != 0) { for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { @@ -73,15 +74,18 @@ _nc_freewin(WINDOW *win) if (win == newscr) newscr = 0; + result = OK; T(("...deleted win=%p", win)); break; } } } + return result; } -WINDOW * -newwin(int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +newwin +(int num_lines, int num_columns, int begy, int begx) { WINDOW *win; chtype *ptr; @@ -106,11 +110,11 @@ newwin(int num_lines, int num_columns, int begy, int begx) for (i = 0; i < num_lines; i++) { win->_line[i].text = typeCalloc(chtype, (unsigned) num_columns); if (win->_line[i].text == 0) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + - num_columns;) + num_columns;) *ptr++ = ' '; } @@ -119,15 +123,16 @@ newwin(int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +derwin +(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { WINDOW *win; int i; int flags = _SUBWIN; T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, - begy, begx)); + begy, begx)); /* ** make sure window fits inside the original one @@ -148,7 +153,7 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) flags |= _ISPAD; if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, - orig->_begx + begx, flags)) == 0) + orig->_begx + begx, flags)) == 0) returnWin(0); win->_pary = begy; @@ -166,8 +171,9 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -subwin(WINDOW *w, int l, int c, int y, int x) +NCURSES_EXPORT(WINDOW *) +subwin +(WINDOW *w, int l, int c, int y, int x) { T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); @@ -182,8 +188,9 @@ dimension_limit(int value) return (test == value && value > 0); } -WINDOW * -_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) +NCURSES_EXPORT(WINDOW *) +_nc_makenew +(int num_lines, int num_columns, int begy, int begx, int flags) { int i; WINDOWLIST *wp; @@ -218,8 +225,8 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) win->_attrs = A_NORMAL; win->_bkgd = BLANK; - win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns - == screen_columns); + win->_clear = is_pad ? FALSE : (num_lines == screen_lines + && num_columns == screen_columns); win->_idlok = FALSE; win->_idcok = TRUE; win->_scroll = FALSE; diff --git a/lib/libcurses/base/lib_nl.c b/lib/libcurses/base/lib_nl.c index 9e089cb9216..b24cb3ec14e 100644 --- a/lib/libcurses/base/lib_nl.c +++ b/lib/libcurses/base/lib_nl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_nl.c,v 1.4 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_nl.c,v 1.5 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -44,13 +44,13 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_nl.c,v 1.6 2000/02/13 00:59:39 tom Exp $") +MODULE_ID("$From: lib_nl.c,v 1.8 2000/12/10 02:43:27 tom Exp $") #ifdef __EMX__ #include <io.h> #endif -int +NCURSES_EXPORT(int) nl(void) { T((T_CALLED("nl()"))); @@ -65,7 +65,7 @@ nl(void) returnCode(OK); } -int +NCURSES_EXPORT(int) nonl(void) { T((T_CALLED("nonl()"))); diff --git a/lib/libcurses/base/lib_overlay.c b/lib/libcurses/base/lib_overlay.c index 87fa1bd2ee3..7e3c169f08c 100644 --- a/lib/libcurses/base/lib_overlay.c +++ b/lib/libcurses/base/lib_overlay.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_overlay.c,v 1.1 1999/01/18 19:09:55 millert Exp $ */ +/* $OpenBSD: lib_overlay.c,v 1.2 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_overlay.c ** @@ -43,29 +42,30 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_overlay.c,v 1.12 1998/02/11 12:13:59 tom Exp $") +MODULE_ID("$From: lib_overlay.c,v 1.14 2000/12/10 02:43:27 tom Exp $") -static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) +static int +overlap(const WINDOW *const s, WINDOW *const d, int const flag) { -int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; - - T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", - s->_begy, s->_begx, s->_maxy, s->_maxx, - d->_begy, d->_begx, d->_maxy, d->_maxx)); - - if (!s || !d) - returnCode(ERR); - - sminrow = max(s->_begy, d->_begy) - s->_begy; - smincol = max(s->_begx, d->_begx) - s->_begx; - dminrow = max(s->_begy, d->_begy) - d->_begy; - dmincol = max(s->_begx, d->_begx) - d->_begx; - dmaxrow = min(s->_maxy+s->_begy, d->_maxy+d->_begy) - d->_begy; - dmaxcol = min(s->_maxx+s->_begx, d->_maxx+d->_begx) - d->_begx; - - return(copywin(s, d, - sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, - flag)); + int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; + + T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", + s->_begy, s->_begx, s->_maxy, s->_maxx, + d->_begy, d->_begx, d->_maxy, d->_maxx)); + + if (!s || !d) + returnCode(ERR); + + sminrow = max(s->_begy, d->_begy) - s->_begy; + smincol = max(s->_begx, d->_begx) - s->_begx; + dminrow = max(s->_begy, d->_begy) - d->_begy; + dmincol = max(s->_begx, d->_begx) - d->_begx; + dmaxrow = min(s->_maxy + s->_begy, d->_maxy + d->_begy) - d->_begy; + dmaxcol = min(s->_maxx + s->_begx, d->_maxx + d->_begx) - d->_begx; + + return (copywin(s, d, + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, + flag)); } /* @@ -78,10 +78,11 @@ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; ** **/ -int overlay(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overlay(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overlay(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, TRUE)); + T((T_CALLED("overlay(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, TRUE)); } /* @@ -94,70 +95,67 @@ int overlay(const WINDOW *win1, WINDOW *win2) ** **/ -int overwrite(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overwrite(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overwrite(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, FALSE)); + T((T_CALLED("overwrite(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, FALSE)); } -int copywin(const WINDOW *src, WINDOW *dst, - int sminrow, int smincol, - int dminrow, int dmincol, int dmaxrow, int dmaxcol, - int over) +NCURSES_EXPORT(int) +copywin +(const WINDOW *src, WINDOW *dst, + int sminrow, int smincol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, + int over) { -int sx, sy, dx, dy; -bool touched; -chtype bk = AttrOf(dst->_bkgd); -chtype mask = ~(chtype)((bk&A_COLOR) ? A_COLOR : 0); - - T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), - src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); - - if (!src || !dst) - returnCode(ERR); - - /* make sure rectangle exists in source */ - if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || - (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { - returnCode(ERR); - } - - T(("rectangle exists in source")); - - /* make sure rectangle fits in destination */ - if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { - returnCode(ERR); + int sx, sy, dx, dy; + bool touched; + chtype bk = AttrOf(dst->_bkgd); + chtype mask = ~(chtype) ((bk & A_COLOR) ? A_COLOR : 0); + + T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), + src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); + + if (!src || !dst) + returnCode(ERR); + + /* make sure rectangle exists in source */ + if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || + (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { + returnCode(ERR); + } + + T(("rectangle exists in source")); + + /* make sure rectangle fits in destination */ + if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { + returnCode(ERR); + } + + T(("rectangle fits in destination")); + + for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { + touched = FALSE; + for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) { + if (over) { + if ((TextOf(src->_line[sy].text[sx]) != ' ') && + (dst->_line[dy].text[dx] != src->_line[sy].text[sx])) { + dst->_line[dy].text[dx] = + (src->_line[sy].text[sx] & mask) | bk; + touched = TRUE; + } + } else { + if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + touched = TRUE; + } + } } - - T(("rectangle fits in destination")); - - for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { - touched = FALSE; - for(dx=dmincol, sx=smincol; dx <= dmaxcol; sx++, dx++) - { - if (over) - { - if ((TextOf(src->_line[sy].text[sx]) != ' ') && - (dst->_line[dy].text[dx]!=src->_line[sy].text[sx])) - { - dst->_line[dy].text[dx] = - (src->_line[sy].text[sx] & mask) | bk; - touched = TRUE; - } - } - else { - if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) - { - dst->_line[dy].text[dx] = src->_line[sy].text[sx]; - touched = TRUE; - } - } - } - if (touched) - { - touchline(dst,0,getmaxy(dst)); - } + if (touched) { + touchline(dst, 0, getmaxy(dst)); } - T(("finished copywin")); - returnCode(OK); + } + T(("finished copywin")); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_pad.c b/lib/libcurses/base/lib_pad.c index 5289ef67cc5..f53f6a0f2a6 100644 --- a/lib/libcurses/base/lib_pad.c +++ b/lib/libcurses/base/lib_pad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_pad.c,v 1.3 2000/06/19 03:53:44 millert Exp $ */ +/* $OpenBSD: lib_pad.c,v 1.4 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_pad.c,v 1.29 2000/04/29 21:19:44 tom Exp $") +MODULE_ID("$From: lib_pad.c,v 1.32 2000/12/10 02:43:27 tom Exp $") -WINDOW * +NCURSES_EXPORT(WINDOW *) newpad(int l, int c) { WINDOW *win; @@ -62,7 +62,7 @@ newpad(int l, int c) for (i = 0; i < l; i++) { if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); if ((win->_line[i].text = typeCalloc(chtype, ((size_t) c))) == 0) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + c;) @@ -72,8 +72,9 @@ newpad(int l, int c) returnWin(win); } -WINDOW * -subpad(WINDOW *orig, int l, int c, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +subpad +(WINDOW *orig, int l, int c, int begy, int begx) { WINDOW *win = (WINDOW *) 0; @@ -87,33 +88,38 @@ subpad(WINDOW *orig, int l, int c, int begy, int begx) returnWin(win); } -int -prefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +prefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { T((T_CALLED("prefresh()"))); if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, - smaxcol) != ERR + smaxcol) != ERR && doupdate() != ERR) { returnCode(OK); } returnCode(ERR); } -int -pnoutrefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +pnoutrefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { - const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T i, j; NCURSES_SIZE_T m, n; NCURSES_SIZE_T pmaxrow; NCURSES_SIZE_T pmaxcol; + +#if USE_SCROLL_HINTS + const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T displaced; bool wide; +#endif T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), - win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); if (win == 0) returnCode(ERR); @@ -157,12 +163,14 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, T(("pad being refreshed")); +#if USE_SCROLL_HINTS if (win->_pad._pad_y >= 0) { displaced = pminrow - win->_pad._pad_y - (sminrow - win->_pad._pad_top); T(("pad being shifted by %d line(s)", displaced)); } else displaced = 0; +#endif /* * For pure efficiency, we'd want to transfer scrolling information @@ -178,11 +186,13 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, * windows). Note that changing this formula will not break any code, * merely change the costs of various update cases. */ +#if USE_SCROLL_HINTS wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); +#endif for (i = pminrow, m = sminrow + win->_yoffset; - i <= pmaxrow && m <= newscr->_maxy; - i++, m++) { + i <= pmaxrow && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; @@ -229,7 +239,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) win->_line[i].oldindex = _NEWINDEX; for (i = pmaxrow + 1; (i <= win->_maxy) - && (win->_line[i].oldindex >= 0); i++) + && (win->_line[i].oldindex >= 0); i++) win->_line[i].oldindex = _NEWINDEX; #endif @@ -271,7 +281,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, returnCode(OK); } -int +NCURSES_EXPORT(int) pechochar(WINDOW *pad, const chtype ch) { T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); @@ -284,11 +294,11 @@ pechochar(WINDOW *pad, const chtype ch) waddch(pad, ch); prefresh(pad, pad->_pad._pad_y, - pad->_pad._pad_x, - pad->_pad._pad_top, - pad->_pad._pad_left, - pad->_pad._pad_bottom, - pad->_pad._pad_right); + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); returnCode(OK); } diff --git a/lib/libcurses/base/lib_printw.c b/lib/libcurses/base/lib_printw.c index 0b1380ce5df..3a567584b0e 100644 --- a/lib/libcurses/base/lib_printw.c +++ b/lib/libcurses/base/lib_printw.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_printw.c,v 1.1 1999/01/18 19:09:56 millert Exp $ */ +/* $OpenBSD: lib_printw.c,v 1.2 2001/01/22 18:01:42 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,72 +41,79 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_printw.c,v 1.7 1998/04/11 22:53:44 tom Exp $") +MODULE_ID("$From: lib_printw.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int printw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +printw(NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("printw(%s,...) called", _nc_visbuf(fmt))); + T(("printw(%s,...) called", _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); - return code; + return code; } -int wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wprintw(WINDOW *win, NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); + T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); - return code; + return code; } -int mvprintw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvprintw(int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = move(y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = move(y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); + } + return code; } -int mvwprintw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwprintw +(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = wmove(win, y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = wmove(win, y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); + } + return code; } -int vwprintw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwprintw +(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { - char *buf = _nc_printf_string(fmt, argp); - int code = ERR; + char *buf = _nc_printf_string(fmt, argp); + int code = ERR; - if (buf != 0) { - code = waddstr(win, buf); + if (buf != 0) { + code = waddstr(win, buf); #if USE_SAFE_SPRINTF - free(buf); + free(buf); #endif - } - return code; + } + return code; } diff --git a/lib/libcurses/base/lib_redrawln.c b/lib/libcurses/base/lib_redrawln.c index 51a22c3d8f1..82ce92b216b 100644 --- a/lib/libcurses/base/lib_redrawln.c +++ b/lib/libcurses/base/lib_redrawln.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_redrawln.c,v 1.1 1999/01/18 19:09:57 millert Exp $ */ +/* $OpenBSD: lib_redrawln.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,31 +41,31 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_redrawln.c,v 1.7 1998/09/19 20:09:50 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_redrawln.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int wredrawln(WINDOW *win, int beg, int num) +NCURSES_EXPORT(int) +wredrawln(WINDOW *win, int beg, int num) { - int i; - int end; - size_t len = (win->_maxx + 1) * sizeof(chtype); + int i; + int end; + size_t len = (win->_maxx + 1) * sizeof(chtype); - T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); + T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); - if (beg < 0) - beg = 0; + if (beg < 0) + beg = 0; - if (touchline (win, beg, num) == ERR) - returnCode(ERR); + if (touchline(win, beg, num) == ERR) + returnCode(ERR); - end = beg + num; - if (end > win->_maxy + 1) - end = win->_maxy + 1; + end = beg + num; + if (end > win->_maxy + 1) + end = win->_maxy + 1; - for (i = beg; i < end; i++) - { - memset (curscr->_line[i+win->_begy].text+win->_begx, 0, len); - _nc_make_oldhash(i+win->_begy); - } + for (i = beg; i < end; i++) { + memset(curscr->_line[i + win->_begy].text + win->_begx, 0, len); + _nc_make_oldhash(i + win->_begy); + } - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_refresh.c b/lib/libcurses/base/lib_refresh.c index 4ae172db5f7..d3d65e7434a 100644 --- a/lib/libcurses/base/lib_refresh.c +++ b/lib/libcurses/base/lib_refresh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_refresh.c,v 1.3 2000/06/19 03:53:44 millert Exp $ */ +/* $OpenBSD: lib_refresh.c,v 1.4 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_refresh.c,v 1.25 2000/04/29 21:17:08 tom Exp $") +MODULE_ID("$From: lib_refresh.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wrefresh(WINDOW *win) { int code; @@ -69,7 +69,7 @@ wrefresh(WINDOW *win) returnCode(code); } -int +NCURSES_EXPORT(int) wnoutrefresh(WINDOW *win) { NCURSES_SIZE_T limit_x; @@ -77,7 +77,9 @@ wnoutrefresh(WINDOW *win) NCURSES_SIZE_T begx; NCURSES_SIZE_T begy; NCURSES_SIZE_T m, n; +#if USE_SCROLL_HINTS bool wide; +#endif T((T_CALLED("wnoutrefresh(%p)"), win)); #ifdef TRACE @@ -102,6 +104,7 @@ wnoutrefresh(WINDOW *win) /* merge in change information from all subwindows of this window */ wsyncdown(win); +#if USE_SCROLL_HINTS /* * For pure efficiency, we'd want to transfer scrolling information * from the window to newscr whenever the window is wide enough that @@ -117,6 +120,7 @@ wnoutrefresh(WINDOW *win) * merely change the costs of various update cases. */ wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); +#endif win->_flags &= ~_HASMOVED; @@ -134,8 +138,8 @@ wnoutrefresh(WINDOW *win) limit_x = win->_maxx; for (i = 0, m = begy + win->_yoffset; - i <= win->_maxy && m <= newscr->_maxy; - i++, m++) { + i <= win->_maxy && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; diff --git a/lib/libcurses/base/lib_restart.c b/lib/libcurses/base/lib_restart.c index c77edbeb067..c7a2797b7d1 100644 --- a/lib/libcurses/base/lib_restart.c +++ b/lib/libcurses/base/lib_restart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_restart.c,v 1.3 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_restart.c,v 1.4 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -49,10 +49,11 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$From: lib_restart.c,v 1.3 2000/09/02 18:09:44 tom Exp $") +MODULE_ID("$From: lib_restart.c,v 1.4 2000/12/10 01:26:52 tom Exp $") -int -restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +NCURSES_EXPORT(int) +restartterm +(NCURSES_CONST char *termp, int filenum, int *errret) { int saveecho = SP->_echo; int savecbreak = SP->_cbreak; diff --git a/lib/libcurses/base/lib_scanw.c b/lib/libcurses/base/lib_scanw.c index abf6154786d..057f57adee0 100644 --- a/lib/libcurses/base/lib_scanw.c +++ b/lib/libcurses/base/lib_scanw.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_scanw.c,v 1.1 1999/01/18 19:09:58 millert Exp $ */ +/* $OpenBSD: lib_scanw.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_scanw.c ** @@ -44,70 +42,75 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scanw.c,v 1.8 1998/04/11 22:54:18 tom Exp $") +MODULE_ID("$From: lib_scanw.c,v 1.10 2000/12/10 02:43:27 tom Exp $") #if !HAVE_VSSCANF #if defined(__QNX__) extern int vsscanf(const char *str, const char *format, __va_list __arg); #else -extern int vsscanf(const char *str, const char *format, ...); +extern int vsscanf(const char *str, const char *format,...); #endif #endif -int vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { -char buf[BUFSIZ]; + char buf[BUFSIZ]; - if (wgetnstr(win, buf, sizeof(buf)-1) == ERR) - return(ERR); + if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR) + return (ERR); - return(vsscanf(buf, fmt, argp)); + return (vsscanf(buf, fmt, argp)); } -int scanw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +scanw(NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("scanw(\"%s\",...) called", fmt)); + T(("scanw(\"%s\",...) called", fmt)); - va_start(ap, fmt); - code = vwscanw(stdscr, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(stdscr, fmt, ap); + va_end(ap); + return (code); } -int wscanw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wscanw(WINDOW *win, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("wscanw(%p,\"%s\",...) called", win, fmt)); + T(("wscanw(%p,\"%s\",...) called", win, fmt)); - va_start(ap, fmt); - code = vwscanw(win, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(win, fmt, ap); + va_end(ap); + return (code); } -int mvscanw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvscanw(int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; + va_end(ap); + return (code); } -int mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; + va_end(ap); + return (code); } diff --git a/lib/libcurses/base/lib_screen.c b/lib/libcurses/base/lib_screen.c index e7f3a3a9fd7..8f7f830a708 100644 --- a/lib/libcurses/base/lib_screen.c +++ b/lib/libcurses/base/lib_screen.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_screen.c,v 1.2 1999/08/15 11:40:55 millert Exp $ */ +/* $OpenBSD: lib_screen.c,v 1.3 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,166 +33,164 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <sys/stat.h> #include <time.h> -#include <term.h> /* exit_ca_mode, non_rev_rmcup */ +#include <term.h> /* exit_ca_mode, non_rev_rmcup */ -MODULE_ID("$From: lib_screen.c,v 1.15 1999/07/24 20:05:29 tom Exp $") +MODULE_ID("$From: lib_screen.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -static time_t dumptime; +static time_t dumptime; -WINDOW *getwin(FILE *filep) +NCURSES_EXPORT(WINDOW *) +getwin(FILE * filep) { - WINDOW tmp, *nwin; - int n; - - T((T_CALLED("getwin(%p)"), filep)); - - (void) fread(&tmp, sizeof(WINDOW), 1, filep); - if (ferror(filep)) - returnWin(0); - - if ((nwin = newwin(tmp._maxy+1, tmp._maxx+1, 0, 0)) == 0) - returnWin(0); - - /* - * We deliberately do not restore the _parx, _pary, or _parent - * fields, because the window hierarchy within which they - * made sense is probably gone. - */ - nwin->_curx = tmp._curx; - nwin->_cury = tmp._cury; - nwin->_maxy = tmp._maxy; - nwin->_maxx = tmp._maxx; - nwin->_begy = tmp._begy; - nwin->_begx = tmp._begx; - nwin->_yoffset = tmp._yoffset; - nwin->_flags = tmp._flags & ~(_SUBWIN|_ISPAD); - - nwin->_attrs = tmp._attrs; - nwin->_bkgd = tmp._bkgd; - - nwin->_clear = tmp._clear; - nwin->_scroll = tmp._scroll; - nwin->_leaveok = tmp._leaveok; - nwin->_use_keypad = tmp._use_keypad; - nwin->_delay = tmp._delay; - nwin->_immed = tmp._immed; - nwin->_sync = tmp._sync; - - nwin->_regtop = tmp._regtop; - nwin->_regbottom = tmp._regbottom; - - for (n = 0; n < nwin->_maxy + 1; n++) - { - (void) fread(nwin->_line[n].text, - sizeof(chtype), (size_t)(nwin->_maxx + 1), filep); - if (ferror(filep)) - { - delwin(nwin); - returnWin(0); - } + WINDOW tmp, *nwin; + int n; + + T((T_CALLED("getwin(%p)"), filep)); + + (void) fread(&tmp, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnWin(0); + + if ((nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0)) == 0) + returnWin(0); + + /* + * We deliberately do not restore the _parx, _pary, or _parent + * fields, because the window hierarchy within which they + * made sense is probably gone. + */ + nwin->_curx = tmp._curx; + nwin->_cury = tmp._cury; + nwin->_maxy = tmp._maxy; + nwin->_maxx = tmp._maxx; + nwin->_begy = tmp._begy; + nwin->_begx = tmp._begx; + nwin->_yoffset = tmp._yoffset; + nwin->_flags = tmp._flags & ~(_SUBWIN | _ISPAD); + + nwin->_attrs = tmp._attrs; + nwin->_bkgd = tmp._bkgd; + + nwin->_clear = tmp._clear; + nwin->_scroll = tmp._scroll; + nwin->_leaveok = tmp._leaveok; + nwin->_use_keypad = tmp._use_keypad; + nwin->_delay = tmp._delay; + nwin->_immed = tmp._immed; + nwin->_sync = tmp._sync; + + nwin->_regtop = tmp._regtop; + nwin->_regbottom = tmp._regbottom; + + for (n = 0; n < nwin->_maxy + 1; n++) { + (void) fread(nwin->_line[n].text, + sizeof(chtype), (size_t) (nwin->_maxx + 1), filep); + if (ferror(filep)) { + delwin(nwin); + returnWin(0); } - touchwin(nwin); + } + touchwin(nwin); - returnWin(nwin); + returnWin(nwin); } -int putwin(WINDOW *win, FILE *filep) +NCURSES_EXPORT(int) +putwin(WINDOW *win, FILE * filep) { - int code = ERR; - int n; + int code = ERR; + int n; - T((T_CALLED("putwin(%p,%p)"), win, filep)); + T((T_CALLED("putwin(%p,%p)"), win, filep)); - if (win) { - (void) fwrite(win, sizeof(WINDOW), 1, filep); - if (ferror(filep)) + if (win) { + (void) fwrite(win, sizeof(WINDOW), 1, filep); + if (ferror(filep)) returnCode(code); - for (n = 0; n < win->_maxy + 1; n++) - { - (void) fwrite(win->_line[n].text, - sizeof(chtype), (size_t)(win->_maxx + 1), filep); - if (ferror(filep)) + for (n = 0; n < win->_maxy + 1; n++) { + (void) fwrite(win->_line[n].text, + sizeof(chtype), (size_t) (win->_maxx + 1), filep); + if (ferror(filep)) returnCode(code); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } -int scr_restore(const char *file) +NCURSES_EXPORT(int) +scr_restore(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else - { - delwin(newscr); - newscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else { + delwin(newscr); + newscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_dump(const char *file) +NCURSES_EXPORT(int) +scr_dump(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, W_OK) < 0 - || (fp = fopen(file, "wb")) == 0) - returnCode(ERR); - else - { - (void) putwin(newscr, fp); - (void) fclose(fp); - dumptime = time((time_t *)0); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, W_OK) < 0 + || (fp = fopen(file, "wb")) == 0) + returnCode(ERR); + else { + (void) putwin(newscr, fp); + (void) fclose(fp); + dumptime = time((time_t *) 0); + returnCode(OK); + } } -int scr_init(const char *file) +NCURSES_EXPORT(int) +scr_init(const char *file) { - FILE *fp = 0; - struct stat stb; - - T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); - - if (exit_ca_mode && non_rev_rmcup) - returnCode(ERR); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) - returnCode(ERR); - else - { - delwin(curscr); - curscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + struct stat stb; + + T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); + + if (exit_ca_mode && non_rev_rmcup) + returnCode(ERR); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) + returnCode(ERR); + else { + delwin(curscr); + curscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_set(const char *file) +NCURSES_EXPORT(int) +scr_set(const char *file) { T((T_CALLED("scr_set(%s)"), _nc_visbuf(file))); if (scr_init(file) == ERR) returnCode(ERR); - else - { + else { delwin(newscr); newscr = dupwin(curscr); returnCode(OK); diff --git a/lib/libcurses/base/lib_scroll.c b/lib/libcurses/base/lib_scroll.c index 511ca93850a..8f9b3c5e17b 100644 --- a/lib/libcurses/base/lib_scroll.c +++ b/lib/libcurses/base/lib_scroll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_scroll.c,v 1.2 2000/06/19 03:53:45 millert Exp $ */ +/* $OpenBSD: lib_scroll.c,v 1.3 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -44,11 +44,12 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scroll.c,v 1.17 2000/04/29 21:10:51 tom Exp $") +MODULE_ID("$From: lib_scroll.c,v 1.20 2000/12/10 02:54:03 tom Exp $") -void -_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, - NCURSES_SIZE_T const bottom, chtype blank) +NCURSES_EXPORT(void) +_nc_scroll_window +(WINDOW *win, int const n, NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, chtype blank) { int line, j; size_t to_copy = (size_t) (sizeof(chtype) * (win->_maxx + 1)); @@ -70,10 +71,11 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, if (n < 0) { for (line = bottom; line >= top - n; line--) { memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line - + n].oldindex); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS( + win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = top; line < top - n; line++) { for (j = 0; j <= win->_maxx; j++) @@ -86,10 +88,10 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, if (n > 0) { for (line = top; line <= bottom - n; line++) { memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line - + n].oldindex); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = bottom; line > bottom - n; line--) { for (j = 0; j <= win->_maxx; j++) @@ -100,7 +102,7 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, touchline(win, top, bottom - top + 1); } -int +NCURSES_EXPORT(int) wscrl(WINDOW *win, int n) { T((T_CALLED("wscrl(%p,%d)"), win, n)); diff --git a/lib/libcurses/base/lib_scrollok.c b/lib/libcurses/base/lib_scrollok.c index 927b5495518..3cd16dc0891 100644 --- a/lib/libcurses/base/lib_scrollok.c +++ b/lib/libcurses/base/lib_scrollok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_scrollok.c,v 1.1 1999/01/18 19:09:58 millert Exp $ */ +/* $OpenBSD: lib_scrollok.c,v 1.2 2001/01/22 18:01:43 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_scrollok.c ** @@ -43,16 +42,16 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scrollok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: lib_scrollok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -int scrollok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +scrollok(WINDOW *win, bool flag) { - T((T_CALLED("scrollok(%p,%d)"), win, flag)); + T((T_CALLED("scrollok(%p,%d)"), win, flag)); - if (win) { - win->_scroll = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_scroll = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_scrreg.c b/lib/libcurses/base/lib_scrreg.c index 0ee5b425137..d7f8fa7a91a 100644 --- a/lib/libcurses/base/lib_scrreg.c +++ b/lib/libcurses/base/lib_scrreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_scrreg.c,v 1.2 2000/06/19 03:53:45 millert Exp $ */ +/* $OpenBSD: lib_scrreg.c,v 1.3 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_scrreg.c,v 1.8 2000/04/29 21:13:04 tom Exp $") +MODULE_ID("$From: lib_scrreg.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wsetscrreg(WINDOW *win, int top, int bottom) { T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c index 6952649ddfe..d9653821351 100644 --- a/lib/libcurses/base/lib_set_term.c +++ b/lib/libcurses/base/lib_set_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_set_term.c,v 1.11 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_set_term.c,v 1.12 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -45,9 +45,9 @@ #include <term.h> /* cur_term */ #include <tic.h> -MODULE_ID("$From: lib_set_term.c,v 1.58 2000/10/04 22:05:48 tom Exp $") +MODULE_ID("$From: lib_set_term.c,v 1.61 2000/12/10 02:43:27 tom Exp $") -SCREEN * +NCURSES_EXPORT(SCREEN *) set_term(SCREEN * screenp) { SCREEN *oldSP; @@ -82,7 +82,7 @@ _nc_free_keytry(struct tries *kt) /* * Free the storage associated with the given SCREEN sp. */ -void +NCURSES_EXPORT(void) delscreen(SCREEN * sp) { SCREEN **scan = &_nc_screen_chain; @@ -97,9 +97,9 @@ delscreen(SCREEN * sp) scan = &(*scan)->_next_screen; } - _nc_freewin(sp->_curscr); - _nc_freewin(sp->_newscr); - _nc_freewin(sp->_stdscr); + (void) _nc_freewin(sp->_curscr); + (void) _nc_freewin(sp->_newscr); + (void) _nc_freewin(sp->_stdscr); _nc_free_keytry(sp->_keytry); _nc_free_keytry(sp->_key_ok); @@ -193,8 +193,9 @@ extract_fgbg(char *src, int *result) } #endif -int -_nc_setupscreen(short slines, short const scolumns, FILE * output) +NCURSES_EXPORT(int) +_nc_setupscreen +(short slines, short const scolumns, FILE * output) /* OS-independent screen initializations */ { int bottom_stolen = 0; @@ -226,7 +227,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) #if NCURSES_NO_PADDING SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used", - SP->_no_padding ? " not" : "")); + SP->_no_padding ? " not" : "")); #endif #if NCURSES_EXT_FUNCS @@ -297,12 +298,12 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) if (magic_cookie_glitch > 0) { SP->_xmc_triggers = termattrs() & ( - A_ALTCHARSET | - A_BLINK | - A_BOLD | - A_REVERSE | - A_STANDOUT | - A_UNDERLINE + A_ALTCHARSET | + A_BLINK | + A_BOLD | + A_REVERSE | + A_STANDOUT | + A_UNDERLINE ); SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~ (A_BOLD); @@ -392,7 +393,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) /* The internal implementation interprets line as the number of lines to rip off from the top or bottom. */ -int +NCURSES_EXPORT(int) _nc_ripoffline(int line, int (*init) (WINDOW *, int)) { if (line == 0) @@ -409,7 +410,7 @@ _nc_ripoffline(int line, int (*init) (WINDOW *, int)) return (OK); } -int +NCURSES_EXPORT(int) ripoffline(int line, int (*init) (WINDOW *, int)) { T((T_CALLED("ripoffline(%d,%p)"), line, init)); diff --git a/lib/libcurses/base/lib_slk.c b/lib/libcurses/base/lib_slk.c index c0cc60ba85b..7b72ce85844 100644 --- a/lib/libcurses/base/lib_slk.c +++ b/lib/libcurses/base/lib_slk.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slk.c,v 1.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: lib_slk.c,v 1.4 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,43 +41,41 @@ #include <curses.priv.h> #include <ctype.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$From: lib_slk.c,v 1.17 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$From: lib_slk.c,v 1.20 2000/12/10 02:43:27 tom Exp $") /* * We'd like to move these into the screen context structure, but cannot, * because slk_init() is called before initscr()/newterm(). */ -int _nc_slk_format = 0; /* one more than format specified in slk_init() */ +NCURSES_EXPORT_VAR(int) +_nc_slk_format = 0; /* one more than format specified in slk_init() */ /* * Paint the info line for the PC style SLK emulation. * */ -static void -slk_paint_info(WINDOW *win) + static void + slk_paint_info(WINDOW *win) { - if (win && SP->slk_format==4) - { - int i; - - mvwhline (win,0,0,0,getmaxx(win)); - wmove (win,0,0); - - for (i = 0; i < SP->_slk->maxlab; i++) { - if (win && SP->slk_format==4) - { - mvwaddch(win,0,SP->_slk->ent[i].x,'F'); - if (i<9) - waddch(win,'1'+i); - else - { - waddch(win,'1'); - waddch(win,'0' + (i-9)); - } - } - } + if (win && SP->slk_format == 4) { + int i; + + mvwhline(win, 0, 0, 0, getmaxx(win)); + wmove(win, 0, 0); + + for (i = 0; i < SP->_slk->maxlab; i++) { + if (win && SP->slk_format == 4) { + mvwaddch(win, 0, SP->_slk->ent[i].x, (chtype) 'F'); + if (i < 9) + waddch(win, (chtype) '1' + i); + else { + waddch(win, (chtype) '1'); + waddch(win, (chtype) '0' + (i - 9)); + } + } + } } } @@ -85,132 +83,122 @@ slk_paint_info(WINDOW *win) * Initialize soft labels. * Called from newterm() */ -int +NCURSES_EXPORT(int) _nc_slk_initialize(WINDOW *stwin, int cols) { -int i, x; -int res = OK; -char *p; - - T(("slk_initialize()")); - - if (SP->_slk) - { /* we did this already, so simply return */ - return(OK); - } - else - if ((SP->_slk = typeCalloc(SLK, 1)) == 0) - return(ERR); - - SP->_slk->ent = NULL; - SP->_slk->buffer = NULL; - SP->_slk->attr = A_STANDOUT; - - SP->_slk->maxlab = (num_labels > 0) ? - num_labels : MAX_SKEY(_nc_slk_format); - SP->_slk->maxlen = (num_labels > 0) ? - label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); - SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? - MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; - - SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); - if (SP->_slk->ent == NULL) - goto exception; - - p = SP->_slk->buffer = (char*) calloc(2*SP->_slk->labcnt,(1+SP->_slk->maxlen)); - if (SP->_slk->buffer == NULL) - goto exception; - - for (i = 0; i < SP->_slk->labcnt; i++) { - SP->_slk->ent[i].text = p; - p += (1 + SP->_slk->maxlen); - SP->_slk->ent[i].form_text = p; - p += (1 + SP->_slk->maxlen); - memset(SP->_slk->ent[i].form_text, ' ', (unsigned)(SP->_slk->maxlen)); - SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); - } - if (_nc_slk_format >= 3) /* PC style */ - { - int gap = (cols - 3 * (3 + 4*SP->_slk->maxlen))/2; + int i, x; + int res = OK; + char *p; + + T(("slk_initialize()")); + + if (SP->_slk) { /* we did this already, so simply return */ + return (OK); + } else if ((SP->_slk = typeCalloc(SLK, 1)) == 0) + return (ERR); + + SP->_slk->ent = NULL; + SP->_slk->buffer = NULL; + SP->_slk->attr = A_STANDOUT; + + SP->_slk->maxlab = (num_labels > 0) ? + num_labels : MAX_SKEY(_nc_slk_format); + SP->_slk->maxlen = (num_labels > 0) ? + label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); + SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? + MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; + + SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); + if (SP->_slk->ent == NULL) + goto exception; + + p = SP->_slk->buffer = (char *) calloc(2 * SP->_slk->labcnt, (1 + SP->_slk->maxlen)); + if (SP->_slk->buffer == NULL) + goto exception; + + for (i = 0; i < SP->_slk->labcnt; i++) { + SP->_slk->ent[i].text = p; + p += (1 + SP->_slk->maxlen); + SP->_slk->ent[i].form_text = p; + p += (1 + SP->_slk->maxlen); + memset(SP->_slk->ent[i].form_text, ' ', (unsigned) (SP->_slk->maxlen)); + SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); + } + if (_nc_slk_format >= 3) { /* PC style */ + int gap = (cols - 3 * (3 + 4 * SP->_slk->maxlen)) / 2; - if (gap < 1) - gap = 1; + if (gap < 1) + gap = 1; - for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i==3 || i==7) ? gap : 1; - } - if (_nc_slk_format == 4) - slk_paint_info (stwin); - } - else { - if (_nc_slk_format == 2) { /* 4-4 */ + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3 || i == 7) ? gap : 1; + } + if (_nc_slk_format == 4) + slk_paint_info(stwin); + } else { + if (_nc_slk_format == 2) { /* 4-4 */ int gap = cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 6; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 3) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3) ? gap : 1; } - } - else - { - if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ - int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) / 2; + } else { + if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ + int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) + / 2; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 2 || i == 4) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 2 || i == 4) ? gap : 1; } - } - else + } else goto exception; - } } - SP->_slk->dirty = TRUE; - if ((SP->_slk->win = stwin) == NULL) - { - exception: - if (SP->_slk) - { - FreeIfNeeded(SP->_slk->buffer); - FreeIfNeeded(SP->_slk->ent); - free(SP->_slk); - SP->_slk = (SLK*)0; - res = (ERR); - } + } + SP->_slk->dirty = TRUE; + if ((SP->_slk->win = stwin) == NULL) { + exception: + if (SP->_slk) { + FreeIfNeeded(SP->_slk->buffer); + FreeIfNeeded(SP->_slk->ent); + free(SP->_slk); + SP->_slk = (SLK *) 0; + res = (ERR); } + } - /* We now reset the format so that the next newterm has again - * per default no SLK keys and may call slk_init again to - * define a new layout. (juergen 03-Mar-1999) - */ - SP->slk_format = _nc_slk_format; - _nc_slk_format = 0; - return(res); + /* We now reset the format so that the next newterm has again + * per default no SLK keys and may call slk_init again to + * define a new layout. (juergen 03-Mar-1999) + */ + SP->slk_format = _nc_slk_format; + _nc_slk_format = 0; + return (res); } - /* * Restore the soft labels on the screen. */ -int +NCURSES_EXPORT(int) slk_restore(void) { - T((T_CALLED("slk_restore()"))); + T((T_CALLED("slk_restore()"))); - if (SP->_slk == NULL) - return(ERR); - SP->_slk->hidden = FALSE; - SP->_slk->dirty = TRUE; - /* we have to repaint info line eventually */ - slk_paint_info(SP->_slk->win); + if (SP->_slk == NULL) + return (ERR); + SP->_slk->hidden = FALSE; + SP->_slk->dirty = TRUE; + /* we have to repaint info line eventually */ + slk_paint_info(SP->_slk->win); - returnCode(slk_refresh()); + returnCode(slk_refresh()); } diff --git a/lib/libcurses/base/lib_slkatr_set.c b/lib/libcurses/base/lib_slkatr_set.c index 4f22dd3517b..403ec288aab 100644 --- a/lib/libcurses/base/lib_slkatr_set.c +++ b/lib/libcurses/base/lib_slkatr_set.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatr_set.c,v 1.2 1999/05/17 03:03:59 millert Exp $ */ +/* $OpenBSD: lib_slkatr_set.c,v 1.3 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,20 +39,19 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatr_set.c,v 1.3 1999/05/16 17:13:59 juergen Exp $") +MODULE_ID("$From: lib_slkatr_set.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int -slk_attr_set(const attr_t attr, short color_pair_number, void* opts) +NCURSES_EXPORT(int) +slk_attr_set +(const attr_t attr, short color_pair_number, void *opts) { - T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); + T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && !opts && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - SP->_slk->attr = attr; - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && !opts && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + SP->_slk->attr = attr; + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatrof.c b/lib/libcurses/base/lib_slkatrof.c index 3dcfb708042..36e2c128e80 100644 --- a/lib/libcurses/base/lib_slkatrof.c +++ b/lib/libcurses/base/lib_slkatrof.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatrof.c,v 1.1 1999/01/18 19:10:00 millert Exp $ */ +/* $OpenBSD: lib_slkatrof.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatrof.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$From: lib_slkatrof.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attroff(const chtype attr) { - T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_off(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_off(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatron.c b/lib/libcurses/base/lib_slkatron.c index e809e6696fa..f12bd7ad20f 100644 --- a/lib/libcurses/base/lib_slkatron.c +++ b/lib/libcurses/base/lib_slkatron.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatron.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkatron.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatron.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$From: lib_slkatron.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attron(const chtype attr) { - T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_on(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_on(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkatrset.c b/lib/libcurses/base/lib_slkatrset.c index 7143fff4cb8..3d3fb73d5e1 100644 --- a/lib/libcurses/base/lib_slkatrset.c +++ b/lib/libcurses/base/lib_slkatrset.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkatrset.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkatrset.c,v 1.2 2001/01/22 18:01:44 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,18 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkatrset.c,v 1.4 1998/03/11 19:26:01 juergen Exp $") +MODULE_ID("$From: lib_slkatrset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attrset(const chtype attr) { - T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - SP->_slk->attr = attr; - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + SP->_slk->attr = attr; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkattr.c b/lib/libcurses/base/lib_slkattr.c index e1252181f34..2ddc36f926c 100644 --- a/lib/libcurses/base/lib_slkattr.c +++ b/lib/libcurses/base/lib_slkattr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkattr.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */ +/* $OpenBSD: lib_slkattr.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,17 +40,15 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slkattr.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -attr_t +NCURSES_EXPORT(attr_t) slk_attr(void) { - T((T_CALLED("slk_attr()"))); + T((T_CALLED("slk_attr()"))); - if (SP!=0 && SP->_slk!=0) - { - returnAttr(SP->_slk->attr); - } - else - returnAttr(0); + if (SP != 0 && SP->_slk != 0) { + returnAttr(SP->_slk->attr); + } else + returnAttr(0); } diff --git a/lib/libcurses/base/lib_slkclear.c b/lib/libcurses/base/lib_slkclear.c index eef57c72fd4..729ece1f185 100644 --- a/lib/libcurses/base/lib_slkclear.c +++ b/lib/libcurses/base/lib_slkclear.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkclear.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */ +/* $OpenBSD: lib_slkclear.c,v 1.3 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,25 +40,24 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkclear.c,v 1.4 1999/03/03 23:44:22 juergen Exp $") +MODULE_ID("$From: lib_slkclear.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_clear(void) { - T((T_CALLED("slk_clear()"))); + T((T_CALLED("slk_clear()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->hidden = TRUE; - /* For simulated SLK's it's looks much more natural to - inherit those attributes from the standard screen */ - SP->_slk->win->_bkgd = stdscr->_bkgd; - SP->_slk->win->_attrs = stdscr->_attrs; - if (SP->_slk->win == stdscr) { - returnCode(OK); - } - else { - werase(SP->_slk->win); - returnCode(wrefresh(SP->_slk->win)); - } + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->hidden = TRUE; + /* For simulated SLK's it's looks much more natural to + inherit those attributes from the standard screen */ + SP->_slk->win->_bkgd = stdscr->_bkgd; + SP->_slk->win->_attrs = stdscr->_attrs; + if (SP->_slk->win == stdscr) { + returnCode(OK); + } else { + werase(SP->_slk->win); + returnCode(wrefresh(SP->_slk->win)); + } } diff --git a/lib/libcurses/base/lib_slkcolor.c b/lib/libcurses/base/lib_slkcolor.c index 3eb448906e9..6b06426dbbe 100644 --- a/lib/libcurses/base/lib_slkcolor.c +++ b/lib/libcurses/base/lib_slkcolor.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkcolor.c,v 1.2 1999/05/17 03:04:00 millert Exp $ */ +/* $OpenBSD: lib_slkcolor.c,v 1.3 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -37,20 +37,18 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkcolor.c,v 1.5 1999/05/16 17:14:13 juergen Exp $") +MODULE_ID("$From: lib_slkcolor.c,v 1.7 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_color(short color_pair_number) { - T((T_CALLED("slk_color(%d)"), color_pair_number)); + T((T_CALLED("slk_color(%d)"), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_slkinit.c b/lib/libcurses/base/lib_slkinit.c index 320e581900b..6159dc6a209 100644 --- a/lib/libcurses/base/lib_slkinit.c +++ b/lib/libcurses/base/lib_slkinit.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkinit.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */ +/* $OpenBSD: lib_slkinit.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,14 +40,14 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slkinit.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slkinit.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_init(int format) { - T((T_CALLED("slk_init(%d)"), format)); - if (format < 0 || format > 3) - returnCode(ERR); - _nc_slk_format = 1 + format; - returnCode(OK); + T((T_CALLED("slk_init(%d)"), format)); + if (format < 0 || format > 3) + returnCode(ERR); + _nc_slk_format = 1 + format; + returnCode(OK); } diff --git a/lib/libcurses/base/lib_slklab.c b/lib/libcurses/base/lib_slklab.c index 0136b16292b..2eb3ff6e0d0 100644 --- a/lib/libcurses/base/lib_slklab.c +++ b/lib/libcurses/base/lib_slklab.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slklab.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */ +/* $OpenBSD: lib_slklab.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,14 +40,14 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slklab.c,v 1.4 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$From: lib_slklab.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -char* +NCURSES_EXPORT(char *) slk_label(int n) { - T((T_CALLED("slk_label(%d)"), n)); + T((T_CALLED("slk_label(%d)"), n)); - if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) - returnPtr(0); - returnPtr(SP->_slk->ent[n-1].text); + if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) + returnPtr(0); + returnPtr(SP->_slk->ent[n - 1].text); } diff --git a/lib/libcurses/base/lib_slkrefr.c b/lib/libcurses/base/lib_slkrefr.c index bbad7326c7c..80cdec3e66a 100644 --- a/lib/libcurses/base/lib_slkrefr.c +++ b/lib/libcurses/base/lib_slkrefr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkrefr.c,v 1.3 1999/03/14 03:10:32 millert Exp $ */ +/* $OpenBSD: lib_slkrefr.c,v 1.4 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,91 +38,85 @@ * Write SLK window to the (virtual) screen. */ #include <curses.priv.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$From: lib_slkrefr.c,v 1.8 1999/03/14 00:10:27 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_slkrefr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") /* * Write the soft labels to the soft-key window. */ static void -slk_intern_refresh(SLK *slk) +slk_intern_refresh(SLK * slk) { -int i; -int fmt = SP->slk_format; + int i; + int fmt = SP->slk_format; - for (i = 0; i < slk->labcnt; i++) { - if (slk->dirty || slk->ent[i].dirty) { - if (slk->ent[i].visible) { - if (num_labels > 0 && SLK_STDFMT(fmt)) - { - if (i < num_labels) { - TPUTS_TRACE("plab_norm"); - putp(tparm(plab_norm, i+1, slk->ent[i].form_text)); - } - } - else - { - wmove(slk->win,SLK_LINES(fmt)-1,slk->ent[i].x); - if (SP && SP->_slk) - wattrset(slk->win,SP->_slk->attr); - waddnstr(slk->win,slk->ent[i].form_text, - MAX_SKEY_LEN(fmt)); - /* if we simulate SLK's, it's looking much more - natural to use the current ATTRIBUTE also - for the label window */ - wattrset(slk->win,stdscr->_attrs); - } - } - slk->ent[i].dirty = FALSE; + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { + if (num_labels > 0 && SLK_STDFMT(fmt)) { + if (i < num_labels) { + TPUTS_TRACE("plab_norm"); + putp(tparm(plab_norm, i + 1, slk->ent[i].form_text)); + } + } else { + wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].x); + if (SP && SP->_slk) + wattrset(slk->win, SP->_slk->attr); + waddnstr(slk->win, slk->ent[i].form_text, + MAX_SKEY_LEN(fmt)); + /* if we simulate SLK's, it's looking much more + natural to use the current ATTRIBUTE also + for the label window */ + wattrset(slk->win, stdscr->_attrs); } + } + slk->ent[i].dirty = FALSE; } - slk->dirty = FALSE; + } + slk->dirty = FALSE; - if (num_labels > 0) { - if (slk->hidden) - { - TPUTS_TRACE("label_off"); - putp(label_off); - } - else - { - TPUTS_TRACE("label_on"); - putp(label_on); - } + if (num_labels > 0) { + if (slk->hidden) { + TPUTS_TRACE("label_off"); + putp(label_off); + } else { + TPUTS_TRACE("label_on"); + putp(label_on); } + } } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_noutrefresh(void) { - T((T_CALLED("slk_noutrefresh()"))); + T((T_CALLED("slk_noutrefresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wnoutrefresh(SP->_slk->win)); + returnCode(wnoutrefresh(SP->_slk->win)); } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_refresh(void) { - T((T_CALLED("slk_refresh()"))); + T((T_CALLED("slk_refresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wrefresh(SP->_slk->win)); + returnCode(wrefresh(SP->_slk->win)); } diff --git a/lib/libcurses/base/lib_slkset.c b/lib/libcurses/base/lib_slkset.c index 8d2ae2c403e..9014957a5d6 100644 --- a/lib/libcurses/base/lib_slkset.c +++ b/lib/libcurses/base/lib_slkset.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slkset.c,v 1.1 1999/01/18 19:10:04 millert Exp $ */ +/* $OpenBSD: lib_slkset.c,v 1.2 2001/01/22 18:01:46 millert Exp $ */ /**************************************************************************** - * 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 * diff --git a/lib/libcurses/base/lib_slktouch.c b/lib/libcurses/base/lib_slktouch.c index b7d217fe4c6..34f4fde8261 100644 --- a/lib/libcurses/base/lib_slktouch.c +++ b/lib/libcurses/base/lib_slktouch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_slktouch.c,v 1.1 1999/01/18 19:10:04 millert Exp $ */ +/* $OpenBSD: lib_slktouch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,16 +40,16 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_slktouch.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_slktouch.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_touch(void) { - T((T_CALLED("slk_touch()"))); + T((T_CALLED("slk_touch()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->dirty = TRUE; + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->dirty = TRUE; - returnCode(OK); + returnCode(OK); } diff --git a/lib/libcurses/base/lib_touch.c b/lib/libcurses/base/lib_touch.c index 7b223b666d0..c883fc6b91f 100644 --- a/lib/libcurses/base/lib_touch.c +++ b/lib/libcurses/base/lib_touch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_touch.c,v 1.1 1999/01/18 19:10:05 millert Exp $ */ +/* $OpenBSD: lib_touch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * 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 * @@ -45,45 +45,49 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_touch.c,v 1.6 1998/04/11 22:55:02 tom Exp $") +MODULE_ID("$From: lib_touch.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -bool is_linetouched(WINDOW *win, int line) +NCURSES_EXPORT(bool) +is_linetouched(WINDOW *win, int line) { - T((T_CALLED("is_linetouched(%p,%d)"), win, line)); + T((T_CALLED("is_linetouched(%p,%d)"), win, line)); - /* XSI doesn't define any error */ - if (!win || (line > win->_maxy) || (line < 0)) - returnCode(ERR); + /* XSI doesn't define any error */ + if (!win || (line > win->_maxy) || (line < 0)) + returnCode((bool) ERR); - returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); + returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); } -bool is_wintouched(WINDOW *win) +NCURSES_EXPORT(bool) +is_wintouched(WINDOW *win) { -int i; + int i; - T((T_CALLED("is_wintouched(%p)"), win)); + T((T_CALLED("is_wintouched(%p)"), win)); - if (win) - for (i = 0; i <= win->_maxy; i++) - if (win->_line[i].firstchar != _NOCHANGE) - returnCode(TRUE); - returnCode(FALSE); + if (win) + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); + returnCode(FALSE); } -int wtouchln(WINDOW *win, int y, int n, int changed) +NCURSES_EXPORT(int) +wtouchln(WINDOW *win, int y, int n, int changed) { -int i; + int i; - T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); + T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); - if (!win || (n<0) || (y<0) || (y>win->_maxy)) - returnCode(ERR); + if (!win || (n < 0) || (y < 0) || (y > win->_maxy)) + returnCode(ERR); - for (i = y; i < y+n; i++) { - if (i>win->_maxy) break; - win->_line[i].firstchar = changed ? 0 : _NOCHANGE; - win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; - } - returnCode(OK); + for (i = y; i < y + n; i++) { + if (i > win->_maxy) + break; + win->_line[i].firstchar = changed ? 0 : _NOCHANGE; + win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; + } + returnCode(OK); } diff --git a/lib/libcurses/base/lib_ungetch.c b/lib/libcurses/base/lib_ungetch.c index 81b315d6a42..3837f645b3a 100644 --- a/lib/libcurses/base/lib_ungetch.c +++ b/lib/libcurses/base/lib_ungetch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_ungetch.c,v 1.1 1999/01/18 19:10:05 millert Exp $ */ +/* $OpenBSD: lib_ungetch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,35 +42,38 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: lib_ungetch.c,v 1.4 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> #ifdef TRACE -void _nc_fifo_dump(void) +NCURSES_EXPORT(void) +_nc_fifo_dump(void) { -int i; - T(("head = %d, tail = %d, peek = %d", head, tail, peek)); - for (i = 0; i < 10; i++) - T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); + int i; + T(("head = %d, tail = %d, peek = %d", head, tail, peek)); + for (i = 0; i < 10; i++) + T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); } #endif /* TRACE */ -int ungetch(int ch) +NCURSES_EXPORT(int) +ungetch(int ch) { - if (tail == -1) - return ERR; - if (head == -1) { - head = 0; - t_inc() - peek = tail; /* no raw keys */ - } else - h_dec(); + if (tail == -1) + return ERR; + if (head == -1) { + head = 0; + t_inc() + peek = tail; /* no raw keys */ + } else + h_dec(); - SP->_fifo[head] = ch; - T(("ungetch %#x ok", ch)); + SP->_fifo[head] = ch; + T(("ungetch %#x ok", ch)); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) + _nc_fifo_dump(); #endif - return OK; + return OK; } diff --git a/lib/libcurses/base/lib_vline.c b/lib/libcurses/base/lib_vline.c index 7f1a9a09bb2..03dee2977ae 100644 --- a/lib/libcurses/base/lib_vline.c +++ b/lib/libcurses/base/lib_vline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_vline.c,v 1.2 2000/06/19 03:53:46 millert Exp $ */ +/* $OpenBSD: lib_vline.c,v 1.3 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,9 +42,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_vline.c,v 1.5 2000/04/29 21:14:11 tom Exp $") +MODULE_ID("$From: lib_vline.c,v 1.7 2000/12/10 02:43:28 tom Exp $") -int +NCURSES_EXPORT(int) wvline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/lib/libcurses/base/lib_wattroff.c b/lib/libcurses/base/lib_wattroff.c index cb4bf92b812..38d5cfb0d31 100644 --- a/lib/libcurses/base/lib_wattroff.c +++ b/lib/libcurses/base/lib_wattroff.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_wattroff.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_wattroff.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * 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 * @@ -43,15 +43,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_wattroff.c,v 1.4 1998/05/10 12:02:11 tom Exp $") +MODULE_ID("$From: lib_wattroff.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_off(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_off +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_off(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_off(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_wattron.c b/lib/libcurses/base/lib_wattron.c index cd3c195e120..b788582bc19 100644 --- a/lib/libcurses/base/lib_wattron.c +++ b/lib/libcurses/base/lib_wattron.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_wattron.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_wattron.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */ /**************************************************************************** - * 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 * @@ -43,15 +43,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: lib_wattron.c,v 1.4 1998/05/10 12:02:28 tom Exp $") +MODULE_ID("$From: lib_wattron.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_on(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_on +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_on(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_on(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/lib/libcurses/base/lib_winch.c b/lib/libcurses/base/lib_winch.c index 1c468be590b..9dc58e732b9 100644 --- a/lib/libcurses/base/lib_winch.c +++ b/lib/libcurses/base/lib_winch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_winch.c,v 1.2 2000/10/08 22:46:59 millert Exp $ */ +/* $OpenBSD: lib_winch.c,v 1.3 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -41,9 +41,9 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_winch.c,v 1.2 2000/07/29 16:41:44 tom Exp $") +MODULE_ID("$From: lib_winch.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -chtype +NCURSES_EXPORT(chtype) winch(WINDOW *win) { T((T_CALLED("winch(%p)"), win)); diff --git a/lib/libcurses/base/lib_window.c b/lib/libcurses/base/lib_window.c index 51f459fb509..6cfe4ac6fc4 100644 --- a/lib/libcurses/base/lib_window.c +++ b/lib/libcurses/base/lib_window.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_window.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: lib_window.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,183 +41,185 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_window.c,v 1.13 1998/06/28 00:10:59 tom Exp $") +MODULE_ID("$From: lib_window.c,v 1.15 2000/12/10 02:43:28 tom Exp $") -void _nc_synchook(WINDOW *win) +NCURSES_EXPORT(void) +_nc_synchook(WINDOW *win) /* hook to be called after each window change */ { - if (win->_immed) wrefresh(win); - if (win->_sync) wsyncup(win); + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); } -int mvderwin(WINDOW *win, int y, int x) +NCURSES_EXPORT(int) +mvderwin(WINDOW *win, int y, int x) /* move a derived window */ { - WINDOW *orig; - int i; - - T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); - - if (win && (orig = win->_parent)) - { - if (win->_parx==x && win->_pary==y) - returnCode(OK); - if (x<0 || y<0) + WINDOW *orig; + int i; + + T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); + + if (win && (orig = win->_parent)) { + if (win->_parx == x && win->_pary == y) + returnCode(OK); + if (x < 0 || y < 0) + returnCode(ERR); + if ((x + getmaxx(win) > getmaxx(orig)) || + (y + getmaxy(win) > getmaxy(orig))) + returnCode(ERR); + } else returnCode(ERR); - if ( (x+getmaxx(win) > getmaxx(orig)) || - (y+getmaxy(win) > getmaxy(orig)) ) - returnCode(ERR); - } - else - returnCode(ERR); - wsyncup(win); - win->_parx = x; - win->_pary = y; - for(i=0;i<getmaxy(win);i++) - win->_line[i].text = &(orig->_line[y++].text[x]); - returnCode(OK); + wsyncup(win); + win->_parx = x; + win->_pary = y; + for (i = 0; i < getmaxy(win); i++) + win->_line[i].text = &(orig->_line[y++].text[x]); + returnCode(OK); } -int syncok(WINDOW *win, bool bf) +NCURSES_EXPORT(int) +syncok(WINDOW *win, bool bf) /* enable/disable automatic wsyncup() on each change to window */ { - T((T_CALLED("syncok(%p,%d)"), win, bf)); + T((T_CALLED("syncok(%p,%d)"), win, bf)); - if (win) { - win->_sync = bf; - returnCode(OK); - } else - returnCode(ERR); + if (win) { + win->_sync = bf; + returnCode(OK); + } else + returnCode(ERR); } -void wsyncup(WINDOW *win) +NCURSES_EXPORT(void) +wsyncup(WINDOW *win) /* mark changed every cell in win's ancestors that is changed in win */ /* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ { - WINDOW *wp; - - if (win && win->_parent) - for (wp = win; wp->_parent; wp = wp->_parent) - { - int y; - WINDOW *pp = wp->_parent; - - assert((wp->_pary <= pp->_maxy) && - ((wp->_pary+wp->_maxy) <= pp->_maxy)); - - for (y = 0; y <= wp->_maxy; y++) - { - int left = wp->_line[y].firstchar; - if (left >= 0) /* line is touched */ - { - struct ldat *line = &(pp->_line[wp->_pary + y]); - /* left & right character in parent window coordinates */ - int right = wp->_line[y].lastchar + wp->_parx; - left += wp->_parx; - - CHANGED_RANGE(line, left, right); - } - } - } + WINDOW *wp; + + if (win && win->_parent) + for (wp = win; wp->_parent; wp = wp->_parent) { + int y; + WINDOW *pp = wp->_parent; + + assert((wp->_pary <= pp->_maxy) && + ((wp->_pary + wp->_maxy) <= pp->_maxy)); + + for (y = 0; y <= wp->_maxy; y++) { + int left = wp->_line[y].firstchar; + if (left >= 0) { /* line is touched */ + struct ldat *line = &(pp->_line[wp->_pary + y]); + /* left & right character in parent window coordinates */ + int right = wp->_line[y].lastchar + wp->_parx; + left += wp->_parx; + + CHANGED_RANGE(line, left, right); + } + } + } } -void wsyncdown(WINDOW *win) +NCURSES_EXPORT(void) +wsyncdown(WINDOW *win) /* mark changed every cell in win that is changed in any of its ancestors */ /* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ { - if (win && win->_parent) - { - WINDOW *pp = win->_parent; - int y; - - /* This recursion guarantees, that the changes are propagated down- - wards from the root to our direct parent. */ - wsyncdown(pp); - - /* and now we only have to propagate the changes from our direct - parent, if there are any. */ - assert((win->_pary <= pp->_maxy) && - ((win->_pary + win->_maxy) <= pp->_maxy)); - - for (y = 0; y <= win->_maxy; y++) - { - if (pp->_line[win->_pary + y].firstchar >= 0) /* parent changed */ - { - struct ldat *line = &(win->_line[y]); - /* left and right character in child coordinates */ - int left = pp->_line[win->_pary + y].firstchar - win->_parx; - int right = pp->_line[win->_pary + y].lastchar - win->_parx; - /* The change maybe outside the childs range */ - if (left<0) - left = 0; - if (right > win->_maxx) - right = win->_maxx; - CHANGED_RANGE(line, left, right); + if (win && win->_parent) { + WINDOW *pp = win->_parent; + int y; + + /* This recursion guarantees, that the changes are propagated down- + wards from the root to our direct parent. */ + wsyncdown(pp); + + /* and now we only have to propagate the changes from our direct + parent, if there are any. */ + assert((win->_pary <= pp->_maxy) && + ((win->_pary + win->_maxy) <= pp->_maxy)); + + for (y = 0; y <= win->_maxy; y++) { + if (pp->_line[win->_pary + y].firstchar >= 0) { /* parent changed */ + struct ldat *line = &(win->_line[y]); + /* left and right character in child coordinates */ + int left = pp->_line[win->_pary + y].firstchar - win->_parx; + int right = pp->_line[win->_pary + y].lastchar - win->_parx; + /* The change maybe outside the childs range */ + if (left < 0) + left = 0; + if (right > win->_maxx) + right = win->_maxx; + CHANGED_RANGE(line, left, right); } } } } -void wcursyncup(WINDOW *win) +NCURSES_EXPORT(void) +wcursyncup(WINDOW *win) /* sync the cursor in all derived windows to its value in the base window */ { - WINDOW *wp; - for( wp = win; wp && wp->_parent; wp = wp->_parent ) { - wmove( wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx ); - } + WINDOW *wp; + for (wp = win; wp && wp->_parent; wp = wp->_parent) { + wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx); + } } -WINDOW *dupwin(WINDOW *win) +NCURSES_EXPORT(WINDOW *) +dupwin(WINDOW *win) /* make an exact duplicate of the given window */ { -WINDOW *nwin; -size_t linesize; -int i; - - T((T_CALLED("dupwin(%p)"), win)); - - if ((win==NULL) || - ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL)) - returnWin(0); - - nwin->_curx = win->_curx; - nwin->_cury = win->_cury; - nwin->_maxy = win->_maxy; - nwin->_maxx = win->_maxx; - nwin->_begy = win->_begy; - nwin->_begx = win->_begx; - nwin->_yoffset = win->_yoffset; - - nwin->_flags = win->_flags & ~_SUBWIN; - /* Due to the use of newwin(), the clone is not a subwindow. - * The text is really copied into the clone. - */ - - nwin->_attrs = win->_attrs; - nwin->_bkgd = win->_bkgd; - - nwin->_clear = win->_clear; - nwin->_scroll = win->_scroll; - nwin->_leaveok = win->_leaveok; - nwin->_use_keypad = win->_use_keypad; - nwin->_delay = win->_delay; - nwin->_immed = win->_immed; - nwin->_sync = win->_sync; - - nwin->_parx = 0; - nwin->_pary = 0; - nwin->_parent = (WINDOW*)0; - /* See above: the clone isn't a subwindow! */ - - nwin->_regtop = win->_regtop; - nwin->_regbottom = win->_regbottom; - - linesize = (win->_maxx + 1) * sizeof(chtype); - for (i = 0; i <= nwin->_maxy; i++) { - memcpy(nwin->_line[i].text, win->_line[i].text, linesize); - nwin->_line[i].firstchar = win->_line[i].firstchar; - nwin->_line[i].lastchar = win->_line[i].lastchar; - } + WINDOW *nwin; + size_t linesize; + int i; + + T((T_CALLED("dupwin(%p)"), win)); + + if ((win == NULL) || + ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, + win->_begx)) == NULL)) + returnWin(0); + + nwin->_curx = win->_curx; + nwin->_cury = win->_cury; + nwin->_maxy = win->_maxy; + nwin->_maxx = win->_maxx; + nwin->_begy = win->_begy; + nwin->_begx = win->_begx; + nwin->_yoffset = win->_yoffset; + + nwin->_flags = win->_flags & ~_SUBWIN; + /* Due to the use of newwin(), the clone is not a subwindow. + * The text is really copied into the clone. + */ + + nwin->_attrs = win->_attrs; + nwin->_bkgd = win->_bkgd; + + nwin->_clear = win->_clear; + nwin->_scroll = win->_scroll; + nwin->_leaveok = win->_leaveok; + nwin->_use_keypad = win->_use_keypad; + nwin->_delay = win->_delay; + nwin->_immed = win->_immed; + nwin->_sync = win->_sync; + + nwin->_parx = 0; + nwin->_pary = 0; + nwin->_parent = (WINDOW *) 0; + /* See above: the clone isn't a subwindow! */ + + nwin->_regtop = win->_regtop; + nwin->_regbottom = win->_regbottom; + + linesize = (win->_maxx + 1) * sizeof(chtype); + for (i = 0; i <= nwin->_maxy; i++) { + memcpy(nwin->_line[i].text, win->_line[i].text, linesize); + nwin->_line[i].firstchar = win->_line[i].firstchar; + nwin->_line[i].lastchar = win->_line[i].lastchar; + } - returnWin(nwin); + returnWin(nwin); } diff --git a/lib/libcurses/base/nc_panel.c b/lib/libcurses/base/nc_panel.c index 5900b317c4b..00bbda062f8 100644 --- a/lib/libcurses/base/nc_panel.c +++ b/lib/libcurses/base/nc_panel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: nc_panel.c,v 1.1 1999/01/18 19:10:06 millert Exp $ */ +/* $OpenBSD: nc_panel.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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,10 +34,10 @@ #include <curses.priv.h> -MODULE_ID("$From: nc_panel.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$From: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -struct panelhook* +NCURSES_EXPORT(struct panelhook *) _nc_panelhook(void) { - return (SP ? &(SP->_panelHook) : NULL); + return (SP ? &(SP->_panelHook) : NULL); } diff --git a/lib/libcurses/base/resizeterm.c b/lib/libcurses/base/resizeterm.c index 3219be06cf5..829f9148820 100644 --- a/lib/libcurses/base/resizeterm.c +++ b/lib/libcurses/base/resizeterm.c @@ -1,7 +1,7 @@ -/* $OpenBSD: resizeterm.c,v 1.1 1999/01/18 19:10:07 millert Exp $ */ +/* $OpenBSD: resizeterm.c,v 1.2 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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 * @@ -43,7 +43,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: resizeterm.c,v 1.9 2000/12/10 02:43:28 tom Exp $") /* * This function reallocates NCURSES window structures. It is invoked in @@ -53,71 +53,74 @@ MODULE_ID("$From: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Ex * Because this performs memory allocation, it should not (in general) be * invoked directly from the signal handler. */ -int +NCURSES_EXPORT(int) resizeterm(int ToLines, int ToCols) { - int stolen = screen_lines - SP->_lines_avail; - int bottom = screen_lines + SP->_topstolen - stolen; + int stolen = screen_lines - SP->_lines_avail; + int bottom = screen_lines + SP->_topstolen - stolen; - T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), - ToLines, ToCols, - screen_lines, screen_columns)); + T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + ToLines, ToCols, + screen_lines, screen_columns)); - SP->_sig_winch = FALSE; + SP->_sig_winch = FALSE; - if (ToLines != screen_lines - || ToCols != screen_columns) { - WINDOWLIST *wp; + if (ToLines != screen_lines + || ToCols != screen_columns) { + WINDOWLIST *wp; #if USE_SIGWINCH - ungetch(KEY_RESIZE); /* so application can know this */ - clearok(curscr, TRUE); /* screen contents are unknown */ + ungetch(KEY_RESIZE); /* so application can know this */ + clearok(curscr, TRUE); /* screen contents are unknown */ #endif - for (wp = _nc_windows; wp != 0; wp = wp->next) { - WINDOW *win = wp->win; - int myLines = win->_maxy + 1; - int myCols = win->_maxx + 1; - - /* pads aren't treated this way */ - if (win->_flags & _ISPAD) - continue; - - if (win->_begy >= bottom) { - win->_begy += (ToLines - screen_lines); - } else { - if (myLines == screen_lines - stolen - && ToLines != screen_lines) - myLines = ToLines - stolen; - else - if (myLines == screen_lines - && ToLines != screen_lines) - myLines = ToLines; - } - - if (myCols == screen_columns - && ToCols != screen_columns) - myCols = ToCols; - - if (wresize(win, myLines, myCols) != OK) - returnCode(ERR); - } - - screen_lines = lines = ToLines; - screen_columns = columns = ToCols; - - SP->_lines_avail = lines - stolen; - - if (SP->oldhash) { FreeAndNull(SP->oldhash); } - if (SP->newhash) { FreeAndNull(SP->newhash); } + for (wp = _nc_windows; wp != 0; wp = wp->next) { + WINDOW *win = wp->win; + int myLines = win->_maxy + 1; + int myCols = win->_maxx + 1; + + /* pads aren't treated this way */ + if (win->_flags & _ISPAD) + continue; + + if (win->_begy >= bottom) { + win->_begy += (ToLines - screen_lines); + } else { + if (myLines == screen_lines - stolen + && ToLines != screen_lines) + myLines = ToLines - stolen; + else if (myLines == screen_lines + && ToLines != screen_lines) + myLines = ToLines; + } + + if (myCols == screen_columns + && ToCols != screen_columns) + myCols = ToCols; + + if (wresize(win, myLines, myCols) != OK) + returnCode(ERR); } - /* - * Always update LINES, to allow for call from lib_doupdate.c which - * needs to have the count adjusted by the stolen (ripped off) lines. - */ - LINES = ToLines - stolen; - COLS = ToCols; + screen_lines = lines = ToLines; + screen_columns = columns = ToCols; - returnCode(OK); + SP->_lines_avail = lines - stolen; + + if (SP->oldhash) { + FreeAndNull(SP->oldhash); + } + if (SP->newhash) { + FreeAndNull(SP->newhash); + } + } + + /* + * Always update LINES, to allow for call from lib_doupdate.c which + * needs to have the count adjusted by the stolen (ripped off) lines. + */ + LINES = ToLines - stolen; + COLS = ToCols; + + returnCode(OK); } diff --git a/lib/libcurses/base/safe_sprintf.c b/lib/libcurses/base/safe_sprintf.c index d344b79463e..616a50127c7 100644 --- a/lib/libcurses/base/safe_sprintf.c +++ b/lib/libcurses/base/safe_sprintf.c @@ -1,7 +1,7 @@ -/* $OpenBSD: safe_sprintf.c,v 1.3 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: safe_sprintf.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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 * @@ -35,11 +35,13 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$From: safe_sprintf.c,v 1.11 1999/09/11 18:03:27 tom Exp $") +MODULE_ID("$From: safe_sprintf.c,v 1.13 2000/12/10 02:43:28 tom Exp $") #if USE_SAFE_SPRINTF -typedef enum { Flags, Width, Prec, Type, Format } PRINTF; +typedef enum { + Flags, Width, Prec, Type, Format +} PRINTF; #define VA_INTGR(type) ival = va_arg(ap, type) #define VA_FLOAT(type) fval = va_arg(ap, type) @@ -52,190 +54,193 @@ typedef enum { Flags, Width, Prec, Type, Format } PRINTF; static int _nc_printf_length(const char *fmt, va_list ap) { - size_t length = BUFSIZ; - char *buffer; - char *format; - int len = 0; - - if (fmt == 0 || *fmt == '\0') - return -1; - if ((format = typeMalloc(char, strlen(fmt)+1)) == 0) - return -1; - if ((buffer = typeMalloc(char, length)) == 0) { - free(format); - return -1; - } - - while (*fmt != '\0') { - if (*fmt == '%') { - static char dummy[] = ""; - PRINTF state = Flags; - char *pval = dummy; /* avoid const-cast */ - double fval = 0.0; - int done = FALSE; - int ival = 0; - int prec = -1; - int type = 0; - int used = 0; - int width = -1; - size_t f = 0; - - format[f++] = *fmt; - while (*++fmt != '\0' && len >= 0 && !done) { - format[f++] = *fmt; - - if (isdigit(*fmt)) { - int num = *fmt - '0'; - if (state == Flags && num != 0) - state = Width; - if (state == Width) { - if (width < 0) - width = 0; - width = (width * 10) + num; - } else if (state == Prec) { - if (prec < 0) - prec = 0; - prec = (prec * 10) + num; - } - } else if (*fmt == '*') { - VA_INTGR(int); - if (state == Flags) - state = Width; - if (state == Width) { - width = ival; - } else if (state == Prec) { - prec = ival; - } - sprintf(&format[--f], "%d", ival); - f = strlen(format); - } else if (isalpha(*fmt)) { - done = TRUE; - switch (*fmt) { - case 'Z': /* FALLTHRU */ - case 'h': /* FALLTHRU */ - case 'l': /* FALLTHRU */ - done = FALSE; - type = *fmt; - break; - case 'i': /* FALLTHRU */ - case 'd': /* FALLTHRU */ - case 'u': /* FALLTHRU */ - case 'x': /* FALLTHRU */ - case 'X': /* FALLTHRU */ - if (type == 'l') - VA_INTGR(long); - else if (type == 'Z') - VA_INTGR(size_t); - else - VA_INTGR(int); - used = 'i'; - break; - case 'f': /* FALLTHRU */ - case 'e': /* FALLTHRU */ - case 'E': /* FALLTHRU */ - case 'g': /* FALLTHRU */ - case 'G': /* FALLTHRU */ - VA_FLOAT(double); - used = 'f'; - break; - case 'c': - VA_INTGR(int); - used = 'i'; - break; - case 's': - VA_POINT(char *); - if (prec < 0) - prec = strlen(pval); - if (prec > (int)length) { - length = length + prec; - buffer = typeRealloc(char, length, buffer); - if (buffer == 0) { - free(format); - return -1; - } - } - used = 'p'; - break; - case 'p': - VA_POINT(void *); - used = 'p'; - break; - case 'n': - VA_POINT(int *); - used = 0; - break; - default: - break; - } - } else if (*fmt == '.') { - state = Prec; - } else if (*fmt == '%') { - done = TRUE; - used = 'p'; - } - } - format[f] = '\0'; - switch (used) { - case 'i': - sprintf(buffer, format, ival); - break; - case 'f': - sprintf(buffer, format, fval); - break; - default: - sprintf(buffer, format, pval); - break; + size_t length = BUFSIZ; + char *buffer; + char *format; + int len = 0; + + if (fmt == 0 || *fmt == '\0') + return -1; + if ((format = typeMalloc(char, strlen(fmt) + 1)) == 0) + return -1; + if ((buffer = typeMalloc(char, length)) == 0) { + free(format); + return -1; + } + + while (*fmt != '\0') { + if (*fmt == '%') { + static char dummy[] = ""; + PRINTF state = Flags; + char *pval = dummy; /* avoid const-cast */ + double fval = 0.0; + int done = FALSE; + int ival = 0; + int prec = -1; + int type = 0; + int used = 0; + int width = -1; + size_t f = 0; + + format[f++] = *fmt; + while (*++fmt != '\0' && len >= 0 && !done) { + format[f++] = *fmt; + + if (isdigit(*fmt)) { + int num = *fmt - '0'; + if (state == Flags && num != 0) + state = Width; + if (state == Width) { + if (width < 0) + width = 0; + width = (width * 10) + num; + } else if (state == Prec) { + if (prec < 0) + prec = 0; + prec = (prec * 10) + num; + } + } else if (*fmt == '*') { + VA_INTGR(int); + if (state == Flags) + state = Width; + if (state == Width) { + width = ival; + } else if (state == Prec) { + prec = ival; + } + sprintf(&format[--f], "%d", ival); + f = strlen(format); + } else if (isalpha(*fmt)) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INTGR(long); + else if (type == 'Z') + VA_INTGR(size_t); + else + VA_INTGR(int); + used = 'i'; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLOAT(double); + used = 'f'; + break; + case 'c': + VA_INTGR(int); + used = 'i'; + break; + case 's': + VA_POINT(char *); + if (prec < 0) + prec = strlen(pval); + if (prec > (int) length) { + length = length + prec; + buffer = typeRealloc(char, length, buffer); + if (buffer == 0) { + free(format); + return -1; + } } - len += (int)strlen(buffer); - } else { - fmt++; - len++; + used = 'p'; + break; + case 'p': + VA_POINT(void *); + used = 'p'; + break; + case 'n': + VA_POINT(int *); + used = 0; + break; + default: + break; + } + } else if (*fmt == '.') { + state = Prec; + } else if (*fmt == '%') { + done = TRUE; + used = 'p'; } + } + format[f] = '\0'; + switch (used) { + case 'i': + sprintf(buffer, format, ival); + break; + case 'f': + sprintf(buffer, format, fval); + break; + default: + sprintf(buffer, format, pval); + break; + } + len += (int) strlen(buffer); + } else { + fmt++; + len++; } + } - free(buffer); - free(format); - return len; + free(buffer); + free(format); + return len; } #endif /* * Wrapper for vsprintf that allocates a buffer big enough to hold the result. */ -char * -_nc_printf_string(const char *fmt, va_list ap) +NCURSES_EXPORT(char *) +_nc_printf_string +(const char *fmt, va_list ap) { #if USE_SAFE_SPRINTF - char *buf = 0; - int len = _nc_printf_length(fmt, ap); - - if (len > 0) { - if ((buf = typeMalloc(char, len+1)) == 0) - return(0); - vsprintf(buf, fmt, ap); - } + char *buf = 0; + int len = _nc_printf_length(fmt, ap); + + if (len > 0) { + if ((buf = typeMalloc(char, len + 1)) == 0) + return (0); + vsprintf(buf, fmt, ap); + } #else - static int rows, cols; - static char *buf; - static size_t len; - - if (screen_lines > rows || screen_columns > cols) { - if (screen_lines > rows) rows = screen_lines; - if (screen_columns > cols) cols = screen_columns; - len = (rows * (cols + 1)) + 1; - buf = typeRealloc(char, len, buf); - if (buf == 0) { - return(0); - } + static int rows, cols; + static char *buf; + static size_t len; + + if (screen_lines > rows || screen_columns > cols) { + if (screen_lines > rows) + rows = screen_lines; + if (screen_columns > cols) + cols = screen_columns; + len = (rows * (cols + 1)) + 1; + buf = typeRealloc(char, len, buf); + if (buf == 0) { + return (0); } + } - if (buf != 0) { + if (buf != 0) { # if HAVE_VSNPRINTF - vsnprintf(buf, len, fmt, ap); /* GNU extension */ + vsnprintf(buf, len, fmt, ap); /* GNU extension */ # else - vsprintf(buf, fmt, ap); /* ANSI */ + vsprintf(buf, fmt, ap); /* ANSI */ # endif - } + } #endif - return buf; + return buf; } diff --git a/lib/libcurses/base/sigaction.c b/lib/libcurses/base/sigaction.c index 71ab97bbaf7..f25543c4dea 100644 --- a/lib/libcurses/base/sigaction.c +++ b/lib/libcurses/base/sigaction.c @@ -1,7 +1,7 @@ -/* $OpenBSD: sigaction.c,v 1.3 1999/06/27 08:14:21 millert Exp $ */ +/* $OpenBSD: sigaction.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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 * @@ -43,66 +43,78 @@ #if !HAVE_SIGACTION && HAVE_SIGVEC -MODULE_ID("$From: sigaction.c,v 1.9 1999/06/19 23:05:16 tom Exp $") +MODULE_ID("$From: sigaction.c,v 1.11 2000/12/10 02:43:28 tom Exp $") -int -sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact) +NCURSES_EXPORT(int) +sigaction +(int sig, sigaction_t * sigact, sigaction_t * osigact) { - return sigvec(sig, sigact, osigact); + return sigvec(sig, sigact, osigact); } -int -sigemptyset (sigset_t * mask) +NCURSES_EXPORT(int) +sigemptyset +(sigset_t * mask) { - *mask = 0; - return 0; + *mask = 0; + return 0; } -int -sigprocmask (int mode, sigset_t * mask, sigset_t * omask) +NCURSES_EXPORT(int) +sigprocmask +(int mode, sigset_t * mask, sigset_t * omask) { - sigset_t current = sigsetmask(0); + sigset_t current = sigsetmask(0); - if (omask) *omask = current; + if (omask) + *omask = current; - if (mode==SIG_BLOCK) - current |= *mask; - else if (mode==SIG_UNBLOCK) - current &= ~*mask; - else if (mode==SIG_SETMASK) - current = *mask; + if (mode == SIG_BLOCK) + current |= *mask; + else if (mode == SIG_UNBLOCK) + current &= ~*mask; + else if (mode == SIG_SETMASK) + current = *mask; - sigsetmask(current); - return 0; + sigsetmask(current); + return 0; } -int -sigsuspend (sigset_t * mask) +NCURSES_EXPORT(int) +sigsuspend(sigset_t * mask) { - return sigpause (*mask); + return sigpause(*mask); } -int -sigdelset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigdelset +(sigset_t * mask, int sig) { - *mask &= ~sigmask (sig); - return 0; + *mask &= ~sigmask(sig); + return 0; } -int -sigaddset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigaddset +(sigset_t * mask, int sig) { - *mask |= sigmask (sig); - return 0; + *mask |= sigmask(sig); + return 0; } -int -sigismember (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigismember +(sigset_t * mask, int sig) { - return (*mask & sigmask (sig)) != 0; + return (*mask & sigmask(sig)) != 0; } #else -extern void _nc_sigaction(void); /* quiet's gcc warning */ -void _nc_sigaction(void) { } /* nonempty for strict ANSI compilers */ +extern +NCURSES_EXPORT(void) +_nc_sigaction(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_sigaction(void) +{ +} /* nonempty for strict ANSI compilers */ #endif diff --git a/lib/libcurses/base/tries.c b/lib/libcurses/base/tries.c index 11c57829141..15d48289d49 100644 --- a/lib/libcurses/base/tries.c +++ b/lib/libcurses/base/tries.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tries.c,v 1.3 1999/03/02 06:23:27 millert Exp $ */ +/* $OpenBSD: tries.c,v 1.4 2001/01/22 18:01:48 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,100 +41,106 @@ #include <curses.priv.h> -MODULE_ID("$From: tries.c,v 1.12 1999/03/01 23:23:59 tom Exp $") +MODULE_ID("$From: tries.c,v 1.14 2000/12/10 02:43:28 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if * no match was found, otherwise allocating a string of the result. */ -char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len) +NCURSES_EXPORT(char *) +_nc_expand_try +(struct tries *tree, unsigned short code, int *count, size_t len) { - struct tries *ptr = tree; - char *result = 0; + struct tries *ptr = tree; + char *result = 0; - if (code != 0) { - while (ptr != 0) { - if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) != 0) { - break; - } - if (ptr->value == code) { - *count -= 1; - if (*count == -1) { - result = typeCalloc(char, len+2); - break; - } - } - ptr = ptr->sibling; + if (code != 0) { + while (ptr != 0) { + if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) + != 0) { + break; + } + if (ptr->value == code) { + *count -= 1; + if (*count == -1) { + result = typeCalloc(char, len + 2); + break; } + } + ptr = ptr->sibling; } - if (result != 0) { - if ((result[len] = ptr->ch) == 0) - *((unsigned char *)(result+len)) = 128; + } + if (result != 0) { + if ((result[len] = ptr->ch) == 0) + *((unsigned char *) (result + len)) = 128; #ifdef TRACE - if (len == 0) - _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); + if (len == 0) + _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); #endif - } - return result; + } + return result; } /* * Remove a code from the specified tree, freeing the unused nodes. Returns * true if the code was found/removed. */ -int _nc_remove_key(struct tries **tree, unsigned short code) +NCURSES_EXPORT(int) +_nc_remove_key +(struct tries **tree, unsigned short code) { - T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); + T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); - if (code == 0) - returnCode(FALSE); - - while (*tree != 0) { - if (_nc_remove_key(&(*tree)->child, code)) { - returnCode(TRUE); - } - if ((*tree)->value == code) { - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (code == 0) returnCode(FALSE); + + while (*tree != 0) { + if (_nc_remove_key(&(*tree)->child, code)) { + returnCode(TRUE); + } + if ((*tree)->value == code) { + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } /* * Remove a string from the specified tree, freeing the unused nodes. Returns * true if the string was found/removed. */ -int _nc_remove_string(struct tries **tree, char *string) +NCURSES_EXPORT(int) +_nc_remove_string(struct tries **tree, char *string) { - T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); + T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); - if (string == 0 || *string == 0) - returnCode(FALSE); - - while (*tree != 0) { - if ((unsigned char)(*tree)->ch == (unsigned char)*string) { - if (string[1] != 0) - returnCode(_nc_remove_string(&(*tree)->child, string+1)); - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (string == 0 || *string == 0) returnCode(FALSE); + + while (*tree != 0) { + if ((unsigned char) (*tree)->ch == (unsigned char) *string) { + if (string[1] != 0) + returnCode(_nc_remove_string(&(*tree)->child, string + 1)); + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } diff --git a/lib/libcurses/base/version.c b/lib/libcurses/base/version.c index df07a6f9dc0..d404e11d6ed 100644 --- a/lib/libcurses/base/version.c +++ b/lib/libcurses/base/version.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -32,16 +32,16 @@ #include <curses.priv.h> -MODULE_ID("$From: version.c,v 1.1 1999/10/23 13:28:49 tom Exp $") +MODULE_ID("$From: version.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -const char * +NCURSES_EXPORT(const char *) curses_version(void) { static char my_version[80]; T((T_CALLED("curses_version()"))); sprintf(my_version, "ncurses %s.%d", - NCURSES_VERSION, - NCURSES_VERSION_PATCH); + NCURSES_VERSION, + NCURSES_VERSION_PATCH); returnPtr(my_version); } diff --git a/lib/libcurses/base/wresize.c b/lib/libcurses/base/wresize.c index 9eacdbf6a0d..d513f29b9d3 100644 --- a/lib/libcurses/base/wresize.c +++ b/lib/libcurses/base/wresize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wresize.c,v 1.3 2000/03/10 01:35:03 millert Exp $ */ +/* $OpenBSD: wresize.c,v 1.4 2001/01/22 18:01:49 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ #include <curses.priv.h> -MODULE_ID("$From: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") +MODULE_ID("$From: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -46,7 +46,7 @@ MODULE_ID("$From: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") #define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) #define c_ALLOC(p,n) DOALLOC(p,chtype,n) -int +NCURSES_EXPORT(int) wresize(WINDOW *win, int ToLines, int ToCols) { register int row; @@ -58,9 +58,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); if (win) { TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...before", win); } @@ -171,9 +171,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) #ifdef TRACE TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...after:", win); #endif diff --git a/lib/libcurses/curs_deleteln.3 b/lib/libcurses/curs_deleteln.3 index 938c5e40aa7..69699b7d430 100644 --- a/lib/libcurses/curs_deleteln.3 +++ b/lib/libcurses/curs_deleteln.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: curs_deleteln.3,v 1.7 2000/07/10 03:06:06 millert Exp $ +.\" $OpenBSD: curs_deleteln.3,v 1.8 2001/01/22 18:01:33 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_deleteln.3x,v 1.6 2000/07/01 19:56:12 tom Exp $ +.\" $From: curs_deleteln.3x,v 1.7 2000/11/11 20:43:20 Bernhard.Rosenkraenzer Exp $ .TH curs_deleteln 3 "" .SH NAME \fBdeleteln\fR, @@ -63,7 +63,7 @@ bottom lines are lost. For negative \fIn\fR, delete \fIn\fR lines (starting with the one under the cursor), and move the remaining lines up. The bottom \fIn\fR lines are cleared. The current cursor position remains the same. -The \fBinsertln\fR and \fBinsertln\fR routines, insert a blank line above the +The \fBinsertln\fR and \fBwinsertln\fR routines, insert a blank line above the current line and the bottom line is lost. .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 diff --git a/lib/libcurses/curses.3tbl b/lib/libcurses/curses.3tbl index 434f675bf54..8ee2a5657bf 100644 --- a/lib/libcurses/curses.3tbl +++ b/lib/libcurses/curses.3tbl @@ -1,5 +1,5 @@ '\" t -.\" $OpenBSD: curses.3tbl,v 1.17 2000/10/10 15:10:29 millert Exp $ +.\" $OpenBSD: curses.3tbl,v 1.18 2001/01/22 18:01:33 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,1999 Free Software Foundation, Inc. * @@ -29,7 +29,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: ncurses.3x,v 1.44 2000/10/08 01:39:26 tom Exp $ +.\" $From: ncurses.3x,v 1.46 2000/11/25 21:58:45 tom Exp $ .TH ncurses 3 "" .ds n 5 .ds d /usr/share/terminfo diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index e738eee8088..cd125521da8 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.56 2000/12/06 17:18:49 deraadt Exp $ */ +/* $OpenBSD: curses.h,v 1.57 2001/01/22 18:01:33 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: curses.h.in,v 1.96 2000/09/16 16:11:01 tom Exp $ */ +/* $From: curses.h.in,v 1.97 2000/12/10 02:00:24 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -50,12 +50,25 @@ /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 5 #define NCURSES_VERSION_MINOR 2 -#define NCURSES_VERSION_PATCH 20001021 +#define NCURSES_VERSION_PATCH 20010114 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef NCURSES_NOMACROS #define NCURSES_ATTR_T attr_t #endif @@ -125,8 +138,8 @@ extern "C" { #define WA_VERTICAL A_VERTICAL /* colors */ -extern int COLORS; -extern int COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; #define COLOR_BLACK 0 #define COLOR_RED 1 @@ -139,7 +152,7 @@ extern int COLOR_PAIRS; /* line graphics */ -extern chtype acs_map[]; +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; /* VT100 symbols begin here */ #define ACS_ULCORNER (acs_map['l']) /* upper left corner */ @@ -306,33 +319,33 @@ struct _win_st NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ }; -extern WINDOW *stdscr; -extern WINDOW *curscr; -extern WINDOW *newscr; +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; -extern int LINES; -extern int COLS; -extern int TABSIZE; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) TABSIZE; /* * This global was an undocumented feature under AIX curses. */ -extern int ESCDELAY; /* ESC expire time in milliseconds */ +extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */ -extern char ttytype[]; /* needed for backward compatibility */ +extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */ /* * These functions are extensions - not in XSI Curses. */ -extern char *keybound (int, int); -extern const char *curses_version (void); -extern int assume_default_colors (int, int); -extern int define_key (char *, int); -extern int keyok (int, bool); -extern int resizeterm (int, int); -extern int use_default_colors (void); -extern int use_extended_names (bool); -extern int wresize (WINDOW *, int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (char *, int); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); /* * GCC (and some other compilers) define '__attribute__'; we're using this @@ -386,478 +399,478 @@ extern int wresize (WINDOW *, int, int); * requirements. */ -extern int addch(const chtype); /* generated */ -extern int addchnstr(const chtype *, int); /* generated */ -extern int addchstr(const chtype *); /* generated */ -extern int addnstr(const char *, int); /* generated */ -extern int addstr(const char *); /* generated */ +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int addnwstr(const wchar_t *, int); /* missing */ -extern int addwstr(const wchar_t *); /* missing */ -extern int add_wch(const cchar_t *); /* missing */ -extern int add_wchnstr(const cchar_t *, int); /* missing */ -extern int add_wchstr(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int attroff(NCURSES_ATTR_T); /* generated */ -extern int attron(NCURSES_ATTR_T); /* generated */ -extern int attrset(NCURSES_ATTR_T); /* generated */ -extern int attr_get(attr_t *, short *, void *); /* generated */ -extern int attr_off(attr_t, void *); /* generated */ -extern int attr_on(attr_t, void *); /* generated */ -extern int attr_set(attr_t, short, void *); /* generated */ -extern int baudrate(void); /* implemented */ -extern int beep(void); /* implemented */ -extern int bkgd(chtype); /* generated */ -extern void bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void bkgrndset(const cchar_t *); /* missing */ -extern int bkgrnd(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int border_set(const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int box(WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int box_set(WINDOW *, const cchar_t *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool can_change_color(void); /* implemented */ -extern int cbreak(void); /* implemented */ -extern int chgat(int, attr_t, short, const void *); /* generated */ -extern int clear(void); /* generated */ -extern int clearok(WINDOW *,bool); /* implemented */ -extern int clrtobot(void); /* generated */ -extern int clrtoeol(void); /* generated */ -extern int color_content(short,short*,short*,short*); /* implemented */ -extern int color_set(short,void*); /* generated */ -extern int COLOR_PAIR(int); /* generated */ -extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ -extern int curs_set(int); /* implemented */ -extern int def_prog_mode(void); /* implemented */ -extern int def_shell_mode(void); /* implemented */ -extern int delay_output(int); /* implemented */ -extern int delch(void); /* generated */ -extern void delscreen(SCREEN *); /* implemented */ -extern int delwin(WINDOW *); /* implemented */ -extern int deleteln(void); /* generated */ -extern WINDOW *derwin(WINDOW *,int,int,int,int); /* implemented */ -extern int doupdate(void); /* implemented */ -extern WINDOW *dupwin(WINDOW *); /* implemented */ -extern int echo(void); /* implemented */ -extern int echochar(const chtype); /* generated */ -extern int erase(void); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int echo_wchar(const cchar_t *); /* missing */ -extern int erasewchar(wchar_t*); /* missing */ +extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int endwin(void); /* implemented */ -extern char erasechar(void); /* implemented */ -extern void filter(void); /* implemented */ -extern int flash(void); /* implemented */ -extern int flushinp(void); /* implemented */ -extern chtype getbkgd(WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getbkgrnd(cchar_t *); /* missing */ -extern int getcchar(const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ +extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getch(void); /* generated */ -extern int getnstr(char *, int); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getn_wstr(wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getstr(char *); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wch(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wch (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern WINDOW *getwin(FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wstr(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int halfdelay(int); /* implemented */ -extern bool has_colors(void); /* implemented */ -extern bool has_ic(void); /* implemented */ -extern bool has_il(void); /* implemented */ -extern int hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int hline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern void idcok(WINDOW *, bool); /* implemented */ -extern int idlok(WINDOW *, bool); /* implemented */ -extern void immedok(WINDOW *, bool); /* implemented */ -extern chtype inch(void); /* generated */ -extern int inchnstr(chtype *, int); /* generated */ -extern int inchstr(chtype *); /* generated */ -extern WINDOW *initscr(void); /* implemented */ -extern int init_color(short,short,short,short); /* implemented */ -extern int init_pair(short,short,short); /* implemented */ -extern int innstr(char *, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int innwstr(wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int insch(chtype); /* generated */ -extern int insdelln(int); /* generated */ -extern int insertln(void); /* generated */ -extern int insnstr(const char *, int); /* generated */ -extern int insstr(const char *); /* generated */ -extern int instr(char *); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int ins_nwstr(const wchar_t *, int); /* missing */ -extern int ins_wch(const cchar_t *); /* missing */ -extern int ins_wstr(const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int intrflush(WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int inwstr(wchar_t *); /* missing */ -extern int in_wch(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchstr(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchnstr(NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wch (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchstr (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchnstr (NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool isendwin(void); /* implemented */ -extern bool is_linetouched(WINDOW *,int); /* implemented */ -extern bool is_wintouched(WINDOW *); /* implemented */ -extern NCURSES_CONST char *keyname(int); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern char *key_name(wchar_t); /* missing */ +extern NCURSES_EXPORT(char *) key_name (wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int keypad(WINDOW *,bool); /* implemented */ -extern char killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int killwchar(wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int leaveok(WINDOW *,bool); /* implemented */ -extern char *longname(void); /* implemented */ -extern int meta(WINDOW *,bool); /* implemented */ -extern int move(int, int); /* generated */ -extern int mvaddch(int, int, const chtype); /* generated */ -extern int mvaddchnstr(int, int, const chtype *, int); /* generated */ -extern int mvaddchstr(int, int, const chtype *); /* generated */ -extern int mvaddnstr(int, int, const char *, int); /* generated */ -extern int mvaddstr(int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvaddnwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvaddwstr(int, int, const wchar_t *); /* missing */ -extern int mvadd_wch(int, int, const cchar_t *); /* missing */ -extern int mvadd_wchnstr(int, int, const cchar_t *, int);/* missing */ -extern int mvadd_wchstr(int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvchgat(int, int, int, attr_t, short, const void *); /* generated */ -extern int mvcur(int,int,int,int); /* implemented */ -extern int mvdelch(int, int); /* generated */ -extern int mvderwin(WINDOW *, int, int); /* implemented */ -extern int mvgetch(int, int); /* generated */ -extern int mvgetnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvgetn_wstr(int, int, wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvgetstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wch(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wstr(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvhline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype mvinch(int, int); /* generated */ -extern int mvinchnstr(int, int, chtype *, int); /* generated */ -extern int mvinchstr(int, int, chtype *); /* generated */ -extern int mvinnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvinnwstr(int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvinsch(int, int, chtype); /* generated */ -extern int mvinsnstr(int, int, const char *, int); /* generated */ -extern int mvinsstr(int, int, const char *); /* generated */ -extern int mvinstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvins_nwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvins_wch(int, int, const cchar_t *); /* missing */ -extern int mvins_wstr(int, int, const wchar_t *); /* missing */ -extern int mvinwstr(int, int, wchar_t *); /* missing */ -extern int mvin_wch(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchstr(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchnstr(int, int, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wch (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchstr (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(3,4); -extern int mvscanw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(3,4); -extern int mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvvline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwaddch(WINDOW *, int, int, const chtype); /* generated */ -extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);/* generated */ -extern int mvwaddchstr(WINDOW *, int, int, const chtype *); /* generated */ -extern int mvwaddnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwaddstr(WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);/* missing */ -extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); /* missing */ -extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ -extern int mvwdelch(WINDOW *, int, int); /* generated */ -extern int mvwgetch(WINDOW *, int, int); /* generated */ -extern int mvwgetnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwgetstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wch(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wstr(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwhline(WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwin(WINDOW *,int,int); /* implemented */ -extern chtype mvwinch(WINDOW *, int, int); /* generated */ -extern int mvwinchnstr(WINDOW *, int, int, chtype *, int); /* generated */ -extern int mvwinchstr(WINDOW *, int, int, chtype *); /* generated */ -extern int mvwinnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwinsch(WINDOW *, int, int, chtype); /* generated */ -extern int mvwinsnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwinsstr(WINDOW *, int, int, const char *); /* generated */ -extern int mvwinstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */ -extern int mvwins_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwinwstr(WINDOW *, int, int, wchar_t *); /* missing */ -extern int mvwin_wch(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvwin_wchnstr(WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ -extern int mvwin_wchstr(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(4,5); -extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(4,5); -extern int mvwvline(WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int napms(int); /* implemented */ -extern WINDOW *newpad(int,int); /* implemented */ -extern SCREEN *newterm(NCURSES_CONST char *,FILE *,FILE *); /* implemented */ -extern WINDOW *newwin(int,int,int,int); /* implemented */ -extern int nl(void); /* implemented */ -extern int nocbreak(void); /* implemented */ -extern int nodelay(WINDOW *,bool); /* implemented */ -extern int noecho(void); /* implemented */ -extern int nonl(void); /* implemented */ -extern void noqiflush(void); /* implemented */ -extern int noraw(void); /* implemented */ -extern int notimeout(WINDOW *,bool); /* implemented */ -extern int overlay(const WINDOW*,WINDOW *); /* implemented */ -extern int overwrite(const WINDOW*,WINDOW *); /* implemented */ -extern int pair_content(short,short*,short*); /* implemented */ -extern int PAIR_NUMBER(int); /* generated */ -extern int pechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int pecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */ -extern int prefresh(WINDOW *,int,int,int,int,int,int); /* implemented */ -extern int printw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(1,2); -extern int putp(const char *); /* implemented */ -extern int putwin(WINDOW *, FILE *); /* implemented */ -extern void qiflush(void); /* implemented */ -extern int raw(void); /* implemented */ -extern int redrawwin(WINDOW *); /* generated */ -extern int refresh(void); /* generated */ -extern int resetty(void); /* implemented */ -extern int reset_prog_mode(void); /* implemented */ -extern int reset_shell_mode(void); /* implemented */ -extern int ripoffline(int, int (*init)(WINDOW *, int)); /* implemented */ -extern int savetty(void); /* implemented */ -extern int scanw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*init)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(1,2); -extern int scr_dump(const char *); /* implemented */ -extern int scr_init(const char *); /* implemented */ -extern int scrl(int); /* generated */ -extern int scroll(WINDOW *); /* generated */ -extern int scrollok(WINDOW *,bool); /* implemented */ -extern int scr_restore(const char *); /* implemented */ -extern int scr_set(const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int setscrreg(int,int); /* generated */ -extern SCREEN *set_term(SCREEN *); /* implemented */ -extern int slk_attroff(const chtype); /* implemented */ -extern int slk_attr_off(const attr_t, void *); /* generated:WIDEC */ -extern int slk_attron(const chtype); /* implemented */ -extern int slk_attr_on(attr_t,void*); /* generated:WIDEC */ -extern int slk_attrset(const chtype); /* implemented */ -extern attr_t slk_attr(void); /* implemented */ -extern int slk_attr_set(const attr_t,short,void*); /* implemented */ -extern int slk_clear(void); /* implemented */ -extern int slk_color(short); /* implemented */ -extern int slk_init(int); /* implemented */ -extern char *slk_label(int); /* implemented */ -extern int slk_noutrefresh(void); /* implemented */ -extern int slk_refresh(void); /* implemented */ -extern int slk_restore(void); /* implemented */ -extern int slk_set(int,const char *,int); /* implemented */ -extern int slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_wset(int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int standout(void); /* generated */ -extern int standend(void); /* generated */ -extern int start_color(void); /* implemented */ -extern WINDOW *subpad(WINDOW *, int, int, int, int); /* implemented */ -extern WINDOW *subwin(WINDOW *,int,int,int,int); /* implemented */ -extern int syncok(WINDOW *, bool); /* implemented */ -extern chtype termattrs(void); /* implemented */ -extern attr_t term_attrs(void); /* missing */ -extern char *termname(void); /* implemented */ -extern int tigetflag(NCURSES_CONST char *); /* implemented */ -extern int tigetnum(NCURSES_CONST char *); /* implemented */ -extern char *tigetstr(NCURSES_CONST char *); /* implemented */ -extern void timeout(int); /* generated */ -extern int touchline(WINDOW *, int, int); /* generated */ -extern int touchwin(WINDOW *); /* generated */ -extern char *tparm(NCURSES_CONST char *, ...); /* implemented */ -extern int typeahead(int); /* implemented */ -extern int ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs (void); /* missing */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* implemented */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int unget_wch(const wchar_t); /* missing */ +extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int untouchwin(WINDOW *); /* generated */ -extern void use_env(bool); /* implemented */ -extern int vidattr(chtype); /* implemented */ -extern int vid_attr(attr_t, short, void *); /* generated:WIDEC */ -extern int vidputs(chtype, int (*)(int)); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vwprintw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_printw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int vwscanw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_scanw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int waddch(WINDOW *, const chtype); /* implemented */ -extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */ -extern int waddchstr(WINDOW *,const chtype *); /* generated */ -extern int waddnstr(WINDOW *,const char *const,int); /* implemented */ -extern int waddstr(WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int waddwstr(WINDOW *,const wchar_t *); /* missing */ -extern int waddnwstr(WINDOW *,const wchar_t *,int); /* missing */ -extern int wadd_wch(WINDOW *,const cchar_t *); /* missing */ -extern int wadd_wchnstr(WINDOW *,const cchar_t *,int); /* missing */ -extern int wadd_wchstr(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wattron(WINDOW *, int); /* generated */ -extern int wattroff(WINDOW *, int); /* generated */ -extern int wattrset(WINDOW *, int); /* generated */ -extern int wattr_get(WINDOW *, attr_t *, short *, void *); /* generated */ -extern int wattr_on(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_off(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_set(WINDOW *, attr_t, short, void *); /* generated */ -extern int wbkgd(WINDOW *,const chtype); /* implemented */ -extern void wbkgdset(WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void wbkgrndset(WINDOW *,const cchar_t *); /* missing */ -extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wborder_set(WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */ -extern int wclear(WINDOW *); /* implemented */ -extern int wclrtobot(WINDOW *); /* implemented */ -extern int wclrtoeol(WINDOW *); /* implemented */ -extern int wcolor_set(WINDOW*,short,void*); /* implemented */ -extern void wcursyncup(WINDOW *); /* implemented */ -extern int wdelch(WINDOW *); /* implemented */ -extern int wdeleteln(WINDOW *); /* generated */ -extern int wechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int werase(WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetbkgrnd(WINDOW *, cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetch(WINDOW *); /* implemented */ -extern int wgetnstr(WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetn_wstr(WINDOW *,wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wget_wch(WINDOW *, wint_t *); /* missing */ -extern int wget_wstr(WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int whline(WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int whline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype winch(WINDOW *); /* implemented */ -extern int winchnstr(WINDOW *, chtype *, int); /* implemented */ -extern int winchstr(WINDOW *, chtype *); /* generated */ -extern int winnstr(WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int winnwstr(WINDOW *, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int winsch(WINDOW *, chtype); /* implemented */ -extern int winsdelln(WINDOW *,int); /* implemented */ -extern int winsertln(WINDOW *); /* generated */ -extern int winsnstr(WINDOW *, const char *,int); /* implemented */ -extern int winsstr(WINDOW *, const char *); /* generated */ -extern int winstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wins_nwstr(WINDOW *, const wchar_t *, int); /* missing */ -extern int wins_wch(WINDOW *, const cchar_t *); /* missing */ -extern int wins_wstr(WINDOW *, const wchar_t *); /* missing */ -extern int winwstr(WINDOW *, wchar_t *); /* missing */ -extern int win_wch(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ -extern int win_wchnstr(WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ -extern int win_wchstr(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wch (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wmove(WINDOW *,int,int); /* implemented */ -extern int wnoutrefresh(WINDOW *); /* implemented */ -extern int wprintw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(2,3); -extern int wredrawln(WINDOW *,int,int); /* implemented */ -extern int wrefresh(WINDOW *); /* implemented */ -extern int wscanw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(2,3); -extern int wscrl(WINDOW *,int); /* implemented */ -extern int wsetscrreg(WINDOW *,int,int); /* implemented */ -extern int wstandout(WINDOW *); /* generated */ -extern int wstandend(WINDOW *); /* generated */ -extern void wsyncdown(WINDOW *); /* implemented */ -extern void wsyncup(WINDOW *); /* implemented */ -extern void wtimeout(WINDOW *,int); /* implemented */ -extern int wtouchln(WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern wchar_t *wunctrl(cchar_t *); /* missing */ +extern NCURSES_EXPORT(wchar_t *) wunctrl (cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wvline(WINDOW *,chtype,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool mouse_trafo(int*, int*, bool); /* generated */ +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ /* attributes */ @@ -1303,32 +1316,32 @@ typedef struct } MEVENT; -extern int getmouse(MEVENT *); -extern int ungetmouse(MEVENT *); -extern mmask_t mousemask(mmask_t, mmask_t *); -extern bool wenclose(const WINDOW *, int, int); -extern int mouseinterval(int); -extern bool wmouse_trafo(const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) /* other non-XSI functions */ -extern int mcprint(char *, int); /* direct data to printer */ -extern int has_key(int); /* do we have given key? */ +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ /* Debugging : use with libncurses_g.a */ -extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2); -extern void _tracedump(const char *, WINDOW *); -extern char *_traceattr(attr_t); -extern char *_traceattr2(int, chtype); -extern char *_nc_tracebits(void); -extern char *_tracechar(const unsigned char); -extern char *_tracechtype(chtype); -extern char *_tracechtype2(int, chtype); -extern char *_tracemouse(const MEVENT *); -extern void trace(const unsigned int); +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (const unsigned char); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); /* trace masks */ #define TRACE_DISABLE 0x0000 /* turn off tracing */ @@ -1349,8 +1362,8 @@ extern void trace(const unsigned int); #define TRACE_MAXIMUM 0xffff /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) -extern int _nc_optimize_enable; /* enable optimizations */ -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h index 30fff8b8bcf..fd4f605ab45 100644 --- a/lib/libcurses/curses.priv.h +++ b/lib/libcurses/curses.priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.priv.h,v 1.30 2000/10/10 15:10:29 millert Exp $ */ +/* $OpenBSD: curses.priv.h,v 1.31 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,7 +35,7 @@ /* - * $From: curses.priv.h,v 1.168 2000/10/08 01:24:59 tom Exp $ + * $From: curses.priv.h,v 1.171 2000/12/10 00:13:52 tom Exp $ * * curses.priv.h * @@ -47,6 +47,19 @@ #ifndef CURSES_PRIV_H #define CURSES_PRIV_H 1 +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef __cplusplus extern "C" { #endif @@ -158,7 +171,7 @@ extern int errno; #endif #else #define use_terminfo_vars() _nc_env_access() -extern int _nc_env_access(void); +extern NCURSES_EXPORT(int) _nc_env_access (void); #endif /* @@ -169,7 +182,7 @@ extern int _nc_env_access(void); #define memmove(d,s,n) bcopy(s,d,n) #elif USE_MY_MEMMOVE #define memmove(d,s,n) _nc_memmove(d,s,n) -extern void * _nc_memmove(void *, const void *, size_t); +extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t); #endif /* @@ -420,7 +433,7 @@ struct screen { int (*_outch)(int); /* output handler if not putc */ }; -extern SCREEN *_nc_screen_chain; +extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #if NCURSES_NOMACROS #include <nomacros.h> @@ -490,6 +503,7 @@ typedef struct { #define O_BINARY 0 #endif +#define CharOf(c) ((unsigned char)(c)) #define TextOf(c) ((c) & (chtype)A_CHARTEXT) #define AttrOf(c) ((c) & (chtype)A_ATTRIBUTES) @@ -550,14 +564,14 @@ typedef struct { #define returnPtr(code) TRACE_RETURN(code,ptr) #define returnVoid T((T_RETURN(""))); return #define returnWin(code) TRACE_RETURN(code,win) -extern WINDOW * _nc_retrace_win(WINDOW *); -extern attr_t _nc_retrace_attr_t(attr_t); -extern attr_t _nc_retrace_chtype(chtype); -extern char *_nc_retrace_ptr(char *); -extern const char *_nc_tputs_trace; -extern int _nc_retrace_int(int); -extern long _nc_outchars; -extern void _nc_fifo_dump(void); +extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); +extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t); +extern NCURSES_EXPORT(attr_t) _nc_retrace_chtype (chtype); +extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *); +extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; +extern NCURSES_EXPORT(int) _nc_retrace_int (int); +extern NCURSES_EXPORT_VAR(long) _nc_outchars; +extern NCURSES_EXPORT(void) _nc_fifo_dump (void); #else #define T(a) #define TR(n, a) @@ -570,8 +584,8 @@ extern void _nc_fifo_dump(void); #define returnWin(code) return code #endif -extern unsigned _nc_tracing; -extern const char *_nc_visbuf2(int, const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); #define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) @@ -642,27 +656,27 @@ extern const char *_nc_visbuf2(int, const char *); #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) -extern void _nc_toggle_attr_on(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t); #undef toggle_attr_off #define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) -extern void _nc_toggle_attr_off(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t); #undef DelCharCost #define DelCharCost(count) _nc_DelCharCost(count) -extern int _nc_DelCharCost(int); +extern NCURSES_EXPORT(int) _nc_DelCharCost (int); #undef InsCharCost #define InsCharCost(count) _nc_InsCharCost(count) -extern int _nc_InsCharCost(int); +extern NCURSES_EXPORT(int) _nc_InsCharCost (int); #undef UpdateAttrs #define UpdateAttrs(c) _nc_UpdateAttrs(c) -extern void _nc_UpdateAttrs(chtype); +extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype); #else -extern void _nc_expanded(void); +extern NCURSES_EXPORT(void) _nc_expanded (void); #endif @@ -672,33 +686,33 @@ extern void _nc_expanded(void); /* doupdate.c */ #if USE_XMC_SUPPORT -extern void _nc_do_xmc_glitch(attr_t); +extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t); #endif /* hardscroll.c */ #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -extern void _nc_linedump(void); +extern NCURSES_EXPORT(void) _nc_linedump (void); #endif /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ -extern int _nc_msec_cost(const char *const, int); /* used by 'tack' program */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */ /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ -extern void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); /* lib_mouse.c */ -extern int _nc_has_mouse(void); +extern NCURSES_EXPORT(int) _nc_has_mouse (void); /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -710,78 +724,78 @@ typedef struct { } string_desc; /* strings.c */ -extern string_desc *_nc_str_init(string_desc * dst, char *src, size_t len); -extern string_desc *_nc_str_null(string_desc * dst, size_t len); -extern string_desc *_nc_str_copy(string_desc * dst, string_desc * src); -extern bool _nc_safe_strcat(string_desc * dst, const char *src); -extern bool _nc_safe_strcpy(string_desc * dst, const char *src); +extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc * dst, char *src, size_t len); +extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc * dst, size_t len); +extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc * dst, string_desc * src); +extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc * dst, const char *src); +extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc * dst, const char *src); -extern void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); #if !HAVE_STRSTR #define strstr _nc_strstr -extern char *_nc_strstr(const char *, const char *); +extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); #endif /* safe_sprintf.c */ -extern char * _nc_printf_string(const char *fmt, va_list ap); +extern NCURSES_EXPORT(char *) _nc_printf_string (const char *fmt, va_list ap); /* tries.c */ -extern void _nc_add_to_try(struct tries **tree, const char *str, unsigned short code); -extern char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len); -extern int _nc_remove_key(struct tries **tree, unsigned short code); -extern int _nc_remove_string(struct tries **tree, char *string); +extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **tree, const char *str, unsigned short code); +extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *tree, unsigned short code, int *count, size_t len); +extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **tree, unsigned short code); +extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **tree, char *string); /* elsewhere ... */ -extern WINDOW *_nc_makenew(int, int, int, int, int); -extern char *_nc_home_terminfo(void); -extern char *_nc_trace_buf(int, size_t); -extern chtype _nc_background(WINDOW *); -extern chtype _nc_render(WINDOW *, chtype); -extern int _nc_access(const char *, int); -extern int _nc_baudrate(int); -extern int _nc_getenv_num(const char *); -extern int _nc_keypad(bool); -extern int _nc_ospeed(int); -extern int _nc_outch(int); -extern int _nc_setupscreen(short, short const, FILE *); -extern int _nc_timed_wait(int, int, int *); -extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_do_color(int, int, bool, int (*)(int)); -extern void _nc_freeall(void); -extern void _nc_freewin(WINDOW *win); -extern void _nc_hash_map(void); -extern void _nc_init_keytry(void); -extern void _nc_keep_tic_dir(const char *); -extern void _nc_make_oldhash(int i); -extern void _nc_flush(void); -extern void _nc_outstr(const char *str); -extern void _nc_scroll_oldhash(int n, int top, int bot); -extern void _nc_scroll_optimize(void); -extern void _nc_scroll_window(WINDOW *, int const, short const, short const, chtype); -extern void _nc_set_buffer(FILE *, bool); -extern void _nc_signal_handler(bool); -extern void _nc_synchook(WINDOW *win); -extern void _nc_trace_tries(struct tries *tree); +extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int); +extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); +extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t); +extern NCURSES_EXPORT(chtype) _nc_background (WINDOW *); +extern NCURSES_EXPORT(chtype) _nc_render (WINDOW *, chtype); +extern NCURSES_EXPORT(int) _nc_access (const char *, int); +extern NCURSES_EXPORT(int) _nc_baudrate (int); +extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *win); +extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); +extern NCURSES_EXPORT(int) _nc_keypad (bool); +extern NCURSES_EXPORT(int) _nc_ospeed (int); +extern NCURSES_EXPORT(int) _nc_outch (int); +extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *); +extern NCURSES_EXPORT(int) _nc_timed_wait (int, int, int *); +extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const chtype); +extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int)); +extern NCURSES_EXPORT(void) _nc_flush (void); +extern NCURSES_EXPORT(void) _nc_freeall (void); +extern NCURSES_EXPORT(void) _nc_hash_map (void); +extern NCURSES_EXPORT(void) _nc_init_keytry (void); +extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); +extern NCURSES_EXPORT(void) _nc_outstr (const char *str); +extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); +extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); +extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, chtype); +extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool); +extern NCURSES_EXPORT(void) _nc_signal_handler (bool); +extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *win); +extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *tree); #if USE_SIZECHANGE -extern void _nc_update_screensize(void); +extern NCURSES_EXPORT(void) _nc_update_screensize (void); #endif #if USE_WIDEC_SUPPORT -extern int _nc_utf8_outch(int); +extern NCURSES_EXPORT(int) _nc_utf8_outch (int); #endif /* scroll indices */ -extern int *_nc_oldnums; +extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; #define USE_SETBUF_0 0 @@ -797,12 +811,12 @@ extern int *_nc_oldnums; */ #if BROKEN_LINKER #define SP _nc_screen() -extern SCREEN *_nc_screen(void); -extern int _nc_alloc_screen(void); -extern void _nc_set_screen(SCREEN *); +extern NCURSES_EXPORT(SCREEN *) _nc_screen (void); +extern NCURSES_EXPORT(int) _nc_alloc_screen (void); +extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *); #else /* current screen is private data; avoid possible linking conflicts too */ -extern SCREEN *SP; +extern NCURSES_EXPORT_VAR(SCREEN *) SP; #define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0) #define _nc_set_screen(sp) SP = sp #endif @@ -816,8 +830,8 @@ extern SCREEN *SP; #define screen_lines SP->_lines #define screen_columns SP->_columns -extern int _nc_slk_format; /* != 0 if slk_init() called */ -extern int _nc_slk_initialize(WINDOW *, int); +extern NCURSES_EXPORT_VAR(int) _nc_slk_format; /* != 0 if slk_init() called */ +extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int); /* * Some constants related to SLK's @@ -835,7 +849,7 @@ extern int _nc_slk_initialize(WINDOW *, int); #define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC) #define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) -extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int)); +extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int)); #ifdef __cplusplus } diff --git a/lib/libcurses/nc_panel.h b/lib/libcurses/nc_panel.h index 882e4831ad7..107f555d5e4 100644 --- a/lib/libcurses/nc_panel.h +++ b/lib/libcurses/nc_panel.h @@ -1,7 +1,7 @@ -/* $OpenBSD: nc_panel.h,v 1.2 1998/07/23 21:19:56 millert Exp $ */ +/* $OpenBSD: nc_panel.h,v 1.3 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** - * 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 * @@ -35,7 +35,7 @@ /* - * $From: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $ + * $From: nc_panel.h,v 1.3 2000/12/10 02:04:35 tom Exp $ * * nc_panel.h * @@ -59,7 +59,7 @@ struct panelhook { }; /* Retrieve the panelhook of the current screen */ -extern struct panelhook* _nc_panelhook(void); +extern NCURSES_EXPORT(struct panelhook*) _nc_panelhook (void); #ifdef __cplusplus } diff --git a/lib/libcurses/ncurses_cfg.h b/lib/libcurses/ncurses_cfg.h index 976152d7045..493f1fcb2c4 100644 --- a/lib/libcurses/ncurses_cfg.h +++ b/lib/libcurses/ncurses_cfg.h @@ -50,7 +50,6 @@ #define CC_HAS_INLINE_FUNCS 1 #define CC_HAS_PROTOS 1 #define CPP_HAS_PARAM_INIT 1 -#define ETIP_NEEDS_MATH_H 1 #define GCC_NORETURN __attribute__((__noreturn__)) #define GCC_PRINTF 1 #define GCC_SCANF 1 @@ -121,6 +120,7 @@ #define MIXEDCASE_FILENAMES 1 #define NCURSES_EXT_FUNCS 1 #define NCURSES_NO_PADDING 1 +#define NCURSES_PATHSEP ':' #define NDEBUG 1 #define RETSIGTYPE void #define STDC_HEADERS 1 diff --git a/lib/libcurses/term.h b/lib/libcurses/term.h index 5791e6eeb7d..e8221bbb208 100644 --- a/lib/libcurses/term.h +++ b/lib/libcurses/term.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term.h,v 1.11 2000/10/22 18:27:19 millert Exp $ */ +/* $OpenBSD: term.h,v 1.12 2001/01/22 18:01:34 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ /* and: Eric S. Raymond <esr@snark.thyrsus.com> */ /****************************************************************************/ -/* $From: MKterm.h.awk.in,v 1.37 2000/03/12 02:40:07 tom Exp $ */ +/* $From: MKterm.h.awk.in,v 1.38 2000/12/09 23:54:00 tom Exp $ */ /* ** term.h -- Definition of struct term @@ -49,6 +49,20 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + + #ifdef __cplusplus extern "C" { #endif @@ -724,7 +738,7 @@ typedef struct term { /* describe an actual terminal */ int _baudrate; /* used to compute padding */ } TERMINAL; -extern TERMINAL *cur_term; +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; #if BROKEN_LINKER #define boolnames _nc_boolnames() @@ -737,66 +751,66 @@ extern TERMINAL *cur_term; #define strcodes _nc_strcodes() #define strfnames _nc_strfnames() -extern NCURSES_CONST char * const *_nc_boolnames(void); -extern NCURSES_CONST char * const *_nc_boolcodes(void); -extern NCURSES_CONST char * const *_nc_boolfnames(void); -extern NCURSES_CONST char * const *_nc_numnames(void); -extern NCURSES_CONST char * const *_nc_numcodes(void); -extern NCURSES_CONST char * const *_nc_numfnames(void); -extern NCURSES_CONST char * const *_nc_strnames(void); -extern NCURSES_CONST char * const *_nc_strcodes(void); -extern NCURSES_CONST char * const *_nc_strfnames(void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void); #else -extern NCURSES_CONST char *const boolnames[]; -extern NCURSES_CONST char *const boolcodes[]; -extern NCURSES_CONST char *const boolfnames[]; -extern NCURSES_CONST char *const numnames[]; -extern NCURSES_CONST char *const numcodes[]; -extern NCURSES_CONST char *const numfnames[]; -extern NCURSES_CONST char *const strnames[]; -extern NCURSES_CONST char *const strcodes[]; -extern NCURSES_CONST char *const strfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; #endif /* internals */ -extern int _nc_set_tty_mode(TTY *buf); -extern int _nc_get_tty_mode(TTY *buf); -extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const); -extern int _nc_read_file_entry(const char *const, TERMTYPE *); -extern char *_nc_first_name(const char *const); -extern int _nc_name_match(const char *const, const char *const, const char *const); -extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const); -extern const TERMTYPE *_nc_fallback(const char *); +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const); +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); /* entry points */ -extern TERMINAL *set_curterm(TERMINAL *); -extern int del_curterm(TERMINAL *); +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); /* miscellaneous entry points */ -extern int restartterm(NCURSES_CONST char *, int, int *); -extern int setupterm(NCURSES_CONST char *,int,int *); +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *); /* terminfo entry points, also declared in curses.h */ #if !defined(__NCURSES_H) -extern char *tigetstr(NCURSES_CONST char *); -extern char *tparm(NCURSES_CONST char *, ...); -extern char ttytype[]; -extern int putp(const char *); -extern int tigetflag(NCURSES_CONST char *); -extern int tigetnum(NCURSES_CONST char *); +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); #endif /* __NCURSES_H */ /* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ #if !defined(_NCU_TERMCAP_H) -extern char *tgetstr(NCURSES_CONST char *, char **); -extern char *tgoto(const char *, int, int); -extern int tgetent(char *, const char *); -extern int tgetflag(NCURSES_CONST char *); -extern int tgetnum(NCURSES_CONST char *); -extern int tputs(const char *, int, int (*)(int)); +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif /* _NCU_TERMCAP_H */ #ifdef __cplusplus diff --git a/lib/libcurses/term_entry.h b/lib/libcurses/term_entry.h index a1c8678bc8f..d8d4b36c631 100644 --- a/lib/libcurses/term_entry.h +++ b/lib/libcurses/term_entry.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term_entry.h,v 1.10 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: term_entry.h,v 1.11 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: term_entry.h,v 1.29 2000/03/19 02:04:15 tom Exp $ */ +/* $From: term_entry.h,v 1.31 2001/01/13 22:44:41 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -92,7 +92,8 @@ ENTRY; #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) -extern ENTRY *_nc_head, *_nc_tail; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) #define MAX_LINE 132 @@ -118,43 +119,49 @@ extern ENTRY *_nc_head, *_nc_tail; } /* alloc_entry.c: elementary allocation code */ -extern ENTRY *_nc_copy_entry(ENTRY *oldp); -extern char *_nc_save_str(const char *const); -extern void _nc_init_entry(TERMTYPE *const); -extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const); -extern void _nc_wrap_entry(ENTRY *const); +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); /* alloc_ttype.c: elementary allocation code */ -extern void _nc_align_termtype(TERMTYPE *, TERMTYPE *); -extern void _nc_copy_termtype(TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *); /* free_ttype.c: elementary allocation code */ -extern void _nc_free_termtype(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES -extern bool _nc_user_definable; -extern bool _nc_disable_period; +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; #endif -extern int _nc_parse_entry(ENTRY *, int, bool); -extern int _nc_capcmp(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); /* write_entry.c: writing an entry to the file system */ -extern void _nc_set_writedir(char *); -extern void _nc_write_entry(TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_set_writedir (char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); /* comp_parse.c: entry list handling */ -extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); -extern bool _nc_entry_match(char *, char *); -extern int _nc_resolve_uses(bool); -extern void _nc_free_entries(ENTRY *); -extern void (*_nc_check_termtype)(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* trace_xnames.c */ -extern void _nc_trace_xnames(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); + +#ifdef __OpenBSD__ +/* read_bsd_terminfo.c: terminfo.db reading */ +extern int _nc_read_bsd_terminfo_entry(const char * const, char * const, TERMTYPE *const); +extern int _nc_read_bsd_terminfo_file(const char * const, TERMTYPE *const); +#endif /* __OpenBSD__ */ #ifdef __cplusplus } diff --git a/lib/libcurses/termcap.3 b/lib/libcurses/termcap.3 index ab409e75698..a0328ee5245 100644 --- a/lib/libcurses/termcap.3 +++ b/lib/libcurses/termcap.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: termcap.3,v 1.5 2000/07/10 03:06:11 millert Exp $ +.\" $OpenBSD: termcap.3,v 1.6 2001/01/22 18:01:35 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_termcap.3x,v 1.13 2000/07/01 20:10:57 tom Exp $ +.\" $From: curs_termcap.3x,v 1.14 2000/12/02 22:47:14 tom Exp $ .TH termcap 3 "" .ds n 5 .SH NAME @@ -43,13 +43,13 @@ .br \fB#include <term.h>\fR .br -\fBint tgetent(const char *bp, char *name);\fR +\fBint tgetent(char *bp, const char *name);\fR .br -\fBint tgetflag(const char *id);\fR +\fBint tgetflag(char *id);\fR .br -\fBint tgetnum(const char *id);\fR +\fBint tgetnum(char *id);\fR .br -\fBchar *tgetstr(const char *id, char **area);\fR +\fBchar *tgetstr(char *id, char **area);\fR .br \fBchar *tgoto(const char *cap, int col, int row);\fR .br @@ -80,6 +80,11 @@ The return value will also be copied to the buffer pointed to by \fIarea\fR, and the \fIarea\fR value will be updated to point past the null ending this value. +Only the first two characters of the \fBid\fR parameter of +\fBtgetflag\fR, +\fBtgetnum\fR and +\fBtgetstr\fR are compared in lookups. + The \fBtgoto\fR routine instantiates the parameters into the given capability. The output from this routine is to be passed to \fBtputs\fR. @@ -98,7 +103,11 @@ If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string, be aware that it will be returned in terminfo notation, not the older and not-quite-compatible termcap notation. This won't cause problems if all you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand -terminfo-style. +terminfo-style strings as terminfo. +(The \fBtgoto\fR function, if configured to support termcap, will check +if the string is indeed terminfo-style by looking for "%p" parameters or +"$<..>" delays, and invoke a termcap-style parser if the string does not +appear to be terminfo). Because terminfo conventions for representing padding in string capabilities differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather diff --git a/lib/libcurses/termcap.h b/lib/libcurses/termcap.h index 91fbfbcd676..f4e1a62ecd0 100644 --- a/lib/libcurses/termcap.h +++ b/lib/libcurses/termcap.h @@ -1,7 +1,7 @@ -/* $OpenBSD: termcap.h,v 1.7 2000/10/22 18:27:19 millert Exp $ */ +/* $OpenBSD: termcap.h,v 1.8 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $From: termcap.h.in,v 1.12 2000/10/08 01:06:37 tom Exp $ */ +/* $From: termcap.h.in,v 1.15 2000/12/10 02:01:50 tom Exp $ */ #ifndef _NCU_TERMCAP_H #define _NCU_TERMCAP_H 1 @@ -41,6 +41,19 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "5.2" +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + #ifdef __cplusplus extern "C" { @@ -51,18 +64,21 @@ extern "C" #undef NCURSES_CONST #define NCURSES_CONST -extern char PC; -extern char *UP; -extern char *BC; -extern short ospeed; +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; #if !defined(_NCU_TERM_H) -extern char *tgetstr(NCURSES_CONST char *, char **); -extern char *tgoto(const char *, int, int); -extern int tgetent(char *, const char *); -extern int tgetflag(NCURSES_CONST char *); -extern int tgetnum(NCURSES_CONST char *); -extern int tputs(const char *, int, int (*)(int)); +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif #ifdef __cplusplus diff --git a/lib/libcurses/terminfo.3 b/lib/libcurses/terminfo.3 index c68d17f6718..06afcd61c55 100644 --- a/lib/libcurses/terminfo.3 +++ b/lib/libcurses/terminfo.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: terminfo.3,v 1.7 2000/07/10 03:06:11 millert Exp $ +.\" $OpenBSD: terminfo.3,v 1.8 2001/01/22 18:01:35 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: curs_terminfo.3x,v 1.13 2000/07/01 20:07:34 tom Exp $ +.\" $From: curs_terminfo.3x,v 1.14 2000/12/03 00:07:23 tom Exp $ .TH terminfo 3 "" .ds n 5 .SH NAME @@ -255,6 +255,10 @@ In System V Release 4, the third argument of \fBtputs\fR has the type The XSI Curses standard prototypes \fBtparm\fR with a fixed number of parameters, rather than a variable argument list. +That prototype assumes that none of the parameters are strings +(or if so, that a long is big enough to hold a pointer). +The variable argument list implemented in ncurses does not rely on +that assumption. XSI notes that after calling \fBmvcur\fR, the curses state may not match the actual terminal state, and that an application should touch and refresh diff --git a/lib/libcurses/tic.h b/lib/libcurses/tic.h index d36fcbf584b..bbec5f2a88a 100644 --- a/lib/libcurses/tic.h +++ b/lib/libcurses/tic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tic.h,v 1.10 2000/10/08 22:46:56 millert Exp $ */ +/* $OpenBSD: tic.h,v 1.11 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998-2000 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $From: tic.h,v 1.35 2000/09/09 19:47:16 tom Exp $ + * $From: tic.h,v 1.36 2000/12/10 02:03:28 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ @@ -118,9 +118,9 @@ extern "C" { #define DEBUG(n, a) /*nothing*/ #endif -extern unsigned _nc_tracing; -extern void _nc_tracef(char *, ...) GCC_PRINTFLIKE(1,2); -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); /* * These are the types of tokens returned by the scanner. The first @@ -151,7 +151,7 @@ struct token char *tk_valstring; /* value of capability (if a string) */ }; -extern struct token _nc_curr_token; +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; /* * List of keynames with their corresponding code. @@ -161,7 +161,7 @@ struct kn { int code; }; -extern const struct kn _nc_key_names[]; +extern NCURSES_EXPORT_VAR(const struct kn) _nc_key_names[]; /* * Offsets to string capabilities, with the corresponding functionkey @@ -175,11 +175,11 @@ struct tinfo_fkeys { #if BROKEN_LINKER #define _nc_tinfo_fkeys _nc_tinfo_fkeysf() -extern struct tinfo_fkeys *_nc_tinfo_fkeysf(void); +extern NCURSES_EXPORT(struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); #else -extern struct tinfo_fkeys _nc_tinfo_fkeys[]; +extern NCURSES_EXPORT_VAR(struct tinfo_fkeys) _nc_tinfo_fkeys[]; #endif @@ -204,14 +204,14 @@ struct alias const char *source; }; -extern const struct name_table_entry * const _nc_info_hash_table[]; -extern const struct name_table_entry * const _nc_cap_hash_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_info_hash_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_cap_hash_table[]; -extern const struct alias _nc_capalias_table[]; -extern const struct alias _nc_infoalias_table[]; +extern NCURSES_EXPORT_VAR(const struct alias) _nc_capalias_table[]; +extern NCURSES_EXPORT_VAR(const struct alias) _nc_infoalias_table[]; -extern const struct name_table_entry *_nc_get_table(bool); -extern const struct name_table_entry * const *_nc_get_hash_table(bool); +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool); #define NOTFOUND ((struct name_table_entry *) 0) @@ -240,59 +240,59 @@ extern const struct name_table_entry * const *_nc_get_hash_table(bool); #endif /* access.c */ -extern char *_nc_basename(char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); /* comp_hash.c: name lookup */ -struct name_table_entry const *_nc_find_entry(const char *, - const struct name_table_entry *const *); -struct name_table_entry const *_nc_find_type_entry(const char *, - int, - const struct name_table_entry *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const struct name_table_entry *const *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, const struct name_table_entry *); /* comp_scan.c: lexical analysis */ -extern int _nc_get_token(void); -extern void _nc_push_token(int); -extern void _nc_reset_input(FILE *, char *); -extern void _nc_panic_mode(char); -extern int _nc_curr_line; -extern int _nc_curr_col; -extern long _nc_curr_file_pos; -extern long _nc_comment_start, _nc_comment_end; -extern int _nc_syntax; -extern long _nc_start_line; +extern NCURSES_EXPORT(int) _nc_get_token (void); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; #define SYN_TERMINFO 0 #define SYN_TERMCAP 1 /* comp_error.c: warning & abort messages */ -extern void _nc_set_source(const char *const name); -extern void _nc_get_type(char *name); -extern void _nc_set_type(const char *const name); -extern void _nc_syserr_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_err_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_warning(const char *const,...) GCC_PRINTFLIKE(1,2); -extern bool _nc_suppress_warnings; +extern NCURSES_EXPORT(void) _nc_set_source (const char *const name); +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const name); +extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; /* comp_expand.c: expand string into readable form */ -extern char *_nc_tic_expand(const char *, bool, int); +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern char _nc_trans_string(char *, char *); +extern NCURSES_EXPORT(char) _nc_trans_string (char *, char *); /* captoinfo.c: capability conversion */ -extern char *_nc_captoinfo(const char *, const char *, int const); -extern char *_nc_infotocap(const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); /* lib_tputs.c */ -extern int _nc_nulls_sent; /* Add one for every null sent */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ /* comp_main.c: compiler main */ -extern const char *_nc_progname; +extern const char * _nc_progname; /* read_entry.c */ -extern const char *_nc_tic_dir(const char *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); /* write_entry.c */ -extern int _nc_tic_written(void); +extern NCURSES_EXPORT(int) _nc_tic_written (void); #ifdef __cplusplus } diff --git a/lib/libcurses/tinfo/MKcaptab.awk b/lib/libcurses/tinfo/MKcaptab.awk index 8d9a41b4877..4f5df3afdb2 100644 --- a/lib/libcurses/tinfo/MKcaptab.awk +++ b/lib/libcurses/tinfo/MKcaptab.awk @@ -1,6 +1,6 @@ #!/bin/sh -# $OpenBSD: MKcaptab.awk,v 1.2 1999/01/24 20:06:47 millert Exp $ -# $From: MKcaptab.awk,v 1.11 1999/01/24 02:46:42 Jeffrey.C.Honig Exp $ +# $OpenBSD: MKcaptab.awk,v 1.3 2001/01/22 18:01:49 millert Exp $ +# $From: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $ AWK=${1-awk} DATA=${2-../include/Caps} @@ -12,6 +12,7 @@ cat <<'EOF' */ #include <ncurses_cfg.h> +#include <curses.priv.h> #include <tic.h> #include <term.h> @@ -59,12 +60,12 @@ cat <<'EOF' {(char *)NULL, (char *)NULL, (char *)NULL} }; -const struct name_table_entry *_nc_get_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap) { return termcap ? _nc_cap_table: _nc_info_table ; } -const struct name_table_entry * const * _nc_get_hash_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap) { return termcap ? _nc_cap_hash_table: _nc_info_hash_table ; } diff --git a/lib/libcurses/tinfo/MKfallback.sh b/lib/libcurses/tinfo/MKfallback.sh index 0c1eaef70c7..ce7d14cb7a4 100644 --- a/lib/libcurses/tinfo/MKfallback.sh +++ b/lib/libcurses/tinfo/MKfallback.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $OpenBSD: MKfallback.sh,v 1.2 1999/06/27 08:14:21 millert Exp $ -# $From: MKfallback.sh,v 1.9 1999/06/15 22:57:45 tom Exp $ +# $OpenBSD: MKfallback.sh,v 1.3 2001/01/22 18:01:50 millert Exp $ +# $From: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $ # # MKfallback.sh -- create fallback table for entry reads # @@ -51,7 +51,7 @@ EOF fi cat <<EOF -const TERMTYPE *_nc_fallback(const char *name GCC_UNUSED) +NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *name GCC_UNUSED) { EOF diff --git a/lib/libcurses/tinfo/MKnames.awk b/lib/libcurses/tinfo/MKnames.awk index 7f49c21b9f5..5fdb8c20690 100644 --- a/lib/libcurses/tinfo/MKnames.awk +++ b/lib/libcurses/tinfo/MKnames.awk @@ -1,5 +1,5 @@ -# $OpenBSD -# $From: MKnames.awk,v 1.10 1999/01/16 23:36:34 tom Exp $ +# $OpenBSD: MKnames.awk,v 1.2 2001/01/22 18:01:50 millert Exp $ +# $From: MKnames.awk,v 1.11 2000/12/09 23:46:13 tom Exp $ BEGIN { print "/* This file was generated by MKnames.awk */" > "namehdr" print "" > "namehdr" @@ -11,7 +11,7 @@ BEGIN { print "#include <term.h>" > "namehdr" print "#define DCL(it) static IT data##it[]" > "namehdr" print "#else" > "namehdr" - print "#define DCL(it) IT it[]" > "namehdr" + print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr" print "#endif" > "namehdr" print "" > "namehdr" print "/*" > "boolnames" @@ -81,7 +81,7 @@ END { print "};" > "strcodes" print "" > "strcodes" print "#if BROKEN_LINKER" > "nameftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr" print "FIX(boolnames)" > "nameftr" print "FIX(boolfnames)" > "nameftr" print "FIX(numnames)" > "nameftr" @@ -91,7 +91,7 @@ END { print "#endif /* BROKEN_LINKER */" > "nameftr" print "" > "codeftr" print "#if BROKEN_LINKER" > "codeftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr" print "FIX(boolcodes)" > "codeftr" print "FIX(numcodes)" > "codeftr" print "FIX(strcodes)" > "codeftr" diff --git a/lib/libcurses/tinfo/access.c b/lib/libcurses/tinfo/access.c index 5c0e4c64920..7a2bc501c50 100644 --- a/lib/libcurses/tinfo/access.c +++ b/lib/libcurses/tinfo/access.c @@ -33,9 +33,9 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$From: access.c,v 1.4 2000/10/08 01:25:06 tom Exp $") +MODULE_ID("$From: access.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) _nc_basename(char *path) { char *result = strrchr(path, '/'); @@ -50,7 +50,7 @@ _nc_basename(char *path) return result; } -int +NCURSES_EXPORT(int) _nc_access(const char *path, int mode) { if (access(path, mode) < 0) { @@ -78,7 +78,7 @@ _nc_access(const char *path, int mode) * Returns true if we allow application to use environment variables that are * used for searching lists of directories, etc. */ -int +NCURSES_EXPORT(int) _nc_env_access(void) { #if HAVE_ISSETUGID @@ -86,9 +86,9 @@ _nc_env_access(void) return FALSE; #elif HAVE_GETEUID && HAVE_GETEGID if (getuid() != geteuid() - || getgid() != getegid()) + || getgid() != getegid()) return FALSE; #endif - return getuid() != 0; /* ...finally, disallow root */ + return getuid() != 0 && geteuid() != 0; /* ...finally, disallow root */ } #endif diff --git a/lib/libcurses/tinfo/add_tries.c b/lib/libcurses/tinfo/add_tries.c index fddee879548..55ad69543d5 100644 --- a/lib/libcurses/tinfo/add_tries.c +++ b/lib/libcurses/tinfo/add_tries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add_tries.c,v 1.2 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: add_tries.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -41,12 +41,12 @@ #include <curses.priv.h> -MODULE_ID("$From: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $") +MODULE_ID("$From: add_tries.c,v 1.4 2000/12/10 02:55:07 tom Exp $") #define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' #define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) -void +NCURSES_EXPORT(void) _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) { static bool out_of_memory = FALSE; @@ -63,7 +63,7 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) unsigned char cmp = *txt; while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) + && ptr->sibling != 0) ptr = ptr->sibling; if (CMP_TRY(ptr->ch, cmp)) { diff --git a/lib/libcurses/tinfo/alloc_entry.c b/lib/libcurses/tinfo/alloc_entry.c index b019f59ce6e..8429ab5fbbc 100644 --- a/lib/libcurses/tinfo/alloc_entry.c +++ b/lib/libcurses/tinfo/alloc_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc_entry.c,v 1.3 2000/03/13 23:53:39 millert Exp $ */ +/* $OpenBSD: alloc_entry.c,v 1.4 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") +MODULE_ID("$From: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -59,7 +59,7 @@ MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ -void +NCURSES_EXPORT(void) _nc_init_entry(TERMTYPE * const tp) /* initialize a terminal type data block */ { @@ -92,7 +92,7 @@ _nc_init_entry(TERMTYPE * const tp) next_free = 0; } -ENTRY * +NCURSES_EXPORT(ENTRY *) _nc_copy_entry(ENTRY * oldp) { ENTRY *newp = typeCalloc(ENTRY, 1); @@ -104,7 +104,7 @@ _nc_copy_entry(ENTRY * oldp) return newp; } -char * +NCURSES_EXPORT(char *) _nc_save_str(const char *const string) /* save a copy of string in the string buffer */ { @@ -120,14 +120,35 @@ _nc_save_str(const char *const string) return (stringbuf + old_next_free); } -void -_nc_wrap_entry(ENTRY * const ep) +NCURSES_EXPORT(void) +_nc_wrap_entry(ENTRY * const ep, bool copy_strings) /* copy the string parts to allocated storage, preserving pointers to it */ { int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES]; int i, n; TERMTYPE *tp = &(ep->tterm); + if (copy_strings) { + next_free = 0; /* clear static storage */ + + /* copy term_names, Strings, uses */ + tp->term_names = _nc_save_str(tp->term_names); + for_each_string(i, tp) { + if (tp->Strings[i] != ABSENT_STRING && + tp->Strings[i] != CANCELLED_STRING) { + tp->Strings[i] = _nc_save_str(tp->Strings[i]); + } + } + + for (i = 0; i < ep->nuses; i++) { + if (ep->uses[i].name == 0) { + ep->uses[i].name = _nc_save_str(ep->uses[i].name); + } + } + + free(tp->str_table); + } + n = tp->term_names - stringbuf; for_each_string(i, &(ep->tterm)) { if (tp->Strings[i] == ABSENT_STRING) @@ -160,18 +181,20 @@ _nc_wrap_entry(ENTRY * const ep) } #if NCURSES_XNAMES - if ((n = NUM_EXT_NAMES(tp)) != 0) { - unsigned length = 0; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = tp->ext_Names[i] - stringbuf; - } - if ((tp->ext_str_table = typeMalloc(char, length)) == 0) - _nc_err_abort("Out of memory"); - for (i = 0, length = 0; i < n; i++) { - tp->ext_Names[i] = tp->ext_str_table + length; - strcpy(tp->ext_Names[i], stringbuf + offsets[i]); - length += strlen(tp->ext_Names[i]) + 1; + if (!copy_strings) { + if ((n = NUM_EXT_NAMES(tp)) != 0) { + unsigned length = 0; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = tp->ext_Names[i] - stringbuf; + } + if ((tp->ext_str_table = typeMalloc(char, length)) == 0) + _nc_err_abort("Out of memory"); + for (i = 0, length = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + length; + strcpy(tp->ext_Names[i], stringbuf + offsets[i]); + length += strlen(tp->ext_Names[i]) + 1; + } } } #endif @@ -184,8 +207,9 @@ _nc_wrap_entry(ENTRY * const ep) } } -void -_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) +NCURSES_EXPORT(void) +_nc_merge_entry +(TERMTYPE * const to, TERMTYPE * const from) /* merge capabilities from `from' entry into `to' entry */ { int i; diff --git a/lib/libcurses/tinfo/alloc_ttype.c b/lib/libcurses/tinfo/alloc_ttype.c index c03a3a5919c..43583824c0f 100644 --- a/lib/libcurses/tinfo/alloc_ttype.c +++ b/lib/libcurses/tinfo/alloc_ttype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc_ttype.c,v 1.4 2000/10/08 22:47:00 millert Exp $ */ +/* $OpenBSD: alloc_ttype.c,v 1.5 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -45,7 +45,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: alloc_ttype.c,v 1.10 2000/08/12 21:56:24 tom Exp $") +MODULE_ID("$From: alloc_ttype.c,v 1.12 2000/12/10 02:55:07 tom Exp $") #if NCURSES_XNAMES /* @@ -372,8 +372,9 @@ adjust_cancels(TERMTYPE * to, TERMTYPE * from) } } -void -_nc_align_termtype(TERMTYPE * to, TERMTYPE * from) +NCURSES_EXPORT(void) +_nc_align_termtype +(TERMTYPE * to, TERMTYPE * from) { int na = NUM_EXT_NAMES(to); int nb = NUM_EXT_NAMES(from); @@ -457,8 +458,9 @@ _nc_align_termtype(TERMTYPE * to, TERMTYPE * from) } #endif -void -_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src) +NCURSES_EXPORT(void) +_nc_copy_termtype +(TERMTYPE * dst, TERMTYPE * src) { int i; diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c index 2a797d038e5..c36f7160660 100644 --- a/lib/libcurses/tinfo/captoinfo.c +++ b/lib/libcurses/tinfo/captoinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: captoinfo.c,v 1.8 2000/04/04 16:49:59 millert Exp $ */ +/* $OpenBSD: captoinfo.c,v 1.9 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -41,7 +41,7 @@ * * There is just one entry point: * - * char *captoinfo(n, s, parametrized) + * char *_nc_captoinfo(n, s, parametrized) * * Convert value s for termcap string capability named n into terminfo * format. @@ -94,7 +94,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $") +MODULE_ID("$From: captoinfo.c,v 1.40 2000/11/05 00:22:36 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -196,7 +196,7 @@ cvtchar(register const char *sp) case '2': case '3': len = 1; - while (isdigit(*sp)) { + while (isdigit(CharOf(*sp))) { c = 8 * c + (*sp++ - '0'); len++; } @@ -270,13 +270,16 @@ getparm(int parm, int n) } } +/* + * Convert a termcap string to terminfo format. + * 'cap' is the relevant terminfo capability index. + * 's' is the string value of the capability. + * 'parametrized' tells what type of translations to do: + * % translations if 1 + * pad translations if >=0 + */ char * -_nc_captoinfo( -/* convert a termcap string to terminfo format */ - register const char *cap, /* relevant terminfo capability index */ - register const char *s, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_captoinfo(const char *cap, const char *s, int const parametrized) { const char *capstart; @@ -293,9 +296,9 @@ _nc_captoinfo( capstart = 0; if (s == 0) s = ""; - if (parametrized >= 0 && isdigit(*s)) + if (parametrized >= 0 && isdigit(CharOf(*s))) for (capstart = s;; s++) - if (!(isdigit(*s) || *s == '*' || *s == '.')) + if (!(isdigit(CharOf(*s)) || *s == '*' || *s == '.')) break; while (*s != '\0') { @@ -351,7 +354,7 @@ _nc_captoinfo( break; case 'a': if ((*s == '=' || *s == '+' || *s == '-' - || *s == '*' || *s == '/') + || *s == '*' || *s == '/') && (s[1] == 'p' || s[1] == 'c') && s[2] != '\0') { int l; @@ -463,7 +466,7 @@ _nc_captoinfo( dp = save_char(dp, '%'); s--; _nc_warning("unknown %% code %s (%#x) in %s", - unctrl(*s), (*s) & 0xff, cap); + unctrl((chtype) * s), CharOf(*s), cap); break; } break; @@ -544,7 +547,7 @@ _nc_captoinfo( if (capstart) { dp = save_string(dp, "$<"); for (s = capstart;; s++) - if (isdigit(*s) || *s == '*' || *s == '.') + if (isdigit(CharOf(*s)) || *s == '*' || *s == '.') dp = save_char(dp, *s); else break; @@ -568,8 +571,8 @@ bcd_expression(const char *str) char ch1, ch2; if (sscanf(str, fmt, &ch1, &ch2) == 2 - && isdigit(ch1) - && isdigit(ch2) + && isdigit(CharOf(ch1)) + && isdigit(CharOf(ch2)) && (ch1 == ch2)) { len = 28; #ifndef NDEBUG @@ -596,7 +599,7 @@ save_tc_char(char *bufptr, int c1) bufptr = save_char(bufptr, c1); } else { if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ - (void) strcpy(temp, unctrl(c1)); + (void) strcpy(temp, unctrl((chtype) c1)); else (void) sprintf(temp, "\\%03o", c1); bufptr = save_string(bufptr, temp); @@ -631,13 +634,12 @@ save_tc_inequality(char *bufptr, int c1, int c2) * %m exclusive-or all parameters with 0177 (not in 4.4BSD) */ +/* + * Convert a terminfo string to termcap format. Parameters are as in + * _nc_captoinfo(). + */ char * -_nc_infotocap( -/* convert a terminfo string to termcap format */ - register const char *cap GCC_UNUSED, /* relevant termcap capability index */ - register const char *str, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrized) { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; @@ -651,13 +653,13 @@ _nc_infotocap( padding = str + strlen(str) - 1; if (*padding == '>' && *--padding == '/') { --padding; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') padding--; if (*padding == '<' && *--padding == '$') trimmed = padding; padding += 2; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') bufptr = save_char(bufptr, *padding++); } @@ -669,8 +671,11 @@ _nc_infotocap( bufptr = save_char(bufptr, *++str); } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; - while (isdigit(*str) || *str == '.' || *str == '*' || *str == - '/' || *str == '>') + while (isdigit(CharOf(*str)) + || *str == '.' + || *str == '*' + || *str == '/' + || *str == '>') str++; --str; } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ @@ -694,7 +699,7 @@ _nc_infotocap( bufptr = save_string(bufptr, "%B"); } else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) - && (cp = strchr(str, '+'))) { + && (cp = strchr(str, '+'))) { str = cp + 2; bufptr = save_string(bufptr, "%+"); @@ -734,7 +739,7 @@ _nc_infotocap( case '8': case '9': bufptr = save_char(bufptr, '%'); - while (isdigit(*str)) + while (isdigit(CharOf(*str))) bufptr = save_char(bufptr, *str++); if (strchr("doxX.", *str)) { if (*str != 'd') /* termcap doesn't have octal, hex */ diff --git a/lib/libcurses/tinfo/comp_error.c b/lib/libcurses/tinfo/comp_error.c index 38580200f4d..cfa5dfd59be 100644 --- a/lib/libcurses/tinfo/comp_error.c +++ b/lib/libcurses/tinfo/comp_error.c @@ -1,7 +1,7 @@ -/* $OpenBSD: comp_error.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: comp_error.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */ /**************************************************************************** - * 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,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * comp_error.c -- Error message routines * diff --git a/lib/libcurses/tinfo/comp_expand.c b/lib/libcurses/tinfo/comp_expand.c index bf2bb3d397d..3de650bd120 100644 --- a/lib/libcurses/tinfo/comp_expand.c +++ b/lib/libcurses/tinfo/comp_expand.c @@ -1,7 +1,7 @@ -/* $OpenBSD: comp_expand.c,v 1.3 1999/03/11 21:03:57 millert Exp $ */ +/* $OpenBSD: comp_expand.c,v 1.4 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * 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 * @@ -37,13 +37,14 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $") +MODULE_ID("$From: comp_expand.c,v 1.15 2000/12/10 01:30:10 tom Exp $") -static int trailing_spaces(const char *src) +static int +trailing_spaces(const char *src) { - while (*src == ' ') - src++; - return *src == 0; + while (*src == ' ') + src++; + return *src == 0; } /* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ @@ -51,141 +52,136 @@ static int trailing_spaces(const char *src) #define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) #define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) -char *_nc_tic_expand(const char *srcp, bool tic_format, int numbers) +NCURSES_EXPORT(char *) +_nc_tic_expand +(const char *srcp, bool tic_format, int numbers) { -static char * buffer; -static size_t length; + static char *buffer; + static size_t length; -int bufp; -const char *ptr, *str = VALID_STRING(srcp) ? srcp : ""; -bool islong = (strlen(str) > 3); -size_t need = (2 + strlen(str)) * 4; -int ch; + int bufp; + const char *str = VALID_STRING(srcp) ? srcp : ""; + bool islong = (strlen(str) > 3); + size_t need = (2 + strlen(str)) * 4; + int ch; - if (buffer == 0 || need > length) { - if ((buffer = typeRealloc(char, length = need, buffer)) == 0) - return 0; - } + if (buffer == 0 || need > length) { + if ((buffer = typeRealloc(char, length = need, buffer)) == 0) + return 0; + } - bufp = 0; - ptr = str; - while ((ch = (*str & 0xff)) != 0) { - if (ch == '%' && REALPRINT(str+1)) { - buffer[bufp++] = *str++; - /* - * Though the character literals are more compact, most - * terminal descriptions use numbers and are not easy - * to read in character-literal form. - */ - switch (numbers) { - case -1: - if (str[0] == S_QUOTE - && str[1] != '\\' - && REALPRINT(str+1) - && str[2] == S_QUOTE) { - sprintf(buffer+bufp, "{%d}", str[1]); - bufp += strlen(buffer+bufp); - str += 2; - } else { - buffer[bufp++] = *str; - } - break; - /* - * If we have a "%{number}", try to translate it into - * a "%'char'" form, since that will run a little faster - * when we're interpreting it. Also, having one form - * for the constant makes it simpler to compare terminal - * descriptions. - */ - case 1: - if (str[0] == L_BRACE - && isdigit(str[1])) { - char *dst = 0; - long value = strtol(str+1, &dst, 0); - if (dst != 0 - && *dst == R_BRACE - && value < 127 - && value != '\\' /* FIXME */ - && isprint((int)value)) { - ch = (int)value; - buffer[bufp++] = S_QUOTE; - if (ch == '\\' - || ch == S_QUOTE) - buffer[bufp++] = '\\'; - buffer[bufp++] = ch; - buffer[bufp++] = S_QUOTE; - str = dst; - } else { - buffer[bufp++] = *str; - } - } else { - buffer[bufp++] = *str; - } - break; - default: - buffer[bufp++] = *str; - break; - } - } - else if (ch == 128) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '0'; - } - else if (ch == '\033') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'E'; - } - else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '\\'; - } - else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 's'; + bufp = 0; + while ((ch = CharOf(*str)) != 0) { + if (ch == '%' && REALPRINT(str + 1)) { + buffer[bufp++] = *str++; + /* + * Though the character literals are more compact, most + * terminal descriptions use numbers and are not easy + * to read in character-literal form. + */ + switch (numbers) { + case -1: + if (str[0] == S_QUOTE + && str[1] != '\\' + && REALPRINT(str + 1) + && str[2] == S_QUOTE) { + sprintf(buffer + bufp, "{%d}", str[1]); + bufp += strlen(buffer + bufp); + str += 2; + } else { + buffer[bufp++] = *str; } - else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { - buffer[bufp++] = '\\'; + break; + /* + * If we have a "%{number}", try to translate it into + * a "%'char'" form, since that will run a little faster + * when we're interpreting it. Also, having one form + * for the constant makes it simpler to compare terminal + * descriptions. + */ + case 1: + if (str[0] == L_BRACE + && isdigit(CharOf(str[1]))) { + char *dst = 0; + long value = strtol(str + 1, &dst, 0); + if (dst != 0 + && *dst == R_BRACE + && value < 127 + && value != '\\' /* FIXME */ + && isprint((int) value)) { + ch = (int) value; + buffer[bufp++] = S_QUOTE; + if (ch == '\\' + || ch == S_QUOTE) + buffer[bufp++] = '\\'; buffer[bufp++] = ch; + buffer[bufp++] = S_QUOTE; + str = dst; + } else { + buffer[bufp++] = *str; + } + } else { + buffer[bufp++] = *str; } - else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^')) - buffer[bufp++] = ch; -#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ - else if (ch == '\b') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'b'; - } - else if (ch == '\f') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'f'; - } - else if (ch == '\t' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 't'; - } + break; + default: + buffer[bufp++] = *str; + break; + } + } else if (ch == 128) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '0'; + } else if (ch == '\033') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'E'; + } else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '\\'; + } else if (ch == ' ' && tic_format && (str == srcp || + trailing_spaces(str))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 's'; + } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { + buffer[bufp++] = '\\'; + buffer[bufp++] = ch; + } else if (REALPRINT(str) + && (ch != ',' + && ch != ':' + && !(ch == '!' && !tic_format) + && ch != '^')) + buffer[bufp++] = ch; +#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ + else if (ch == '\b') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'b'; + } else if (ch == '\f') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'f'; + } else if (ch == '\t' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 't'; + } #endif - else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'r'; - } - else if (ch == '\n' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'n'; - } + else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } else if (ch == '\n' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } #define UnCtl(c) ((c) + '@') - else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1]))) - { - (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); - bufp += 2; - } - else - { - (void) sprintf(&buffer[bufp], "\\%03o", ch); - bufp += 4; - } - - str++; + else if (REALCTL(str) && ch != '\\' + && (!islong || isdigit(CharOf(str[1])))) { + (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); + bufp += 2; + } else { + (void) sprintf(&buffer[bufp], "\\%03o", ch); + bufp += 4; } - buffer[bufp] = '\0'; - return(buffer); + str++; + } + + buffer[bufp] = '\0'; + return (buffer); } diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c index 161b6d977c3..7a8992726ac 100644 --- a/lib/libcurses/tinfo/comp_parse.c +++ b/lib/libcurses/tinfo/comp_parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comp_parse.c,v 1.9 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: comp_parse.c,v 1.10 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,10 +54,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: comp_parse.c,v 1.42 2000/10/14 17:50:45 Bernhard.Rosenkraenzer Exp $") +MODULE_ID("$From: comp_parse.c,v 1.48 2001/01/15 00:44:51 tom Exp $") static void sanity_check(TERMTYPE *); -void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; +NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; /**************************************************************************** * @@ -80,10 +80,11 @@ void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; * _nc_head _nc_tail */ -ENTRY *_nc_head = 0, *_nc_tail = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0; -static void -enqueue(ENTRY * ep) + static void + enqueue(ENTRY * ep) /* add an entry to the in-core list */ { ENTRY *newp = _nc_copy_entry(ep); @@ -99,7 +100,7 @@ enqueue(ENTRY * ep) newp->last->next = newp; } -void +NCURSES_EXPORT(void) _nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { @@ -139,7 +140,7 @@ force_bar(char *dst, char *src, size_t siz) return src; } -bool +NCURSES_EXPORT(bool) _nc_entry_match(char *n1, char *n2) /* do any of the aliases in a pair of terminal names match? */ { @@ -164,10 +165,10 @@ _nc_entry_match(char *n1, char *n2) * ****************************************************************************/ -void +NCURSES_EXPORT(void) _nc_read_entry_source(FILE * fp, char *buf, - int literal, bool silent, - bool(*hook) (ENTRY *)) + int literal, bool silent, + bool(*hook) (ENTRY *)) /* slurp all entries in the given file into core */ { ENTRY thisentry; @@ -182,7 +183,7 @@ _nc_read_entry_source(FILE * fp, char *buf, memset(&thisentry, 0, sizeof(thisentry)); if (_nc_parse_entry(&thisentry, literal, silent) == ERR) break; - if (!isalnum(thisentry.tterm.term_names[0])) + if (!isalnum(CharOf(thisentry.tterm.term_names[0]))) _nc_err_abort("terminal names must start with letter or digit"); /* @@ -212,7 +213,7 @@ _nc_read_entry_source(FILE * fp, char *buf, _nc_suppress_warnings = oldsuppress; } -int +NCURSES_EXPORT(int) _nc_resolve_uses(bool fullresolve) /* try to resolve all use capabilities */ { @@ -229,17 +230,18 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { int matchcount = 0; - for_entry_list(rp) + for_entry_list(rp) { if (qp > rp - && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { - matchcount++; - if (matchcount == 1) { - (void) fprintf(stderr, "Name collision between %s", - _nc_first_name(qp->tterm.term_names)); - multiples++; + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + matchcount++; + if (matchcount == 1) { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; + } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } - if (matchcount >= 1) - (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } if (matchcount >= 1) (void) putc('\n', stderr); @@ -267,14 +269,15 @@ _nc_resolve_uses(bool fullresolve) _nc_set_type(child); /* first, try to resolve from in-core records */ - for_entry_list(rp) + for_entry_list(rp) { if (rp != qp - && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { - DEBUG(2, ("%s: resolving use=%s (in core)", - child, lookfor)); + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); - qp->uses[i].link = rp; - foundit = TRUE; + qp->uses[i].link = rp; + foundit = TRUE; + } } /* if that didn't work, try to merge in a compiled entry */ @@ -285,7 +288,7 @@ _nc_resolve_uses(bool fullresolve) memset(&thisterm, 0, sizeof(thisterm)); if (_nc_read_entry(lookfor, filename, &thisterm) == 1) { DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); + child, lookfor)); rp = typeMalloc(ENTRY, 1); if (rp == 0) @@ -333,7 +336,7 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { if (qp->nuses > 0) { DEBUG(2, ("%s: attempting merge", - _nc_first_name(qp->tterm.term_names))); + _nc_first_name(qp->tterm.term_names))); /* * If any of the use entries we're looking for is * incomplete, punt. We'll catch this entry on a @@ -342,7 +345,7 @@ _nc_resolve_uses(bool fullresolve) for (i = 0; i < qp->nuses; i++) if (qp->uses[i].link->nuses) { DEBUG(2, ("%s: use entry %d unresolved", - _nc_first_name(qp->tterm.term_names), i)); + _nc_first_name(qp->tterm.term_names), i)); goto incomplete; } @@ -360,7 +363,7 @@ _nc_resolve_uses(bool fullresolve) */ for (; qp->nuses; qp->nuses--) _nc_merge_entry(&merged, - &qp->uses[qp->nuses - 1].link->tterm); + &qp->uses[qp->nuses - 1].link->tterm); /* * Now merge in the original entry. @@ -374,6 +377,7 @@ _nc_resolve_uses(bool fullresolve) FreeIfNeeded(qp->tterm.Numbers); FreeIfNeeded(qp->tterm.Strings); qp->tterm = merged; + _nc_wrap_entry(qp, TRUE); /* * We know every entry is resolvable because name resolution @@ -395,15 +399,18 @@ _nc_resolve_uses(bool fullresolve) * entry there should be no cancellation markers. */ for_entry_list(qp) { - for_each_boolean(j, &(qp->tterm)) - if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) - qp->tterm.Booleans[j] = ABSENT_BOOLEAN; - for_each_number(j, &(qp->tterm)) + for_each_boolean(j, &(qp->tterm)) { + if ((int) qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = ABSENT_BOOLEAN; + } + for_each_number(j, &(qp->tterm)) { if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) - qp->tterm.Numbers[j] = ABSENT_NUMERIC; - for_each_string(j, &(qp->tterm)) + qp->tterm.Numbers[j] = ABSENT_NUMERIC; + } + for_each_string(j, &(qp->tterm)) { if (qp->tterm.Strings[j] == CANCELLED_STRING) - qp->tterm.Strings[j] = ABSENT_STRING; + qp->tterm.Strings[j] = ABSENT_STRING; + } } } @@ -447,14 +454,14 @@ sanity_check(TERMTYPE * tp) bool terminal_entry = !strchr(tp->term_names, '+'); if (terminal_entry && (PRESENT(set_attributes) - || PRESENT(enter_standout_mode) - || PRESENT(enter_underline_mode) - || PRESENT(enter_blink_mode) - || PRESENT(enter_bold_mode) - || PRESENT(enter_dim_mode) - || PRESENT(enter_secure_mode) - || PRESENT(enter_protected_mode) - || PRESENT(enter_reverse_mode))) + || PRESENT(enter_standout_mode) + || PRESENT(enter_underline_mode) + || PRESENT(enter_blink_mode) + || PRESENT(enter_bold_mode) + || PRESENT(enter_dim_mode) + || PRESENT(enter_secure_mode) + || PRESENT(enter_protected_mode) + || PRESENT(enter_reverse_mode))) _nc_warning("no exit_attribute_mode"); #endif /* __UNUSED__ */ PAIRED(enter_standout_mode, exit_standout_mode) diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c index 2ada427fc8c..80b4b84cec5 100644 --- a/lib/libcurses/tinfo/comp_scan.c +++ b/lib/libcurses/tinfo/comp_scan.c @@ -50,7 +50,7 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$From: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") +MODULE_ID("$From: comp_scan.c,v 1.52 2000/12/10 02:55:07 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -60,14 +60,22 @@ MODULE_ID("$From: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") #define iswhite(ch) (ch == ' ' || ch == '\t') -int _nc_syntax = 0; /* termcap or terminfo? */ -long _nc_curr_file_pos = 0; /* file offset of current line */ -long _nc_comment_start = 0; /* start of comment range before name */ -long _nc_comment_end = 0; /* end of comment range before name */ -long _nc_start_line = 0; /* start line of current entry */ - -struct token _nc_curr_token = -{0, 0, 0}; +NCURSES_EXPORT_VAR(int) +_nc_syntax = 0; /* termcap or terminfo? */ +NCURSES_EXPORT_VAR(long) +_nc_curr_file_pos = 0; /* file offset of current line */ +NCURSES_EXPORT_VAR(long) +_nc_comment_start = 0; /* start of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_comment_end = 0; /* end of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_start_line = 0; /* start line of current entry */ + +NCURSES_EXPORT_VAR(struct token) +_nc_curr_token = +{ + 0, 0, 0 +}; /***************************************************************************** * @@ -81,18 +89,18 @@ static int pushtype; /* type of pushback token */ static char pushname[MAX_NAME_SIZE + 1]; #if NCURSES_EXT_FUNCS -bool _nc_disable_period = FALSE; /* used by tic -a option */ +NCURSES_EXPORT_VAR(bool) _nc_disable_period = FALSE; /* used by tic -a option */ #endif -static int last_char(void); -static int next_char(void); -static long stream_pos(void); -static bool end_of_stream(void); -static void push_back(char c); + static int last_char(void); + static int next_char(void); + static long stream_pos(void); + static bool end_of_stream(void); + static void push_back(char c); /* Assume we may be looking at a termcap-style continuation */ -static inline int -eat_escaped_newline(int ch) + static inline int + eat_escaped_newline(int ch) { if (ch == '\\') while ((ch = next_char()) == '\n' || iswhite(ch)) @@ -133,7 +141,7 @@ eat_escaped_newline(int ch) * */ -int +NCURSES_EXPORT(int) _nc_get_token(void) { static const char terminfo_punct[] = "@%&*!#"; @@ -203,7 +211,7 @@ _nc_get_token(void) #endif && !strchr(terminfo_punct, (char) ch)) { _nc_warning("Illegal character (expected alphanumeric or %s) - %s", - terminfo_punct, unctrl(ch)); + terminfo_punct, unctrl((chtype) ch)); _nc_panic_mode(separator); goto start_token; } @@ -296,7 +304,7 @@ _nc_get_token(void) * dangerous due to shell expansion. */ for (ptr = buffer; ptr < desc; ptr++) { - if (isspace(*ptr)) { + if (isspace(CharOf(*ptr))) { _nc_warning("whitespace in name or alias field"); break; } else if (*ptr == '/') { @@ -338,7 +346,7 @@ _nc_get_token(void) case '@': if ((ch = next_char()) != separator) _nc_warning("Missing separator after `%s', have %s", - buffer, unctrl(ch)); + buffer, unctrl((chtype) ch)); _nc_curr_token.tk_name = buffer; type = CANCEL; break; @@ -376,7 +384,7 @@ _nc_get_token(void) default: /* just to get rid of the compiler warning */ type = UNDEF; - _nc_warning("Illegal character - %s", unctrl(ch)); + _nc_warning("Illegal character - %s", unctrl((chtype) ch)); } } /* end else (first_column == FALSE) */ } /* end else (ch != EOF) */ @@ -454,11 +462,11 @@ _nc_get_token(void) * */ -char +NCURSES_EXPORT(char) _nc_trans_string(char *ptr, char *last) { int count = 0; - int number; + int number = 0; int i, c; chtype ch, last_ch = '\0'; bool ignored = FALSE; @@ -608,7 +616,7 @@ _nc_trans_string(char *ptr, char *last) * get_token() call. */ -void +NCURSES_EXPORT(void) _nc_push_token(int tokclass) { /* @@ -627,7 +635,7 @@ _nc_push_token(int tokclass) /* * Panic mode error recovery - skip everything until a "ch" is found. */ -void +NCURSES_EXPORT(void) _nc_panic_mode(char ch) { int c; @@ -661,7 +669,7 @@ static FILE *yyin; /* scanner's input file descriptor */ * non-null. */ -void +NCURSES_EXPORT(void) _nc_reset_input(FILE * fp, char *buf) { pushtype = NO_PUSHBACK; @@ -684,7 +692,7 @@ last_char(void) { size_t len = strlen(bufptr); while (len--) { - if (!isspace(bufptr[len])) + if (!isspace(CharOf(bufptr[len]))) return bufptr[len]; } return 0; diff --git a/lib/libcurses/tinfo/doalloc.c b/lib/libcurses/tinfo/doalloc.c index 2afac65e2ef..14628653065 100644 --- a/lib/libcurses/tinfo/doalloc.c +++ b/lib/libcurses/tinfo/doalloc.c @@ -1,7 +1,7 @@ -/* $OpenBSD: doalloc.c,v 1.4 1999/05/08 20:29:01 millert Exp $ */ +/* $OpenBSD: doalloc.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * 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 * @@ -32,7 +32,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1998 * ****************************************************************************/ - /* * Wrapper for malloc/realloc. Standard implementations allow realloc with * a null pointer, but older libraries may not (e.g., SunOS). @@ -42,31 +41,33 @@ #include <curses.priv.h> -MODULE_ID("$From: doalloc.c,v 1.5 1999/03/14 12:25:27 tom Exp $") +MODULE_ID("$From: doalloc.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void *_nc_doalloc(void *oldp, size_t amount) +NCURSES_EXPORT(void *) +_nc_doalloc(void *oldp, size_t amount) { - void *newp; + void *newp; - if (oldp != 0) { - if ((newp = realloc(oldp, amount)) == 0) { - free(oldp); - errno = ENOMEM; /* just in case 'free' reset */ - } - } else { - newp = typeMalloc(char, amount); + if (oldp != 0) { + if ((newp = realloc(oldp, amount)) == 0) { + free(oldp); + errno = ENOMEM; /* just in case 'free' reset */ } - return newp; + } else { + newp = typeMalloc(char, amount); + } + return newp; } #if !HAVE_STRDUP -char *_nc_strdup(const char *src) +NCURSES_EXPORT(char *) +_nc_strdup(const char *src) { char *dst; if (src != 0) { dst = typeMalloc(char, strlen(src) + 1); if (dst != 0) { - (void)strcpy(dst, src); + (void) strcpy(dst, src); } } else { dst = 0; diff --git a/lib/libcurses/tinfo/free_ttype.c b/lib/libcurses/tinfo/free_ttype.c index 31588f3f458..987a3dfd4b1 100644 --- a/lib/libcurses/tinfo/free_ttype.c +++ b/lib/libcurses/tinfo/free_ttype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: free_ttype.c,v 1.4 2000/07/10 03:06:16 millert Exp $ */ +/* $OpenBSD: free_ttype.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999,2000 Free Software Foundation, Inc. * @@ -32,7 +32,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1999 * ****************************************************************************/ - /* * free_ttype.c -- allocation functions for TERMTYPE * @@ -46,9 +45,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: free_ttype.c,v 1.5 2000/07/08 00:43:58 tom Exp $") +MODULE_ID("$From: free_ttype.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void _nc_free_termtype(TERMTYPE *ptr) +NCURSES_EXPORT(void) +_nc_free_termtype(TERMTYPE * ptr) { FreeIfNeeded(ptr->str_table); FreeIfNeeded(ptr->term_names); @@ -63,9 +63,10 @@ void _nc_free_termtype(TERMTYPE *ptr) } #if NCURSES_XNAMES -bool _nc_user_definable = TRUE; +NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE; -int use_extended_names(bool flag) +NCURSES_EXPORT(int) +use_extended_names(bool flag) { int oldflag = _nc_user_definable; _nc_user_definable = flag; diff --git a/lib/libcurses/tinfo/getenv_num.c b/lib/libcurses/tinfo/getenv_num.c index 21e48bdbafe..80723dbedf8 100644 --- a/lib/libcurses/tinfo/getenv_num.c +++ b/lib/libcurses/tinfo/getenv_num.c @@ -1,7 +1,7 @@ -/* $OpenBSD: getenv_num.c,v 1.1 1999/01/18 19:10:15 millert Exp $ */ +/* $OpenBSD: getenv_num.c,v 1.2 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,21 +38,21 @@ #include <curses.priv.h> -MODULE_ID("$From: getenv_num.c,v 1.1 1998/09/19 21:30:23 tom Exp $") +MODULE_ID("$From: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) _nc_getenv_num(const char *name) { - char *dst = 0; - char *src = getenv(name); - long value; - - if ((src == 0) - || (value = strtol(src, &dst, 0)) < 0 - || (dst == src) - || (*dst != '\0') - || (int)value < value) - value = -1; - - return (int) value; + char *dst = 0; + char *src = getenv(name); + long value; + + if ((src == 0) + || (value = strtol(src, &dst, 0)) < 0 + || (dst == src) + || (*dst != '\0') + || (int) value < value) + value = -1; + + return (int) value; } diff --git a/lib/libcurses/tinfo/home_terminfo.c b/lib/libcurses/tinfo/home_terminfo.c index 367bfa68fe7..13b0cad7e6c 100644 --- a/lib/libcurses/tinfo/home_terminfo.c +++ b/lib/libcurses/tinfo/home_terminfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: home_terminfo.c,v 1.6 2000/10/09 14:39:50 millert Exp $ */ +/* $OpenBSD: home_terminfo.c,v 1.7 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -39,13 +39,13 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$From: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $"); +MODULE_ID("$From: home_terminfo.c,v 1.6 2000/12/10 02:55:07 tom Exp $") #define my_length (strlen(home) + sizeof(PRIVATE_INFO)) /* ncurses extension...fall back on user's private directory */ -char * +NCURSES_EXPORT(char *) _nc_home_terminfo(void) { char *home; diff --git a/lib/libcurses/tinfo/init_keytry.c b/lib/libcurses/tinfo/init_keytry.c index d4c96517309..083861d2690 100644 --- a/lib/libcurses/tinfo/init_keytry.c +++ b/lib/libcurses/tinfo/init_keytry.c @@ -1,7 +1,7 @@ -/* $OpenBSD: init_keytry.c,v 1.4 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: init_keytry.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -30,11 +30,11 @@ #include <curses.priv.h> -#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ +#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ /* cursor_visible,cursor_normal,cursor_invisible */ -#include <tic.h> /* struct tinfo_fkeys */ +#include <tic.h> /* struct tinfo_fkeys */ -MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$From: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $") /* ** _nc_init_keytry() @@ -54,27 +54,29 @@ MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") #endif*/ #if BROKEN_LINKER -struct tinfo_fkeys *_nc_tinfo_fkeysf(void) +struct tinfo_fkeys * +_nc_tinfo_fkeysf(void) { - return _nc_tinfo_fkeys; + return _nc_tinfo_fkeys; } #endif -void _nc_init_keytry(void) +NCURSES_EXPORT(void) +_nc_init_keytry(void) { - size_t n; + size_t n; - /* The SP->_keytry value is initialized in newterm(), where the SP - * structure is created, because we can not tell where keypad() or - * mouse_activate() (which will call keyok()) are first called. - */ + /* The SP->_keytry value is initialized in newterm(), where the SP + * structure is created, because we can not tell where keypad() or + * mouse_activate() (which will call keyok()) are first called. + */ - for (n = 0; _nc_tinfo_fkeys[n].code; n++) - if (_nc_tinfo_fkeys[n].offset < STRCOUNT) - _nc_add_to_try(&(SP->_keytry), - CUR Strings[_nc_tinfo_fkeys[n].offset], - _nc_tinfo_fkeys[n].code); + for (n = 0; _nc_tinfo_fkeys[n].code; n++) + if (_nc_tinfo_fkeys[n].offset < STRCOUNT) + _nc_add_to_try(&(SP->_keytry), + CUR Strings[_nc_tinfo_fkeys[n].offset], + _nc_tinfo_fkeys[n].code); #ifdef TRACE - _nc_trace_tries(SP->_keytry); + _nc_trace_tries(SP->_keytry); #endif } diff --git a/lib/libcurses/tinfo/lib_acs.c b/lib/libcurses/tinfo/lib_acs.c index a9b142b9b64..9e406cf4d18 100644 --- a/lib/libcurses/tinfo/lib_acs.c +++ b/lib/libcurses/tinfo/lib_acs.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_acs.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_acs.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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,109 +33,133 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - #include <curses.priv.h> -#include <term.h> /* ena_acs, acs_chars */ - -MODULE_ID("$From: lib_acs.c,v 1.16 1999/10/30 23:00:16 tom Exp $") +#include <term.h> /* ena_acs, acs_chars */ -chtype acs_map[ACS_LEN] = { 0 }; +MODULE_ID("$From: lib_acs.c,v 1.18 2000/12/10 02:55:07 tom Exp $") -void _nc_init_acs(void) +NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] = { - T(("initializing ACS map")); + 0 +}; - /* - * Initializations for a UNIX-like multi-terminal environment. Use - * ASCII chars and count on the terminfo description to do better. - */ - ACS_ULCORNER = '+'; /* should be upper left corner */ - ACS_LLCORNER = '+'; /* should be lower left corner */ - ACS_URCORNER = '+'; /* should be upper right corner */ - ACS_LRCORNER = '+'; /* should be lower right corner */ - ACS_RTEE = '+'; /* should be tee pointing left */ - ACS_LTEE = '+'; /* should be tee pointing right */ - ACS_BTEE = '+'; /* should be tee pointing up */ - ACS_TTEE = '+'; /* should be tee pointing down */ - ACS_HLINE = '-'; /* should be horizontal line */ - ACS_VLINE = '|'; /* should be vertical line */ - ACS_PLUS = '+'; /* should be large plus or crossover */ - ACS_S1 = '~'; /* should be scan line 1 */ - ACS_S9 = '_'; /* should be scan line 9 */ - ACS_DIAMOND = '+'; /* should be diamond */ - ACS_CKBOARD = ':'; /* should be checker board (stipple) */ - ACS_DEGREE = '\''; /* should be degree symbol */ - ACS_PLMINUS = '#'; /* should be plus/minus */ - ACS_BULLET = 'o'; /* should be bullet */ - ACS_LARROW = '<'; /* should be arrow pointing left */ - ACS_RARROW = '>'; /* should be arrow pointing right */ - ACS_DARROW = 'v'; /* should be arrow pointing down */ - ACS_UARROW = '^'; /* should be arrow pointing up */ - ACS_BOARD = '#'; /* should be board of squares */ - ACS_LANTERN = '#'; /* should be lantern symbol */ - ACS_BLOCK = '#'; /* should be solid square block */ - /* these defaults were invented for ncurses */ - ACS_S3 = '-'; /* should be scan line 3 */ - ACS_S7 = '-'; /* should be scan line 7 */ - ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ - ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ - ACS_PI = '*'; /* should be greek pi */ - ACS_NEQUAL = '!'; /* should be not-equal */ - ACS_STERLING = 'f'; /* should be pound-sterling symbol */ +NCURSES_EXPORT(void) +_nc_init_acs(void) +{ + T(("initializing ACS map")); - if (ena_acs != NULL) - { - TPUTS_TRACE("ena_acs"); - putp(ena_acs); - } + /* + * Initializations for a UNIX-like multi-terminal environment. Use + * ASCII chars and count on the terminfo description to do better. + */ + ACS_ULCORNER = '+'; /* should be upper left corner */ + ACS_LLCORNER = '+'; /* should be lower left corner */ + ACS_URCORNER = '+'; /* should be upper right corner */ + ACS_LRCORNER = '+'; /* should be lower right corner */ + ACS_RTEE = '+'; /* should be tee pointing left */ + ACS_LTEE = '+'; /* should be tee pointing right */ + ACS_BTEE = '+'; /* should be tee pointing up */ + ACS_TTEE = '+'; /* should be tee pointing down */ + ACS_HLINE = '-'; /* should be horizontal line */ + ACS_VLINE = '|'; /* should be vertical line */ + ACS_PLUS = '+'; /* should be large plus or crossover */ + ACS_S1 = '~'; /* should be scan line 1 */ + ACS_S9 = '_'; /* should be scan line 9 */ + ACS_DIAMOND = '+'; /* should be diamond */ + ACS_CKBOARD = ':'; /* should be checker board (stipple) */ + ACS_DEGREE = '\''; /* should be degree symbol */ + ACS_PLMINUS = '#'; /* should be plus/minus */ + ACS_BULLET = 'o'; /* should be bullet */ + ACS_LARROW = '<'; /* should be arrow pointing left */ + ACS_RARROW = '>'; /* should be arrow pointing right */ + ACS_DARROW = 'v'; /* should be arrow pointing down */ + ACS_UARROW = '^'; /* should be arrow pointing up */ + ACS_BOARD = '#'; /* should be board of squares */ + ACS_LANTERN = '#'; /* should be lantern symbol */ + ACS_BLOCK = '#'; /* should be solid square block */ + /* these defaults were invented for ncurses */ + ACS_S3 = '-'; /* should be scan line 3 */ + ACS_S7 = '-'; /* should be scan line 7 */ + ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ + ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ + ACS_PI = '*'; /* should be greek pi */ + ACS_NEQUAL = '!'; /* should be not-equal */ + ACS_STERLING = 'f'; /* should be pound-sterling symbol */ + if (ena_acs != NULL) { + TPUTS_TRACE("ena_acs"); + putp(ena_acs); + } #define ALTCHAR(c) ((chtype)(((unsigned char)(c)) | A_ALTCHARSET)) - if (acs_chars != NULL) { - size_t i = 0; - size_t length = strlen(acs_chars); + if (acs_chars != NULL) { + size_t i = 0; + size_t length = strlen(acs_chars); - while (i < length) - switch (acs_chars[i]) { - case 'l':case 'm':case 'k':case 'j': - case 'u':case 't':case 'v':case 'w': - case 'q':case 'x':case 'n':case 'o': - case 's':case '`':case 'a':case 'f': - case 'g':case '~':case ',':case '+': - case '.':case '-':case 'h':case 'i': - case '0':case 'p':case 'r':case 'y': - case 'z':case '{':case '|':case '}': - acs_map[(unsigned int)acs_chars[i]] = - ALTCHAR(acs_chars[i+1]); - i++; - /* FALLTHRU */ - default: - i++; - break; - } - } + while (i < length) + switch (acs_chars[i]) { + case 'l': + case 'm': + case 'k': + case 'j': + case 'u': + case 't': + case 'v': + case 'w': + case 'q': + case 'x': + case 'n': + case 'o': + case 's': + case '`': + case 'a': + case 'f': + case 'g': + case '~': + case ',': + case '+': + case '.': + case '-': + case 'h': + case 'i': + case '0': + case 'p': + case 'r': + case 'y': + case 'z': + case '{': + case '|': + case '}': + acs_map[(unsigned int) acs_chars[i]] = + ALTCHAR(acs_chars[i + 1]); + i++; + /* FALLTHRU */ + default: + i++; + break; + } + } #ifdef TRACE - /* Show the equivalent mapping, noting if it does not match the - * given attribute, whether by re-ordering or duplication. - */ - if (_nc_tracing & TRACE_CALLS) { - size_t n, m; - char show[SIZEOF(acs_map) + 1]; - for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { - if (acs_map[n] != 0) { - show[m++] = (char)n; - show[m++] = TextOf(acs_map[n]); - } - } - show[m] = 0; - _tracef("%s acs_chars %s", - (acs_chars == NULL) - ? "NULL" - : (strcmp(acs_chars, show) - ? "DIFF" - : "SAME"), - _nc_visbuf(show)); + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + if (_nc_tracing & TRACE_CALLS) { + size_t n, m; + char show[SIZEOF(acs_map) + 1]; + for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { + if (acs_map[n] != 0) { + show[m++] = (char) n; + show[m++] = TextOf(acs_map[n]); + } } + show[m] = 0; + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); + } #endif /* TRACE */ } diff --git a/lib/libcurses/tinfo/lib_baudrate.c b/lib/libcurses/tinfo/lib_baudrate.c index 31a78c107f6..39342dcb9ab 100644 --- a/lib/libcurses/tinfo/lib_baudrate.c +++ b/lib/libcurses/tinfo/lib_baudrate.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_baudrate.c,v 1.3 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_baudrate.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,7 +42,7 @@ #include <term.h> /* cur_term, pad_char */ #include <termcap.h> /* ospeed */ -MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") +MODULE_ID("$From: lib_baudrate.c,v 1.19 2000/12/10 02:55:07 tom Exp $") /* * int @@ -53,8 +53,8 @@ MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") */ struct speed { - int s; /* value for 'ospeed' is an index */ - int sp; /* the actual speed */ + int s; /* value for 'ospeed' is an index */ + int sp; /* the actual speed */ }; static struct speed const speeds[] = @@ -101,7 +101,7 @@ static struct speed const speeds[] = #endif }; -int +NCURSES_EXPORT(int) _nc_baudrate(int OSpeed) { static int last_OSpeed; @@ -127,7 +127,7 @@ _nc_baudrate(int OSpeed) return (result); } -int +NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; @@ -144,7 +144,7 @@ _nc_ospeed(int BaudRate) return (result); } -int +NCURSES_EXPORT(int) baudrate(void) { int result; diff --git a/lib/libcurses/tinfo/lib_cur_term.c b/lib/libcurses/tinfo/lib_cur_term.c index 22bdcaa77df..3fcf4abe47c 100644 --- a/lib/libcurses/tinfo/lib_cur_term.c +++ b/lib/libcurses/tinfo/lib_cur_term.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_cur_term.c,v 1.4 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_cur_term.c,v 1.5 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,34 +39,36 @@ */ #include <curses.priv.h> -#include <term_entry.h> /* TTY, cur_term */ -#include <termcap.h> /* ospeed */ +#include <term_entry.h> /* TTY, cur_term */ +#include <termcap.h> /* ospeed */ -MODULE_ID("$From: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$From: lib_cur_term.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -TERMINAL *cur_term = 0; +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; -TERMINAL *set_curterm(TERMINAL *termp) +NCURSES_EXPORT(TERMINAL *) +set_curterm(TERMINAL * termp) { - TERMINAL *oldterm = cur_term; + TERMINAL *oldterm = cur_term; - if ((cur_term = termp) != 0) { - ospeed = _nc_ospeed(cur_term->_baudrate); - PC = (pad_char != NULL) ? pad_char[0] : 0; - } - return oldterm; + if ((cur_term = termp) != 0) { + ospeed = _nc_ospeed(cur_term->_baudrate); + PC = (pad_char != NULL) ? pad_char[0] : 0; + } + return oldterm; } -int del_curterm(TERMINAL *termp) +NCURSES_EXPORT(int) +del_curterm(TERMINAL * termp) { - T((T_CALLED("del_curterm(%p)"), termp)); + T((T_CALLED("del_curterm(%p)"), termp)); - if (termp != 0) { - _nc_free_termtype(&(termp->type)); - free(termp); - if (termp == cur_term) - cur_term = 0; - returnCode(OK); - } - returnCode(ERR); + if (termp != 0) { + _nc_free_termtype(&(termp->type)); + free(termp); + if (termp == cur_term) + cur_term = 0; + returnCode(OK); + } + returnCode(ERR); } diff --git a/lib/libcurses/tinfo/lib_data.c b/lib/libcurses/tinfo/lib_data.c index f686f40b4da..cdc8044ab18 100644 --- a/lib/libcurses/tinfo/lib_data.c +++ b/lib/libcurses/tinfo/lib_data.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_data.c,v 1.2 1999/01/31 20:17:10 millert Exp $ */ +/* $OpenBSD: lib_data.c,v 1.3 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -42,17 +42,20 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $") +MODULE_ID("$From: lib_data.c,v 1.16 2000/12/10 02:55:07 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when * constructing a dll (reported by J.J.G.Ripoll). */ -WINDOW *stdscr = 0; -WINDOW *curscr = 0; -WINDOW *newscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +stdscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +curscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +newscr = 0; -SCREEN *_nc_screen_chain = 0; +NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; /* * The variable 'SP' will be defined as a function on systems that cannot link @@ -65,22 +68,26 @@ SCREEN *_nc_screen_chain = 0; * module coupling that increases the size of the executable. */ #if BROKEN_LINKER -static SCREEN *my_screen; + static SCREEN *my_screen; -SCREEN *_nc_screen(void) +NCURSES_EXPORT(SCREEN *) +_nc_screen(void) { - return my_screen; + return my_screen; } -int _nc_alloc_screen(void) +NCURSES_EXPORT(int) +_nc_alloc_screen(void) { - return ((my_screen = typeCalloc(SCREEN, 1)) != 0); + return ((my_screen = typeCalloc(SCREEN, 1)) != 0); } -void _nc_set_screen(SCREEN *sp) +NCURSES_EXPORT(void) +_nc_set_screen(SCREEN * sp) { - my_screen = sp; + my_screen = sp; } + #else -SCREEN *SP = NULL; /* Some linkers require initialized data... */ +NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ #endif diff --git a/lib/libcurses/tinfo/lib_has_cap.c b/lib/libcurses/tinfo/lib_has_cap.c index de5ebb5c133..d95e3f908c7 100644 --- a/lib/libcurses/tinfo/lib_has_cap.c +++ b/lib/libcurses/tinfo/lib_has_cap.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_has_cap.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */ +/* $OpenBSD: lib_has_cap.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_has_cap.c ** @@ -45,21 +44,23 @@ #include <term.h> -MODULE_ID("$From: lib_has_cap.c,v 1.1 1998/10/23 15:32:21 tom Exp $") +MODULE_ID("$From: lib_has_cap.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -bool has_ic(void) +NCURSES_EXPORT(bool) +has_ic(void) { - T((T_CALLED("has_ic()"))); - returnCode(cur_term && - (insert_character || parm_ich - || (enter_insert_mode && exit_insert_mode)) - && (delete_character || parm_dch)); + T((T_CALLED("has_ic()"))); + returnCode(cur_term && + (insert_character || parm_ich + || (enter_insert_mode && exit_insert_mode)) + && (delete_character || parm_dch)); } -bool has_il(void) +NCURSES_EXPORT(bool) +has_il(void) { - T((T_CALLED("has_il()"))); - returnCode(cur_term - && (insert_line || parm_insert_line) - && (delete_line || parm_delete_line)); + T((T_CALLED("has_il()"))); + returnCode(cur_term + && (insert_line || parm_insert_line) + && (delete_line || parm_delete_line)); } diff --git a/lib/libcurses/tinfo/lib_kernel.c b/lib/libcurses/tinfo/lib_kernel.c index 16cb06afe9d..730ba1551fd 100644 --- a/lib/libcurses/tinfo/lib_kernel.c +++ b/lib/libcurses/tinfo/lib_kernel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_kernel.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */ +/* $OpenBSD: lib_kernel.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * lib_kernel.c * @@ -48,9 +47,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") +MODULE_ID("$From: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $") /* * erasechar() @@ -59,23 +58,21 @@ MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") * */ -char +NCURSES_EXPORT(char) erasechar(void) { - T((T_CALLED("erasechar()"))); + T((T_CALLED("erasechar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VERASE]); + returnCode(cur_term->Ottyb.c_cc[VERASE]); #else - returnCode(cur_term->Ottyb.sg_erase); + returnCode(cur_term->Ottyb.sg_erase); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * killchar() * @@ -83,23 +80,21 @@ erasechar(void) * */ -char +NCURSES_EXPORT(char) killchar(void) { - T((T_CALLED("killchar()"))); + T((T_CALLED("killchar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VKILL]); + returnCode(cur_term->Ottyb.c_cc[VKILL]); #else - returnCode(cur_term->Ottyb.sg_kill); + returnCode(cur_term->Ottyb.sg_kill); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * flushinp() * @@ -107,26 +102,27 @@ killchar(void) * */ -int flushinp(void) +NCURSES_EXPORT(int) +flushinp(void) { - T((T_CALLED("flushinp()"))); + T((T_CALLED("flushinp()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - tcflush(cur_term->Filedes, TCIFLUSH); + tcflush(cur_term->Filedes, TCIFLUSH); #else - errno = 0; - do { - ioctl(cur_term->Filedes, TIOCFLUSH, 0); - } while - (errno == EINTR); + errno = 0; + do { + ioctl(cur_term->Filedes, TIOCFLUSH, 0); + } while + (errno == EINTR); #endif - if (SP) { - SP->_fifohead = -1; - SP->_fifotail = 0; - SP->_fifopeek = 0; - } - returnCode(OK); + if (SP) { + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } diff --git a/lib/libcurses/tinfo/lib_longname.c b/lib/libcurses/tinfo/lib_longname.c index 558453a69bb..9cbbf5fcbf5 100644 --- a/lib/libcurses/tinfo/lib_longname.c +++ b/lib/libcurses/tinfo/lib_longname.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_longname.c,v 1.1 1999/01/18 19:10:18 millert Exp $ */ +/* $OpenBSD: lib_longname.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_longname.c ** @@ -43,18 +42,18 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_longname.c,v 1.7 1999/01/03 01:47:45 tom Exp $") +MODULE_ID("$From: lib_longname.c,v 1.9 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) longname(void) { -char *ptr; + char *ptr; - T((T_CALLED("longname()"))); + T((T_CALLED("longname()"))); - for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) - if (*ptr == '|') - returnPtr(ptr + 1); + for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) + if (*ptr == '|') + returnPtr(ptr + 1); - returnPtr(ttytype); + returnPtr(ttytype); } diff --git a/lib/libcurses/tinfo/lib_napms.c b/lib/libcurses/tinfo/lib_napms.c index de4f97efce7..bf29ef488f5 100644 --- a/lib/libcurses/tinfo/lib_napms.c +++ b/lib/libcurses/tinfo/lib_napms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_napms.c,v 1.6 2000/06/19 03:53:50 millert Exp $ */ +/* $OpenBSD: lib_napms.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -60,9 +60,9 @@ #endif #endif -MODULE_ID("$From: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $") +MODULE_ID("$From: lib_napms.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) napms(int ms) { T((T_CALLED("napms(%d)"), ms)); diff --git a/lib/libcurses/tinfo/lib_options.c b/lib/libcurses/tinfo/lib_options.c index ad42bf8b41f..ca96bc3d7db 100644 --- a/lib/libcurses/tinfo/lib_options.c +++ b/lib/libcurses/tinfo/lib_options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_options.c,v 1.8 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_options.c,v 1.9 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -44,9 +44,9 @@ #include <term.h> -MODULE_ID("$From: lib_options.c,v 1.40 2000/09/02 18:02:05 tom Exp $") +MODULE_ID("$From: lib_options.c,v 1.42 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) { T((T_CALLED("idlok(%p,%d)"), win, flag)); @@ -58,7 +58,7 @@ idlok(WINDOW *win, bool flag) returnCode(ERR); } -void +NCURSES_EXPORT(void) idcok(WINDOW *win, bool flag) { T((T_CALLED("idcok(%p,%d)"), win, flag)); @@ -69,7 +69,7 @@ idcok(WINDOW *win, bool flag) returnVoid; } -int +NCURSES_EXPORT(int) halfdelay(int t) { T((T_CALLED("halfdelay(%d)"), t)); @@ -82,7 +82,7 @@ halfdelay(int t) returnCode(OK); } -int +NCURSES_EXPORT(int) nodelay(WINDOW *win, bool flag) { T((T_CALLED("nodelay(%p,%d)"), win, flag)); @@ -97,7 +97,7 @@ nodelay(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) notimeout(WINDOW *win, bool f) { T((T_CALLED("notimout(%p,%d)"), win, f)); @@ -109,7 +109,7 @@ notimeout(WINDOW *win, bool f) returnCode(ERR); } -void +NCURSES_EXPORT(void) wtimeout(WINDOW *win, int delay) { T((T_CALLED("wtimeout(%p,%d)"), win, delay)); @@ -119,7 +119,7 @@ wtimeout(WINDOW *win, int delay) } } -int +NCURSES_EXPORT(int) keypad(WINDOW *win, bool flag) { T((T_CALLED("keypad(%p,%d)"), win, flag)); @@ -131,7 +131,7 @@ keypad(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) meta(WINDOW *win GCC_UNUSED, bool flag) { /* Ok, we stay relaxed and don't signal an error if win is NULL */ @@ -151,7 +151,7 @@ meta(WINDOW *win GCC_UNUSED, bool flag) /* curs_set() moved here to narrow the kernel interface */ -int +NCURSES_EXPORT(int) curs_set(int vis) { int cursor = SP->_cursor; @@ -193,7 +193,7 @@ curs_set(int vis) returnCode(cursor == -1 ? 1 : cursor); } -int +NCURSES_EXPORT(int) typeahead(int fd) { T((T_CALLED("typeahead(%d)"), fd)); @@ -218,10 +218,10 @@ has_key_internal(int keycode, struct tries *tp) return (TRUE); else return (has_key_internal(keycode, tp->child) - || has_key_internal(keycode, tp->sibling)); + || has_key_internal(keycode, tp->sibling)); } -int +NCURSES_EXPORT(int) has_key(int keycode) { T((T_CALLED("has_key(%d)"), keycode)); @@ -236,7 +236,7 @@ has_key(int keycode) * flush, then the next wgetch may get the escape sequence that corresponds to * the terminal state _before_ switching modes. */ -int +NCURSES_EXPORT(int) _nc_keypad(bool flag) { if (flag && keypad_xmit) { diff --git a/lib/libcurses/tinfo/lib_print.c b/lib/libcurses/tinfo/lib_print.c index a42bccf6f21..0bb6b5a4c6b 100644 --- a/lib/libcurses/tinfo/lib_print.c +++ b/lib/libcurses/tinfo/lib_print.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_print.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */ +/* $OpenBSD: lib_print.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,49 +33,44 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $") +MODULE_ID("$From: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $") -int mcprint(char *data, int len) +NCURSES_EXPORT(int) +mcprint(char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ { - char *mybuf, *switchon; - size_t onsize, offsize, res; + char *mybuf, *switchon; + size_t onsize, offsize, res; errno = 0; - if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) - { + if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) { errno = ENODEV; - return(ERR); + return (ERR); } - if (prtr_non) - { + if (prtr_non) { switchon = tparm(prtr_non, len); onsize = strlen(switchon); offsize = 0; - } - else - { + } else { switchon = prtr_on; onsize = strlen(prtr_on); offsize = strlen(prtr_off); } - if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *)0) - { + if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *) 0) { errno = ENOMEM; - return(ERR); + return (ERR); } (void) strcpy(mybuf, switchon); memcpy(mybuf + onsize, data, len); if (offsize) - (void) strcpy(mybuf + onsize + len, prtr_off); + (void) strcpy(mybuf + onsize + len, prtr_off); /* * We're relying on the atomicity of UNIX writes here. The @@ -94,5 +89,5 @@ int mcprint(char *data, int len) (void) sleep(0); free(mybuf); - return(res); + return (res); } diff --git a/lib/libcurses/tinfo/lib_raw.c b/lib/libcurses/tinfo/lib_raw.c index be87b5a3049..eb10b64e30b 100644 --- a/lib/libcurses/tinfo/lib_raw.c +++ b/lib/libcurses/tinfo/lib_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_raw.c,v 1.6 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_raw.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") +MODULE_ID("$From: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -74,7 +74,7 @@ MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") #define AFTER(s) #endif /* TRACE */ -int +NCURSES_EXPORT(int) raw(void) { T((T_CALLED("raw()"))); @@ -102,7 +102,7 @@ raw(void) returnCode(ERR); } -int +NCURSES_EXPORT(int) cbreak(void) { T((T_CALLED("cbreak()"))); @@ -127,7 +127,7 @@ cbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) qiflush(void) { T((T_CALLED("qiflush()"))); @@ -146,7 +146,7 @@ qiflush(void) #endif } -int +NCURSES_EXPORT(int) noraw(void) { T((T_CALLED("noraw()"))); @@ -170,7 +170,7 @@ noraw(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -int +NCURSES_EXPORT(int) nocbreak(void) { T((T_CALLED("nocbreak()"))); @@ -192,7 +192,7 @@ nocbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) noqiflush(void) { T((T_CALLED("noqiflush()"))); @@ -211,7 +211,7 @@ noqiflush(void) #endif } -int +NCURSES_EXPORT(int) intrflush(WINDOW *win GCC_UNUSED, bool flag) { T((T_CALLED("intrflush(%d)"), flag)); diff --git a/lib/libcurses/tinfo/lib_setup.c b/lib/libcurses/tinfo/lib_setup.c index 77003ad61ab..1db8a06bc1b 100644 --- a/lib/libcurses/tinfo/lib_setup.c +++ b/lib/libcurses/tinfo/lib_setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_setup.c,v 1.10 2000/10/08 22:47:01 millert Exp $ */ +/* $OpenBSD: lib_setup.c,v 1.11 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$From: lib_setup.c,v 1.60 2000/09/02 18:13:12 tom Exp $") +MODULE_ID("$From: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $") /**************************************************************************** * @@ -96,16 +96,21 @@ static int _use_env = TRUE; static void do_prototype(void); -void +NCURSES_EXPORT(void) use_env(bool f) { _use_env = f; } -int LINES = 0, COLS = 0, TABSIZE = 0; +NCURSES_EXPORT_VAR(int) +LINES = 0; +NCURSES_EXPORT_VAR(int) +COLS = 0; +NCURSES_EXPORT_VAR(int) +TABSIZE = 0; -static void -_nc_get_screensize(int *linep, int *colp) + static void + _nc_get_screensize(int *linep, int *colp) /* Obtain lines/columns values from the environment and/or terminfo entry */ { /* figure out the size of the screen */ @@ -135,7 +140,7 @@ _nc_get_screensize(int *linep, int *colp) *colp = screendata[0]; *linep = screendata[1]; T(("EMX screen size: environment LINES = %d COLUMNS = %d", - *linep, *colp)); + *linep, *colp)); } #endif #if HAVE_SIZECHANGE @@ -167,11 +172,12 @@ _nc_get_screensize(int *linep, int *colp) #endif /* HAVE_SIZECHANGE */ /* if we can't get dynamic info about the size, use static */ - if (*linep <= 0 || *colp <= 0) - if (lines > 0 && columns > 0) { - *linep = (int) lines; - *colp = (int) columns; - } + if (*linep <= 0) { + *linep = (int) lines; + } + if (*colp <= 0) { + *colp = (int) columns; + } /* the ultimate fallback, assume fixed 24x80 size */ if (*linep <= 0 || *colp <= 0) { @@ -198,7 +204,7 @@ _nc_get_screensize(int *linep, int *colp) } #if USE_SIZECHANGE -void +NCURSES_EXPORT(void) _nc_update_screensize(void) { int my_lines, my_cols; @@ -267,18 +273,20 @@ grab_entry(const char *const tn, TERMTYPE * const tp) */ if (status == 1) { int n; - for_each_boolean(n, tp) + for_each_boolean(n, tp) { if (!VALID_BOOLEAN(tp->Booleans[n])) - tp->Booleans[n] = FALSE; - for_each_string(n, tp) + tp->Booleans[n] = FALSE; + } + for_each_string(n, tp) { if (tp->Strings[n] == CANCELLED_STRING) - tp->Strings[n] = ABSENT_STRING; + tp->Strings[n] = ABSENT_STRING; + } } return (status); } #endif -char ttytype[NAMESIZE] = ""; +NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = ""; /* * setupterm(termname, Filedes, errret) @@ -288,8 +296,9 @@ char ttytype[NAMESIZE] = ""; * */ -int -setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +NCURSES_EXPORT(int) +setupterm +(NCURSES_CONST char *tname, int Filedes, int *errret) { struct term *term_ptr; int status; @@ -304,7 +313,7 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) } if (strlen(tname) > MAX_NAME_SIZE) { ret_error(-1, "TERM environment must be <= %d characters.\n", - MAX_NAME_SIZE); + MAX_NAME_SIZE); } T(("your terminal name is %s", tname)); diff --git a/lib/libcurses/tinfo/lib_termcap.c b/lib/libcurses/tinfo/lib_termcap.c index 3c3e11afc6b..94173a7a576 100644 --- a/lib/libcurses/tinfo/lib_termcap.c +++ b/lib/libcurses/tinfo/lib_termcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_termcap.c,v 1.7 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_termcap.c,v 1.8 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -41,15 +41,17 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$From: lib_termcap.c,v 1.37 2000/09/16 20:30:16 tom Exp $") +MODULE_ID("$From: lib_termcap.c,v 1.39 2000/12/10 02:56:30 tom Exp $") /* some of the code in here was contributed by: Magnus Bengtsson, d6mbeng@dtek.chalmers.se */ -char *UP = 0; -char *BC = 0; +NCURSES_EXPORT_VAR(char *) +UP = 0; +NCURSES_EXPORT_VAR(char *) +BC = 0; /*************************************************************************** * @@ -66,8 +68,9 @@ char *BC = 0; * ***************************************************************************/ -int -tgetent(char *bufp GCC_UNUSED, const char *name) +NCURSES_EXPORT(int) +tgetent +(char *bufp GCC_UNUSED, const char *name) { int errcode; @@ -110,7 +113,7 @@ tgetent(char *bufp GCC_UNUSED, const char *name) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char *id) { int i; @@ -138,7 +141,7 @@ tgetflag(NCURSES_CONST char *id) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char *id) { int i; @@ -167,8 +170,9 @@ tgetnum(NCURSES_CONST char *id) * ***************************************************************************/ -char * -tgetstr(NCURSES_CONST char *id, char **area) +NCURSES_EXPORT(char *) +tgetstr +(NCURSES_CONST char *id, char **area) { int i; @@ -178,7 +182,7 @@ tgetstr(NCURSES_CONST char *id, char **area) for_each_string(i, tp) { const char *capname = ExtStrname(tp, i, strcodes); if (!strncmp(id, capname, 2)) { - TR(TRACE_DATABASE,("found match : %s", _nc_visbuf(tp->Strings[i]))); + TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(tp->Strings[i]))); /* setupterm forces canceled strings to null */ if (area != 0 && *area != 0 diff --git a/lib/libcurses/tinfo/lib_termname.c b/lib/libcurses/tinfo/lib_termname.c index ad6353e01e9..f063c300fb8 100644 --- a/lib/libcurses/tinfo/lib_termname.c +++ b/lib/libcurses/tinfo/lib_termname.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_termname.c,v 1.2 1999/08/15 11:40:55 millert Exp $ */ +/* $OpenBSD: lib_termname.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** - * 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 * @@ -29,20 +29,22 @@ ****************************************************************************/ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ -MODULE_ID("$From: lib_termname.c,v 1.2 1999/07/24 21:02:40 tom Exp $") +MODULE_ID("$From: lib_termname.c,v 1.6 2000/12/10 02:55:08 tom Exp $") -char *termname(void) +NCURSES_EXPORT(char *) +termname(void) { -char *name = getenv("TERM"); -static char ret[MAX_ALIAS+1]; + char *name = getenv("TERM"); + static char ret[MAX_ALIAS + 1]; - T(("termname() called")); + T(("termname() called")); - if (name != 0) { - (void) strncpy(ret, name, sizeof(ret) - 1); - name = ret; - } - return name; + if (name != 0) { + ret[0] = '\0'; + (void) strncat(ret, name, sizeof(ret) - 1); + name = ret; + } + return name; } diff --git a/lib/libcurses/tinfo/lib_tgoto.c b/lib/libcurses/tinfo/lib_tgoto.c index b305935cdee..c54cb39443c 100644 --- a/lib/libcurses/tinfo/lib_tgoto.c +++ b/lib/libcurses/tinfo/lib_tgoto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tgoto.c,v 1.1 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_tgoto.c,v 1.2 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 2000 Free Software Foundation, Inc. * @@ -37,7 +37,7 @@ #include <ctype.h> #include <termcap.h> -MODULE_ID("$From: lib_tgoto.c,v 1.2 2000/09/24 00:19:14 tom Exp $") +MODULE_ID("$From: lib_tgoto.c,v 1.5 2000/12/10 01:33:16 tom Exp $") #if !PURE_TERMINFO static bool @@ -45,20 +45,24 @@ is_termcap(const char *string) { bool result = TRUE; - while ((*string != '\0') && result) { - if (*string == '%') { - switch (*++string) { - case 'p': + if (string == 0 || *string == '\0') { + result = FALSE; /* tparm() handles empty strings */ + } else { + while ((*string != '\0') && result) { + if (*string == '%') { + switch (*++string) { + case 'p': + result = FALSE; + break; + case '\0': + string--; + break; + } + } else if (string[0] == '$' && string[1] == '<') { result = FALSE; - break; - case '\0': - string--; - break; } - } else if (string[0] == '$' && string[1] == '<') { - result = FALSE; + string++; } - string++; } return result; } @@ -110,7 +114,7 @@ tgoto_internal(const char *string, int x, int y) *value %= 1000; break; case '+': - *value += (*++string & 0xff); + *value += CharOf(*++string); /* FALLTHRU */ case '.': /* @@ -183,8 +187,9 @@ tgoto_internal(const char *string, int x, int y) * Retained solely for upward compatibility. Note the intentional reversing of * the last two arguments when invoking tparm(). */ -char * -tgoto(const char *string, int x, int y) +NCURSES_EXPORT(char *) +tgoto +(const char *string, int x, int y) { char *result; diff --git a/lib/libcurses/tinfo/lib_ti.c b/lib/libcurses/tinfo/lib_ti.c index df4b8a3a5a2..3c1595aef0c 100644 --- a/lib/libcurses/tinfo/lib_ti.c +++ b/lib/libcurses/tinfo/lib_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_ti.c,v 1.5 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: lib_ti.c,v 1.6 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -38,9 +38,9 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$From: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: lib_ti.c,v 1.22 2000/12/10 02:55:08 tom Exp $") -int +NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char *str) { int i; @@ -61,7 +61,7 @@ tigetflag(NCURSES_CONST char *str) returnCode(ABSENT_BOOLEAN); } -int +NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char *str) { int i; @@ -83,7 +83,7 @@ tigetnum(NCURSES_CONST char *str) returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */ } -char * +NCURSES_EXPORT(char *) tigetstr(NCURSES_CONST char *str) { int i; diff --git a/lib/libcurses/tinfo/lib_tparm.c b/lib/libcurses/tinfo/lib_tparm.c index 536301ca9c4..e5c496dd1c3 100644 --- a/lib/libcurses/tinfo/lib_tparm.c +++ b/lib/libcurses/tinfo/lib_tparm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tparm.c,v 1.6 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: lib_tparm.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -44,7 +44,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_tparm.c,v 1.48 2000/10/14 17:45:00 Sergei.Ivanov Exp $") +MODULE_ID("$From: lib_tparm.c,v 1.51 2000/12/10 02:55:08 tom Exp $") /* * char * @@ -128,7 +128,7 @@ static size_t out_size; static size_t out_used; #if NO_LEAKS -void +NCURSES_EXPORT(void) _nc_free_tparm(void) { if (out_buff != 0) { @@ -288,7 +288,7 @@ parse_format(const char *s, char *format, int *len) } break; default: - if (isdigit(*s)) { + if (isdigit(CharOf(*s))) { value = (value * 10) + (*s - '0'); if (value > 10000) err = TRUE; @@ -726,8 +726,9 @@ tparam_internal(const char *string, va_list ap) return (out_buff); } -char * -tparm(NCURSES_CONST char *string,...) +NCURSES_EXPORT(char *) +tparm +(NCURSES_CONST char *string,...) { va_list ap; char *result; diff --git a/lib/libcurses/tinfo/lib_tputs.c b/lib/libcurses/tinfo/lib_tputs.c index 6084d441902..fb20e9dc782 100644 --- a/lib/libcurses/tinfo/lib_tputs.c +++ b/lib/libcurses/tinfo/lib_tputs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tputs.c,v 1.8 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: lib_tputs.c,v 1.9 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -47,16 +47,18 @@ #include <termcap.h> /* ospeed */ #include <tic.h> -MODULE_ID("$From: lib_tputs.c,v 1.51 2000/10/08 00:22:24 tom Exp $") +MODULE_ID("$From: lib_tputs.c,v 1.55 2000/12/10 02:55:08 tom Exp $"); -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(char) +PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(int) +_nc_nulls_sent = 0; /* used by 'tack' program */ -static int (*my_outch) (int c) = _nc_outch; + static int (*my_outch) (int c) = _nc_outch; -int +NCURSES_EXPORT(int) delay_output(int ms) { T((T_CALLED("delay_output(%d)"), ms)); @@ -77,13 +79,13 @@ delay_output(int ms) returnCode(OK); } -void +NCURSES_EXPORT(void) _nc_flush(void) { (void) fflush(NC_OUTPUT); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { #ifdef TRACE @@ -111,7 +113,7 @@ _nc_outch(int ch) * No surrogates supported (we're storing only one 16-bit Unicode value per * cell). */ -int +NCURSES_EXPORT(int) _nc_utf8_outch(int ch) { static const unsigned byteMask = 0xBF; @@ -170,14 +172,15 @@ _nc_utf8_outch(int ch) } #endif -int +NCURSES_EXPORT(int) putp(const char *string) { return tputs(string, 1, _nc_outch); } -int -tputs(const char *string, int affcnt, int (*outc) (int)) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt, int (*outc) (int)) { bool always_delay; bool normal_delay; @@ -264,25 +267,26 @@ tputs(const char *string, int affcnt, int (*outc) (int)) bool mandatory; string++; - if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { + if ((!isdigit(CharOf(*string)) && *string != '.') + || !strchr(string, '>')) { (*outc) ('$'); (*outc) ('<'); continue; } number = 0; - while (isdigit(*string)) { + while (isdigit(CharOf(*string))) { number = number * 10 + (*string - '0'); string++; } number *= 10; if (*string == '.') { string++; - if (isdigit(*string)) { + if (isdigit(CharOf(*string))) { number += (*string - '0'); string++; } - while (isdigit(*string)) + while (isdigit(CharOf(*string))) string++; } diff --git a/lib/libcurses/tinfo/lib_ttyflags.c b/lib/libcurses/tinfo/lib_ttyflags.c index 9a4825e8384..615e0092564 100644 --- a/lib/libcurses/tinfo/lib_ttyflags.c +++ b/lib/libcurses/tinfo/lib_ttyflags.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_ttyflags.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_ttyflags.c,v 1.4 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,9 +38,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") +MODULE_ID("$From: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $") #undef tabs @@ -58,89 +58,94 @@ MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") # endif #endif -int _nc_get_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_get_tty_mode(TTY * buf) { - if (cur_term == 0 - || GET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_get_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || GET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_get_tty_mode: %s", _nc_tracebits())); + return (OK); } -int _nc_set_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_set_tty_mode(TTY * buf) { - if (cur_term == 0 - || SET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_set_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || SET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_set_tty_mode: %s", _nc_tracebits())); + return (OK); } -int def_shell_mode(void) +NCURSES_EXPORT(int) +def_shell_mode(void) { - T((T_CALLED("def_shell_mode()"))); + T((T_CALLED("def_shell_mode()"))); - /* - * Turn off the XTABS bit in the tty structure if it was on. If XTABS - * was on, remove the tab and backtab capabilities. - */ + /* + * Turn off the XTABS bit in the tty structure if it was on. If XTABS + * was on, remove the tab and backtab capabilities. + */ - if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) + returnCode(ERR); #ifdef TERMIOS - if (cur_term->Ottyb.c_oflag & tabs) - tab = back_tab = NULL; + if (cur_term->Ottyb.c_oflag & tabs) + tab = back_tab = NULL; #else - if (cur_term->Ottyb.sg_flags & XTABS) - tab = back_tab = NULL; + if (cur_term->Ottyb.sg_flags & XTABS) + tab = back_tab = NULL; #endif - returnCode(OK); + returnCode(OK); } -int def_prog_mode(void) +NCURSES_EXPORT(int) +def_prog_mode(void) { - T((T_CALLED("def_prog_mode()"))); + T((T_CALLED("def_prog_mode()"))); - if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) + returnCode(ERR); #ifdef TERMIOS - cur_term->Nttyb.c_oflag &= ~tabs; + cur_term->Nttyb.c_oflag &= ~tabs; #else - cur_term->Nttyb.sg_flags &= ~XTABS; + cur_term->Nttyb.sg_flags &= ~XTABS; #endif - returnCode(OK); + returnCode(OK); } -int reset_prog_mode(void) +NCURSES_EXPORT(int) +reset_prog_mode(void) { - T((T_CALLED("reset_prog_mode()"))); - - if (cur_term != 0) { - _nc_set_tty_mode(&cur_term->Nttyb); - if (SP) { - if (stdscr && stdscr->_use_keypad) - _nc_keypad(TRUE); - NC_BUFFERED(TRUE); - } - returnCode(OK); + T((T_CALLED("reset_prog_mode()"))); + + if (cur_term != 0) { + _nc_set_tty_mode(&cur_term->Nttyb); + if (SP) { + if (stdscr && stdscr->_use_keypad) + _nc_keypad(TRUE); + NC_BUFFERED(TRUE); } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } -int reset_shell_mode(void) +NCURSES_EXPORT(int) +reset_shell_mode(void) { - T((T_CALLED("reset_shell_mode()"))); - - if (cur_term != 0) { - if (SP) - { - _nc_keypad(FALSE); - _nc_flush(); - NC_BUFFERED(FALSE); - } - returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + T((T_CALLED("reset_shell_mode()"))); + + if (cur_term != 0) { + if (SP) { + _nc_keypad(FALSE); + _nc_flush(); + NC_BUFFERED(FALSE); } - returnCode(ERR); + returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + } + returnCode(ERR); } /* @@ -148,18 +153,20 @@ int reset_shell_mode(void) ** */ -static TTY buf; +static TTY buf; -int savetty(void) +NCURSES_EXPORT(int) +savetty(void) { - T((T_CALLED("savetty()"))); + T((T_CALLED("savetty()"))); - returnCode(_nc_get_tty_mode(&buf)); + returnCode(_nc_get_tty_mode(&buf)); } -int resetty(void) +NCURSES_EXPORT(int) +resetty(void) { - T((T_CALLED("resetty()"))); + T((T_CALLED("resetty()"))); - returnCode(_nc_set_tty_mode(&buf)); + returnCode(_nc_set_tty_mode(&buf)); } diff --git a/lib/libcurses/tinfo/make_keys.c b/lib/libcurses/tinfo/make_keys.c index 1f36655815a..d04a9a71608 100644 --- a/lib/libcurses/tinfo/make_keys.c +++ b/lib/libcurses/tinfo/make_keys.c @@ -1,7 +1,7 @@ -/* $OpenBSD: make_keys.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: make_keys.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,98 +39,104 @@ */ #include <curses.priv.h> -MODULE_ID("$From: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$From: make_keys.c,v 1.10 2000/12/10 02:55:08 tom Exp $") #include <names.c> #define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames)) -static size_t lookup(const char *name) +static size_t +lookup(const char *name) { - size_t n; - bool found = FALSE; - for (n = 0; strnames[n] != 0; n++) { - if (!strcmp(name, strnames[n])) { - found = TRUE; - break; - } + size_t n; + bool found = FALSE; + for (n = 0; strnames[n] != 0; n++) { + if (!strcmp(name, strnames[n])) { + found = TRUE; + break; } - if (!found) { - for (n = 0; strfnames[n] != 0; n++) { - if (!strcmp(name, strfnames[n])) { - found = TRUE; - break; - } - } + } + if (!found) { + for (n = 0; strfnames[n] != 0; n++) { + if (!strcmp(name, strfnames[n])) { + found = TRUE; + break; + } } - return found ? n : UNKNOWN; + } + return found ? n : UNKNOWN; } -static void make_keys(FILE *ifp, FILE *ofp) +static void +make_keys(FILE * ifp, FILE * ofp) { - char buffer[BUFSIZ]; - char from[BUFSIZ]; - char to[BUFSIZ]; - int maxlen = 16; + char buffer[BUFSIZ]; + char from[BUFSIZ]; + char to[BUFSIZ]; + int maxlen = 16; - while (fgets(buffer, sizeof(buffer), ifp) != 0) { - if (*buffer == '#') - continue; - if (sscanf(buffer, "%s %s", to, from) == 2) { - int code = lookup(from); - if (code == UNKNOWN) - continue; - if ((int)strlen(from) > maxlen) - maxlen = strlen(from); - fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", - code, - maxlen, maxlen, - to, - from); - } + while (fgets(buffer, sizeof(buffer), ifp) != 0) { + if (*buffer == '#') + continue; + if (sscanf(buffer, "%s %s", to, from) == 2) { + int code = lookup(from); + if (code == UNKNOWN) + continue; + if ((int) strlen(from) > maxlen) + maxlen = strlen(from); + fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", + code, + maxlen, maxlen, + to, + from); } + } } -static void write_list(FILE *ofp, const char **list) +static void +write_list(FILE * ofp, const char **list) { - while (*list != 0) - fprintf(ofp, "%s\n", *list++); + while (*list != 0) + fprintf(ofp, "%s\n", *list++); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - static const char *prefix[] = { - "#ifndef NCU_KEYS_H", - "#define NCU_KEYS_H 1", - "", - "/* This file was generated by MAKE_KEYS */", - "", - "#if BROKEN_LINKER", - "static", - "#endif", - "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", - 0 - }; - static const char *suffix[] = { - "\t{ 0, 0} };", - "", - "#endif /* NCU_KEYS_H */", - 0 - }; + static const char *prefix[] = + { + "#ifndef NCU_KEYS_H", + "#define NCU_KEYS_H 1", + "", + "/* This file was generated by MAKE_KEYS */", + "", + "#if BROKEN_LINKER", + "static", + "#endif", + "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", + 0 + }; + static const char *suffix[] = + { + "\t{ 0, 0} };", + "", + "#endif /* NCU_KEYS_H */", + 0 + }; - write_list(stdout, prefix); - if (argc > 1) { - int n; - for (n = 1; n < argc; n++) { - FILE *fp = fopen(argv[n], "r"); - if (fp != 0) { - make_keys(fp, stdout); - fclose(fp); - } - } - } else { - make_keys(stdin, stdout); + write_list(stdout, prefix); + if (argc > 1) { + int n; + for (n = 1; n < argc; n++) { + FILE *fp = fopen(argv[n], "r"); + if (fp != 0) { + make_keys(fp, stdout); + fclose(fp); + } } - write_list(stdout, suffix); - return EXIT_SUCCESS; + } else { + make_keys(stdin, stdout); + } + write_list(stdout, suffix); + return EXIT_SUCCESS; } diff --git a/lib/libcurses/tinfo/name_match.c b/lib/libcurses/tinfo/name_match.c index 77099d601be..6db7ac7057f 100644 --- a/lib/libcurses/tinfo/name_match.c +++ b/lib/libcurses/tinfo/name_match.c @@ -1,7 +1,7 @@ -/* $OpenBSD: name_match.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */ +/* $OpenBSD: name_match.c,v 1.3 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -36,7 +36,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $") +MODULE_ID("$From: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $") /* * _nc_first_name(char *names) @@ -44,19 +44,20 @@ MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $") * Extract the primary name from a compiled entry. */ -char *_nc_first_name(const char *const sp) +NCURSES_EXPORT(char *) +_nc_first_name(const char *const sp) /* get the first name from the given name list */ { - static char buf[MAX_NAME_SIZE+1]; - register unsigned n; + static char buf[MAX_NAME_SIZE + 1]; + register unsigned n; - for (n = 0; n < sizeof(buf)-1; n++) { - if ((buf[n] = sp[n]) == '\0' - || (buf[n] == '|')) - break; - } - buf[n] = '\0'; - return(buf); + for (n = 0; n < sizeof(buf) - 1; n++) { + if ((buf[n] = sp[n]) == '\0' + || (buf[n] == '|')) + break; + } + buf[n] = '\0'; + return (buf); } /* @@ -65,34 +66,36 @@ char *_nc_first_name(const char *const sp) * Is the given name matched in namelist? */ -int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) +NCURSES_EXPORT(int) +_nc_name_match +(const char *const namelst, const char *const name, const char *const delim) { - const char *s, *d, *t; - int code, found; + const char *s, *d, *t; + int code, found; - if ((s = namelst) != 0) { - while (*s != '\0') { - for (d = name; *d != '\0'; d++) { - if (*s != *d) - break; - s++; - } - found = FALSE; - for (code = TRUE; *s != '\0'; code = FALSE, s++) { - for (t = delim; *t != '\0'; t++) { - if (*s == *t) { - found = TRUE; - break; - } - } - if (found) - break; - } - if (code && *d == '\0') - return code; - if (*s++ == 0) - break; + if ((s = namelst) != 0) { + while (*s != '\0') { + for (d = name; *d != '\0'; d++) { + if (*s != *d) + break; + s++; + } + found = FALSE; + for (code = TRUE; *s != '\0'; code = FALSE, s++) { + for (t = delim; *t != '\0'; t++) { + if (*s == *t) { + found = TRUE; + break; + } } + if (found) + break; + } + if (code && *d == '\0') + return code; + if (*s++ == 0) + break; } - return FALSE; + } + return FALSE; } diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c index 3a88ec027e2..2327915b9db 100644 --- a/lib/libcurses/tinfo/parse_entry.c +++ b/lib/libcurses/tinfo/parse_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse_entry.c,v 1.8 2000/10/08 22:47:02 millert Exp $ */ +/* $OpenBSD: parse_entry.c,v 1.9 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$From: parse_entry.c,v 1.48 2000/10/03 09:38:48 tom Exp $") +MODULE_ID("$From: parse_entry.c,v 1.52 2001/01/13 22:44:29 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -197,8 +197,9 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) * push back token */ -int -_nc_parse_entry(struct entry *entryp, int literal, bool silent) +NCURSES_EXPORT(int) +_nc_parse_entry +(struct entry *entryp, int literal, bool silent) { int token_type; struct name_table_entry const *entry_ptr; @@ -466,12 +467,12 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) } else postprocess_terminfo(&entryp->tterm); } - _nc_wrap_entry(entryp); + _nc_wrap_entry(entryp, FALSE); return (OK); } -int +NCURSES_EXPORT(int) _nc_capcmp(const char *s, const char *t) /* compare two string capabilities, stripping out padding */ { @@ -483,15 +484,21 @@ _nc_capcmp(const char *s, const char *t) for (;;) { if (s[0] == '$' && s[1] == '<') { for (s += 2;; s++) - if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' || - *s == '>')) + if (!(isdigit(CharOf(*s)) + || *s == '.' + || *s == '*' + || *s == '/' + || *s == '>')) break; } if (t[0] == '$' && t[1] == '<') { for (t += 2;; t++) - if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' || - *t == '>')) + if (!(isdigit(CharOf(*t)) + || *t == '.' + || *t == '*' + || *t == '/' + || *t == '>')) break; } @@ -509,7 +516,7 @@ _nc_capcmp(const char *s, const char *t) } static void -append_acs0(string_desc *dst, int code, int src) +append_acs0(string_desc * dst, int code, int src) { if (src != 0) { char temp[3]; @@ -521,7 +528,7 @@ append_acs0(string_desc *dst, int code, int src) } static void -append_acs(string_desc *dst, int code, char *src) +append_acs(string_desc * dst, int code, char *src) { if (src != 0 && strlen(src) == 1) { append_acs0(dst, code, *src); @@ -659,12 +666,12 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, scroll_forward)) + && _nc_safe_strcat(&result, scroll_forward)) newline = _nc_save_str(buf); } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, cursor_down)) + && _nc_safe_strcat(&result, cursor_down)) newline = _nc_save_str(buf); } } @@ -815,13 +822,15 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } } - if (!hard_copy) { - if (WANTED(key_backspace)) - key_backspace = _nc_save_str(C_BS); - if (WANTED(key_left)) - key_left = _nc_save_str(C_BS); - if (WANTED(key_down)) - key_down = _nc_save_str(C_LF); + if (!has_base) { + if (!hard_copy) { + if (WANTED(key_backspace)) + key_backspace = _nc_save_str(C_BS); + if (WANTED(key_left)) + key_left = _nc_save_str(C_BS); + if (WANTED(key_down)) + key_down = _nc_save_str(C_LF); + } } /* @@ -843,17 +852,17 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs (&result, 'j', acs_lrcorner); - append_acs (&result, 'k', acs_urcorner); - append_acs (&result, 'l', acs_ulcorner); - append_acs (&result, 'm', acs_llcorner); - append_acs (&result, 'n', acs_plus); - append_acs (&result, 'q', acs_hline); - append_acs (&result, 't', acs_ltee); - append_acs (&result, 'u', acs_rtee); - append_acs (&result, 'v', acs_btee); - append_acs (&result, 'w', acs_ttee); - append_acs (&result, 'x', acs_vline); + append_acs(&result, 'j', acs_lrcorner); + append_acs(&result, 'k', acs_urcorner); + append_acs(&result, 'l', acs_ulcorner); + append_acs(&result, 'm', acs_llcorner); + append_acs(&result, 'n', acs_plus); + append_acs(&result, 'q', acs_hline); + append_acs(&result, 't', acs_ltee); + append_acs(&result, 'u', acs_rtee); + append_acs(&result, 'v', acs_btee); + append_acs(&result, 'w', acs_ttee); + append_acs(&result, 'x', acs_vline); if (buf2[0]) { acs_chars = _nc_save_str(buf2); @@ -885,17 +894,17 @@ postprocess_terminfo(TERMTYPE * tp) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs0 (&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ - append_acs0 (&result, 'q', box_chars_1[1]); /* ACS_HLINE */ - append_acs0 (&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ - append_acs0 (&result, 'x', box_chars_1[3]); /* ACS_VLINE */ - append_acs0 (&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ - append_acs0 (&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ - append_acs0 (&result, 'w', box_chars_1[6]); /* ACS_TTEE */ - append_acs0 (&result, 'u', box_chars_1[7]); /* ACS_RTEE */ - append_acs0 (&result, 'v', box_chars_1[8]); /* ACS_BTEE */ - append_acs0 (&result, 't', box_chars_1[9]); /* ACS_LTEE */ - append_acs0 (&result, 'n', box_chars_1[10]); /* ACS_PLUS */ + append_acs0(&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ + append_acs0(&result, 'q', box_chars_1[1]); /* ACS_HLINE */ + append_acs0(&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ + append_acs0(&result, 'x', box_chars_1[3]); /* ACS_VLINE */ + append_acs0(&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ + append_acs0(&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ + append_acs0(&result, 'w', box_chars_1[6]); /* ACS_TTEE */ + append_acs0(&result, 'u', box_chars_1[7]); /* ACS_RTEE */ + append_acs0(&result, 'v', box_chars_1[8]); /* ACS_BTEE */ + append_acs0(&result, 't', box_chars_1[9]); /* ACS_LTEE */ + append_acs0(&result, 'n', box_chars_1[10]); /* ACS_PLUS */ if (buf2[0]) { acs_chars = _nc_save_str(buf2); diff --git a/lib/libcurses/tinfo/read_entry.c b/lib/libcurses/tinfo/read_entry.c index 7ebc4785572..2d6f4ba4ba6 100644 --- a/lib/libcurses/tinfo/read_entry.c +++ b/lib/libcurses/tinfo/read_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_entry.c,v 1.11 2000/10/22 18:27:23 millert Exp $ */ +/* $OpenBSD: read_entry.c,v 1.12 2001/01/22 18:01:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: read_entry.c,v 1.69 2000/10/10 00:57:40 Todd.Miller Exp $") +MODULE_ID("$From: read_entry.c,v 1.72 2000/12/10 02:55:08 tom Exp $") #if !HAVE_TELL #define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */ @@ -72,7 +72,7 @@ static bool keep_tic_directory = FALSE; * Record the "official" location of the terminfo directory, according to * the place where we're writing to, or the normal default, if not. */ -const char * +NCURSES_EXPORT(const char *) _nc_tic_dir(const char *path) { static const char *result = TERMINFO; @@ -95,7 +95,7 @@ _nc_tic_dir(const char *path) * has chdir'd to it. If we let it be changed, then if $TERMINFO has a * relative path, we'll lose track of the actual directory. */ -void +NCURSES_EXPORT(void) _nc_keep_tic_dir(const char *path) { _nc_tic_dir(path); @@ -375,8 +375,9 @@ read_termtype(int fd, TERMTYPE * ptr) return (1); } -int -_nc_read_file_entry(const char *const filename, TERMTYPE * ptr) +NCURSES_EXPORT(int) +_nc_read_file_entry +(const char *const filename, TERMTYPE * ptr) /* return 1 if read, 0 if not found or garbled */ { int code, fd = -1; @@ -435,7 +436,7 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const for (;;) { int c = *a; - if (c == 0 || c == ':') { + if (c == 0 || c == NCURSES_PATHSEP) { *a = 0; if ((b + 1) >= a) b = TERMINFO; @@ -463,8 +464,9 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const * overrun the file buffer. */ -int -_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_entry +(const char *const tn, char *const filename, TERMTYPE * const tp) { char *envp; char ttn[MAX_ALIAS + 3]; diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c index fe7aa25c5ad..5240db23745 100644 --- a/lib/libcurses/tinfo/read_termcap.c +++ b/lib/libcurses/tinfo/read_termcap.c @@ -55,7 +55,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: read_termcap.c,v 1.51 2000/10/21 00:34:11 Philip.Guenther Exp $") +MODULE_ID("$From: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $") #if !PURE_TERMINFO @@ -784,7 +784,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) pvec = pathvec; tbuf = bp; p = pathbuf; - cp = use_terminfo_vars() ? getenv("TERMCAP") : NULL; + cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; /* * TERMCAP can have one of two things in it. It can be the name of a file @@ -821,10 +821,10 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) *fname++ = pathbuf; /* tokenize path into vector of names */ while (*++p) { - if (*p == ' ' || *p == ':') { + if (*p == ' ' || *p == NCURSES_PATHSEP) { *p = '\0'; while (*++p) - if (*p != ' ' && *p != ':') + if (*p != ' ' && *p != NCURSES_PATHSEP) break; if (*p == '\0') break; @@ -917,8 +917,9 @@ add_tc(char *termpaths[], char *path, int count) #define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) #endif /* !USE_GETCAP */ -int -_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_termcap_entry +(const char *const tn, TERMTYPE * const tp) { int found = FALSE; ENTRY *ep; @@ -989,7 +990,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) char *cp; for (cp = tc; *cp; cp++) { - if (*cp == ':') + if (*cp == NCURSES_PATHSEP) *cp = '\0'; else if (cp == tc || cp[-1] == '\0') { ADD_TC(cp, filecount); @@ -1102,8 +1103,10 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) return (found); } #else -extern void _nc_read_termcap(void); -void +extern +NCURSES_EXPORT(void) +_nc_read_termcap(void); +NCURSES_EXPORT(void) _nc_read_termcap(void) { } diff --git a/lib/libcurses/tinfo/setbuf.c b/lib/libcurses/tinfo/setbuf.c index d798cce9611..cfe3771b036 100644 --- a/lib/libcurses/tinfo/setbuf.c +++ b/lib/libcurses/tinfo/setbuf.c @@ -1,7 +1,7 @@ -/* $OpenBSD: setbuf.c,v 1.3 1999/03/02 06:23:29 millert Exp $ */ +/* $OpenBSD: setbuf.c,v 1.4 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** setbuf.c ** @@ -44,7 +42,7 @@ #include <curses.priv.h> -MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") +MODULE_ID("$From: setbuf.c,v 1.7 2000/12/10 02:55:08 tom Exp $") /* * If the output file descriptor is connected to a tty (the typical case) it @@ -101,45 +99,47 @@ MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") * do indeed get confused by changing setbuf on/off, and will overrun the * buffer. So we disable this by default (there may yet be a workaround). */ -void _nc_set_buffer(FILE *ofp, bool buffered) +NCURSES_EXPORT(void) +_nc_set_buffer(FILE * ofp, bool buffered) { - /* optional optimization hack -- do before any output to ofp */ + /* optional optimization hack -- do before any output to ofp */ #if HAVE_SETVBUF || HAVE_SETBUFFER - unsigned buf_len; - char *buf_ptr; + unsigned buf_len; + char *buf_ptr; - if (getenv("NCURSES_NO_SETBUF") != 0) - return; + if (getenv("NCURSES_NO_SETBUF") != 0) + return; - fflush(ofp); - if ((SP->_buffered = buffered) != 0) { - buf_len = min(LINES * (COLS + 6), 2800); - if ((buf_ptr = SP->_setbuf) == 0) { - if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) - return; - SP->_setbuf = buf_ptr; - /* Don't try to free this! */ - } + fflush(ofp); + if ((SP->_buffered = buffered) != 0) { + buf_len = min(LINES * (COLS + 6), 2800); + if ((buf_ptr = SP->_setbuf) == 0) { + if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) + return; + SP->_setbuf = buf_ptr; + /* Don't try to free this! */ + } #if !USE_SETBUF_0 - else return; + else + return; #endif - } else { + } else { #if !USE_SETBUF_0 - return; + return; #else - buf_len = 0; - buf_ptr = 0; + buf_len = 0; + buf_ptr = 0; #endif - } + } #if HAVE_SETVBUF -#ifdef SETVBUF_REVERSED /* pre-svr3? */ - (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); +#ifdef SETVBUF_REVERSED /* pre-svr3? */ + (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); #else - (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); + (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); #endif #elif HAVE_SETBUFFER - (void) setbuffer(ofp, buf_ptr, (int)buf_len); + (void) setbuffer(ofp, buf_ptr, (int) buf_len); #endif #endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ diff --git a/lib/libcurses/tinfo/strings.c b/lib/libcurses/tinfo/strings.c index 28b55f0b9dc..4e3fcf1ea53 100644 --- a/lib/libcurses/tinfo/strings.c +++ b/lib/libcurses/tinfo/strings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strings.c,v 1.1 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: strings.c,v 1.2 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** * Copyright (c) 2000 Free Software Foundation, Inc. * @@ -38,15 +38,16 @@ #include <curses.priv.h> -MODULE_ID("$Id") +MODULE_ID("$From: strings.c,v 1.3 2000/12/10 02:55:08 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) ****************************************************************************/ #if !HAVE_STRSTR -char * -_nc_strstr(const char *haystack, const char *needle) +NCURSES_EXPORT(char *) +_nc_strstr +(const char *haystack, const char *needle) { size_t len1 = strlen(haystack); size_t len2 = strlen(needle); @@ -66,8 +67,9 @@ _nc_strstr(const char *haystack, const char *needle) /* * Initialize the descriptor so we can append to it. */ -string_desc * -_nc_str_init(string_desc * dst, char *src, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_init +(string_desc * dst, char *src, size_t len) { if (dst != 0) { dst->s_head = src; @@ -82,8 +84,9 @@ _nc_str_init(string_desc * dst, char *src, size_t len) /* * Initialize the descriptor for only tracking the amount of memory used. */ -string_desc * -_nc_str_null(string_desc * dst, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_null +(string_desc * dst, size_t len) { return _nc_str_init(dst, 0, len); } @@ -91,8 +94,9 @@ _nc_str_null(string_desc * dst, size_t len) /* * Copy a descriptor */ -string_desc * -_nc_str_copy(string_desc * dst, string_desc * src) +NCURSES_EXPORT(string_desc *) +_nc_str_copy +(string_desc * dst, string_desc * src) { *dst = *src; return dst; @@ -101,7 +105,7 @@ _nc_str_copy(string_desc * dst, string_desc * src) /* * Replaces strcat into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcat(string_desc * dst, const char *src) { if (src != 0) { @@ -122,7 +126,7 @@ _nc_safe_strcat(string_desc * dst, const char *src) /* * Replaces strcpy into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcpy(string_desc * dst, const char *src) { if (src != 0) { diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c index b282d069c81..c7a5958a4bf 100644 --- a/lib/libcurses/tinfo/write_entry.c +++ b/lib/libcurses/tinfo/write_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write_entry.c,v 1.9 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: write_entry.c,v 1.10 2001/01/22 18:01:57 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,7 +54,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$From: write_entry.c,v 1.53 2000/10/04 02:32:14 tom Exp $") +MODULE_ID("$From: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $") static int total_written; @@ -111,7 +111,7 @@ make_directory(const char *path) return rc; } -void +NCURSES_EXPORT(void) _nc_set_writedir(char *dir) /* set the write directory for compiled entries */ { @@ -119,7 +119,7 @@ _nc_set_writedir(char *dir) char actual[PATH_MAX]; if (dir == 0 - && use_terminfo_vars()) + && use_terminfo_vars()) dir = getenv("TERMINFO"); if (dir != 0) @@ -133,7 +133,7 @@ _nc_set_writedir(char *dir) destination = home; if (make_directory(destination) < 0) _nc_err_abort("%s: permission denied (errno %d)", - destination, errno); + destination, errno); } } @@ -166,7 +166,7 @@ check_writeable(int code) static bool verified[sizeof(dirnames)]; char dir[2]; - char *s; + char *s = 0; if (code == 0 || (s = strchr(dirnames, code)) == 0) _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); @@ -277,7 +277,7 @@ _nc_write_entry(TERMTYPE * const tp) if (stat(filename, &statbuf) < 0 || (start_time = statbuf.st_mtime) == 0) { _nc_syserr_abort("error obtaining time from %s/%s", - _nc_tic_dir(0), filename); + _nc_tic_dir(0), filename); } } while (*other_names != '\0') { @@ -303,7 +303,7 @@ _nc_write_entry(TERMTYPE * const tp) if (strcmp(filename, linkname) == 0) { _nc_warning("self-synonym ignored"); } else if (stat(linkname, &statbuf) >= 0 && - statbuf.st_mtime < start_time) { + statbuf.st_mtime < start_time) { _nc_warning("alias %s multiply defined.", ptr); } else if (_nc_access(linkname, W_OK) == 0) #if HAVE_LINK @@ -335,10 +335,16 @@ _nc_write_entry(TERMTYPE * const tp) */ if (code == 0 && errno == EEXIST) _nc_warning("can't link %s to %s", filename, linkname); - else if (code == 0 && errno == EPERM) + else if (code == 0 && (errno == EPERM || errno == ENOENT)) write_file(linkname, tp); - else + else { +#if MIXEDCASE_FILENAMES _nc_syserr_abort("can't link %s to %s", filename, linkname); +#else + _nc_warning("can't link %s to %s (errno=%d)", filename, + linkname, errno); +#endif + } } else { DEBUG(1, ("Linked %s", linkname)); } @@ -522,7 +528,7 @@ write_object(FILE * fp, TERMTYPE * tp) TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp))); if (tp->ext_Booleans && fwrite(tp->Booleans + BOOLCOUNT, sizeof(char), - tp->ext_Booleans, fp) != tp->ext_Booleans) + tp->ext_Booleans, fp) != tp->ext_Booleans) return (ERR); if (even_boundary(tp->ext_Booleans)) @@ -551,7 +557,7 @@ write_object(FILE * fp, TERMTYPE * tp) for (i = 0; i < tp->ext_Strings; i++) { if (VALID_STRING(tp->Strings[i + STRCOUNT])) { TRACE_OUT(("WRITE ext_Strings[%d]=%s", i, - _nc_visbuf(tp->Strings[i + STRCOUNT]))); + _nc_visbuf(tp->Strings[i + STRCOUNT]))); if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) return (ERR); } @@ -576,7 +582,7 @@ write_object(FILE * fp, TERMTYPE * tp) /* * Returns the total number of entries written by this process */ -int +NCURSES_EXPORT(int) _nc_tic_written(void) { return total_written; diff --git a/lib/libcurses/trace/lib_trace.c b/lib/libcurses/trace/lib_trace.c index 0eab5abfb93..698c4b9e202 100644 --- a/lib/libcurses/trace/lib_trace.c +++ b/lib/libcurses/trace/lib_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_trace.c,v 1.5 2000/04/04 16:49:59 millert Exp $ */ +/* $OpenBSD: lib_trace.c,v 1.6 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,17 +42,20 @@ #include <ctype.h> -MODULE_ID("$From: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $") +MODULE_ID("$From: lib_trace.c,v 1.38 2000/12/10 03:02:45 tom Exp $") -unsigned _nc_tracing = 0; /* always define this */ +NCURSES_EXPORT_VAR(unsigned) +_nc_tracing = 0; /* always define this */ #ifdef TRACE -const char *_nc_tputs_trace = ""; -long _nc_outchars = 0; +NCURSES_EXPORT_VAR(const char *) +_nc_tputs_trace = ""; +NCURSES_EXPORT_VAR(long) +_nc_outchars = 0; -static FILE *tracefp; /* default to writing to stderr */ + static FILE *tracefp; /* default to writing to stderr */ -void +NCURSES_EXPORT(void) trace(const unsigned int tracelevel GCC_UNUSED) { static bool been_here = FALSE; @@ -63,7 +66,7 @@ trace(const unsigned int tracelevel GCC_UNUSED) been_here = TRUE; if (_nc_access(my_name, W_OK) < 0 - || (tracefp = fopen(my_name, "w")) == 0) { + || (tracefp = fopen(my_name, "wb")) == 0) { perror("curses: Can't open 'trace' file: "); exit(EXIT_FAILURE); } @@ -76,13 +79,12 @@ trace(const unsigned int tracelevel GCC_UNUSED) #elif HAVE_SETBUF /* POSIX */ (void) setbuffer(tracefp, (char *) 0); #endif - _tracef("TRACING NCURSES version %s (%d)", - NCURSES_VERSION, NCURSES_VERSION_PATCH); + _tracef("TRACING NCURSES version %s", curses_version()); } } #endif -const char * +NCURSES_EXPORT(const char *) _nc_visbuf2(int bufnum, const char *buf) /* visibilize a given string */ { @@ -99,9 +101,9 @@ _nc_visbuf2(int bufnum, const char *buf) tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); #else { - static char *mybuf[2]; - mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); - tp = vbuf = mybuf[bufnum]; + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; } #endif *tp++ = '"'; @@ -128,7 +130,7 @@ _nc_visbuf2(int bufnum, const char *buf) *tp++ = '^'; *tp++ = '@' + c; } else { - sprintf(tp, "\\%03o", c & 0xff); + sprintf(tp, "\\%03o", CharOf(c)); tp += strlen(tp); } } @@ -137,14 +139,14 @@ _nc_visbuf2(int bufnum, const char *buf) return (vbuf); } -const char * +NCURSES_EXPORT(const char *) _nc_visbuf(const char *buf) { return _nc_visbuf2(0, buf); } #ifdef TRACE -void +NCURSES_EXPORT(void) _tracef(const char *fmt,...) { static const char Called[] = T_CALLED(""); @@ -193,7 +195,7 @@ _tracef(const char *fmt,...) } /* Trace 'int' return-values */ -int +NCURSES_EXPORT(int) _nc_retrace_int(int code) { T((T_RETURN("%d"), code)); @@ -201,7 +203,7 @@ _nc_retrace_int(int code) } /* Trace 'char*' return-values */ -char * +NCURSES_EXPORT(char *) _nc_retrace_ptr(char *code) { T((T_RETURN("%s"), _nc_visbuf(code))); @@ -209,7 +211,7 @@ _nc_retrace_ptr(char *code) } /* Trace 'WINDOW *' return-values */ -WINDOW * +NCURSES_EXPORT(WINDOW *) _nc_retrace_win(WINDOW *code) { T((T_RETURN("%p"), code)); diff --git a/lib/libcurses/trace/lib_traceatr.c b/lib/libcurses/trace/lib_traceatr.c index 30b601275d0..d90d239de86 100644 --- a/lib/libcurses/trace/lib_traceatr.c +++ b/lib/libcurses/trace/lib_traceatr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_traceatr.c,v 1.2 2000/10/08 22:47:03 millert Exp $ */ +/* $OpenBSD: lib_traceatr.c,v 1.3 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -40,12 +40,12 @@ #include <curses.priv.h> #include <term.h> /* acs_chars */ -MODULE_ID("$From: lib_traceatr.c,v 1.30 2000/07/29 18:06:09 tom Exp $") +MODULE_ID("$From: lib_traceatr.c,v 1.32 2000/12/10 03:02:45 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) #ifdef TRACE -char * +NCURSES_EXPORT(char *) _traceattr2(int bufnum, attr_t newmode) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -124,21 +124,21 @@ _traceattr2(int bufnum, attr_t newmode) return (strcat(buf, "}")); } -char * +NCURSES_EXPORT(char *) _traceattr(attr_t newmode) { return _traceattr2(0, newmode); } /* Trace 'int' return-values */ -attr_t +NCURSES_EXPORT(attr_t) _nc_retrace_attr_t(attr_t code) { T((T_RETURN("%s"), _traceattr(code))); return code; } -char * +NCURSES_EXPORT(char *) _tracechtype2(int bufnum, chtype ch) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -219,24 +219,23 @@ _tracechtype2(int bufnum, chtype ch) return (buf); } -char * -_tracechtype(chtype ch) +NCURSES_EXPORT(char *) +_tracechtype (chtype ch) { return _tracechtype2(0, ch); } /* Trace 'chtype' return-values */ -attr_t -_nc_retrace_chtype(attr_t code) +NCURSES_EXPORT(attr_t) +_nc_retrace_chtype (attr_t code) { T((T_RETURN("%s"), _tracechtype(code))); return code; } #else -extern void _nc_lib_traceatr(void); -void -_nc_lib_traceatr(void) +extern NCURSES_EXPORT(void) _nc_lib_traceatr (void); +NCURSES_EXPORT(void) _nc_lib_traceatr (void) { } #endif /* TRACE */ diff --git a/lib/libcurses/trace/lib_tracebits.c b/lib/libcurses/trace/lib_tracebits.c index 494998dd73d..3d7fb492884 100644 --- a/lib/libcurses/trace/lib_tracebits.c +++ b/lib/libcurses/trace/lib_tracebits.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tracebits.c,v 1.7 2000/10/08 22:47:04 millert Exp $ */ +/* $OpenBSD: lib_tracebits.c,v 1.8 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -36,7 +36,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$From: lib_tracebits.c,v 1.7 2000/09/02 18:08:37 tom Exp $") +MODULE_ID("$From: lib_tracebits.c,v 1.9 2000/12/10 03:02:45 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -83,7 +83,7 @@ lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int v (void) strcat(buf, "} "); } -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) /* describe the state of the terminal control bits exactly */ { @@ -139,11 +139,11 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(iflags) + - 8 + sizeof(oflags) + - 8 + sizeof(cflags) + - 8 + sizeof(lflags) + - 8); + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + + 8); if (cur_term->Nttyb.c_iflag & ALLIN) lookup_bits(buf, iflags, "iflags", cur_term->Nttyb.c_iflag); @@ -231,7 +231,7 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(cflags)); + 8 + sizeof(cflags)); if (cur_term->Nttyb.sg_flags & ALLCTRL) { lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags); @@ -240,7 +240,7 @@ _nc_tracebits(void) return (buf); } #else -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) { static char tmp[] = ""; diff --git a/lib/libcurses/trace/lib_tracechr.c b/lib/libcurses/trace/lib_tracechr.c index 932ee8d811d..340ca67913b 100644 --- a/lib/libcurses/trace/lib_tracechr.c +++ b/lib/libcurses/trace/lib_tracechr.c @@ -36,16 +36,22 @@ */ #include <curses.priv.h> -MODULE_ID("$From: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $") +MODULE_ID("$From: lib_tracechr.c,v 1.4 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracechar(const unsigned char ch) +NCURSES_EXPORT(char *) +_tracechar(const unsigned char ch) { static char crep[20]; - (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch); - return(crep); + (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned) ch); + return (crep); } #else -extern void _nc_lib_tracechr(void); - void _nc_lib_tracechr(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracechr(void); +NCURSES_EXPORT(void) +_nc_lib_tracechr(void) +{ +} #endif diff --git a/lib/libcurses/trace/lib_tracedmp.c b/lib/libcurses/trace/lib_tracedmp.c index 50859050044..4a709fea869 100644 --- a/lib/libcurses/trace/lib_tracedmp.c +++ b/lib/libcurses/trace/lib_tracedmp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_tracedmp.c,v 1.1 1999/01/18 19:10:24 millert Exp $ */ +/* $OpenBSD: lib_tracedmp.c,v 1.2 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,92 +39,93 @@ #include <curses.priv.h> -MODULE_ID("$From: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $") +MODULE_ID("$From: lib_tracedmp.c,v 1.16 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -void _tracedump(const char *name, WINDOW *win) +NCURSES_EXPORT(void) +_tracedump(const char *name, WINDOW *win) { - int i, j, n, width; + int i, j, n, width; /* compute narrowest possible display width */ - for (width = i = 0; i <= win->_maxy; i++) - { + for (width = i = 0; i <= win->_maxy; i++) { n = 0; for (j = 0; j <= win->_maxx; j++) - if (win->_line[i].text[j] != ' ') - n = j; + if (win->_line[i].text[j] != ' ') + n = j; if (n > width) - width = n; + width = n; } if (width < win->_maxx) - ++width; + ++width; - for (n = 0; n <= win->_maxy; n++) - { - char buf[BUFSIZ], *ep; + for (n = 0; n <= win->_maxy; n++) { + char buf[BUFSIZ], *ep; bool haveattrs, havecolors; /* dump A_CHARTEXT part */ (void) sprintf(buf, "%s[%2d] %3d%3d ='", - name, n, - win->_line[n].firstchar, - win->_line[n].lastchar); + name, n, + win->_line[n].firstchar, + win->_line[n].lastchar); ep = buf + strlen(buf); for (j = 0; j <= width; j++) { ep[j] = TextOf(win->_line[n].text[j]); if (ep[j] == 0) - ep[j] = '.'; + ep[j] = '.'; } ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & A_COLOR) - { + if (win->_line[n].text[j] & A_COLOR) { havecolors = TRUE; break; } - if (havecolors) - { - (void) sprintf(buf, "%*s[%2d]%*s='", (int)strlen(name), "colors", n, 8, " "); + if (havecolors) { + (void) sprintf(buf, "%*s[%2d]%*s='", (int) strlen(name), + "colors", n, 8, " "); ep = buf + strlen(buf); for (j = 0; j <= width; j++) - ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' '; + ep[j] = CharOf(win->_line[n].text[j] >> 8) + ' '; ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); } - for (i = 0; i < 4; i++) - { - const char *hex = " 123456789ABCDEF"; - chtype mask = (0xf << ((i + 4) * 4)); + for (i = 0; i < 4; i++) { + const char *hex = " 123456789ABCDEF"; + chtype mask = (0xf << ((i + 4) * 4)); haveattrs = FALSE; for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & mask) - { + if (win->_line[n].text[j] & mask) { haveattrs = TRUE; break; } - if (haveattrs) - { - (void) sprintf(buf, "%*s%d[%2d]%*s='", (int)strlen(name)-1, "attrs", i, n, 8, " "); + if (haveattrs) { + (void) sprintf(buf, "%*s%d[%2d]%*s='", (int) strlen(name) - + 1, "attrs", i, n, 8, " "); ep = buf + strlen(buf); for (j = 0; j <= width; j++) ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)]; ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); } } } } #else -extern void _nc_lib_tracedmp(void); - void _nc_lib_tracedmp(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void); +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void) +{ +} #endif /* TRACE */ diff --git a/lib/libcurses/trace/lib_tracemse.c b/lib/libcurses/trace/lib_tracemse.c index a1b649f5c88..c92e4821eb0 100644 --- a/lib/libcurses/trace/lib_tracemse.c +++ b/lib/libcurses/trace/lib_tracemse.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_tracemse.c,v 1.1 1999/01/18 19:10:24 millert Exp $ */ +/* $OpenBSD: lib_tracemse.c,v 1.2 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,65 +33,68 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_tracemse.c - Tracing/Debugging routines (mouse events) */ #include <curses.priv.h> -MODULE_ID("$From: lib_tracemse.c,v 1.6 1998/11/16 14:28:17 Alexander.V.Lukyanov Exp $") +MODULE_ID("$From: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracemouse(MEVENT const *ep) +NCURSES_EXPORT(char *) +_tracemouse(MEVENT const *ep) { - static char buf[80]; + static char buf[80]; - (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", + ep->id, ep->x, ep->y, ep->z, ep->bstate); #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} - SHOW(BUTTON1_RELEASED, "release-1") - SHOW(BUTTON1_PRESSED, "press-1") - SHOW(BUTTON1_CLICKED, "click-1") - SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") - SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") - SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") - SHOW(BUTTON2_RELEASED, "release-2") - SHOW(BUTTON2_PRESSED, "press-2") - SHOW(BUTTON2_CLICKED, "click-2") - SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") - SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") - SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") - SHOW(BUTTON3_RELEASED, "release-3") - SHOW(BUTTON3_PRESSED, "press-3") - SHOW(BUTTON3_CLICKED, "click-3") - SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") - SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") - SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") - SHOW(BUTTON4_RELEASED, "release-4") - SHOW(BUTTON4_PRESSED, "press-4") - SHOW(BUTTON4_CLICKED, "click-4") - SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") - SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") - SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") - SHOW(BUTTON_CTRL, "ctrl") - SHOW(BUTTON_SHIFT, "shift") - SHOW(BUTTON_ALT, "alt") - SHOW(ALL_MOUSE_EVENTS, "all-events") - SHOW(REPORT_MOUSE_POSITION, "position") + SHOW(BUTTON1_RELEASED, "release-1") + SHOW(BUTTON1_PRESSED, "press-1") + SHOW(BUTTON1_CLICKED, "click-1") + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") + SHOW(BUTTON2_RELEASED, "release-2") + SHOW(BUTTON2_PRESSED, "press-2") + SHOW(BUTTON2_CLICKED, "click-2") + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") + SHOW(BUTTON3_RELEASED, "release-3") + SHOW(BUTTON3_PRESSED, "press-3") + SHOW(BUTTON3_CLICKED, "click-3") + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") + SHOW(BUTTON4_RELEASED, "release-4") + SHOW(BUTTON4_PRESSED, "press-4") + SHOW(BUTTON4_CLICKED, "click-4") + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") + SHOW(BUTTON_CTRL, "ctrl") + SHOW(BUTTON_SHIFT, "shift") + SHOW(BUTTON_ALT, "alt") + SHOW(ALL_MOUSE_EVENTS, "all-events") + SHOW(REPORT_MOUSE_POSITION, "position") #undef SHOW - if (buf[strlen(buf)-1] == ' ') - buf[strlen(buf)-2] = '\0'; - (void) strcat(buf, "}"); - return(buf); + if (buf[strlen(buf) - 1] == ' ') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf, "}"); + return (buf); } #else /* !TRACE */ /* don't make empty module */ -void _nc_lib_tracemouse(void); -void _nc_lib_tracemouse(void) {} +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void); +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void) +{ +} #endif diff --git a/lib/libcurses/trace/trace_buf.c b/lib/libcurses/trace/trace_buf.c index 4e0ed6ce21e..060ef5e686d 100644 --- a/lib/libcurses/trace/trace_buf.c +++ b/lib/libcurses/trace/trace_buf.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_buf.c,v 1.2 1999/03/02 06:23:29 millert Exp $ */ +/* $OpenBSD: trace_buf.c,v 1.3 2001/01/22 18:01:58 millert Exp $ */ /**************************************************************************** - * 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 * @@ -37,46 +37,47 @@ #include <curses.priv.h> -MODULE_ID("$From: trace_buf.c,v 1.7 1999/02/27 19:50:58 tom Exp $") +MODULE_ID("$From: trace_buf.c,v 1.9 2000/12/10 03:02:45 tom Exp $") typedef struct { - char *text; - size_t size; + char *text; + size_t size; } LIST; -char * _nc_trace_buf(int bufnum, size_t want) +NCURSES_EXPORT(char *) +_nc_trace_buf(int bufnum, size_t want) { - static LIST *list; - static size_t have; + static LIST *list; + static size_t have; #if NO_LEAKS - if (bufnum < 0) { - if (have) { - while (have--) { - free(list[have].text); - } - free(list); - } - return 0; + if (bufnum < 0) { + if (have) { + while (have--) { + free(list[have].text); + } + free(list); } + return 0; + } #endif - if ((size_t)(bufnum+1) > have) { - size_t need = (bufnum + 1) * 2; - if ((list = typeRealloc(LIST, need, list)) == 0) - return(0); - while (need > have) - list[have++].text = 0; - } + if ((size_t) (bufnum + 1) > have) { + size_t need = (bufnum + 1) * 2; + if ((list = typeRealloc(LIST, need, list)) == 0) + return (0); + while (need > have) + list[have++].text = 0; + } - if (list[bufnum].text == 0 - || want > list[bufnum].size) - { - if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) != 0) - list[bufnum].size = want; - } + if (list[bufnum].text == 0 + || want > list[bufnum].size) { + if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) + != 0) + list[bufnum].size = want; + } - if (list[bufnum].text != 0) - *(list[bufnum].text) = '\0'; - return list[bufnum].text; + if (list[bufnum].text != 0) + *(list[bufnum].text) = '\0'; + return list[bufnum].text; } diff --git a/lib/libcurses/trace/trace_tries.c b/lib/libcurses/trace/trace_tries.c index effb7378d6c..d0dd538d9be 100644 --- a/lib/libcurses/trace/trace_tries.c +++ b/lib/libcurses/trace/trace_tries.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_tries.c,v 1.3 1999/03/11 21:03:58 millert Exp $ */ +/* $OpenBSD: trace_tries.c,v 1.4 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -37,40 +37,45 @@ #include <curses.priv.h> -MODULE_ID("$From: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $") +MODULE_ID("$From: trace_tries.c,v 1.8 2000/12/10 03:03:51 tom Exp $") #ifdef TRACE static unsigned char *buffer; static unsigned len; -static void recur_tries(struct tries *tree, unsigned level) +static void +recur_tries(struct tries *tree, unsigned level) { - if (level > len) - buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4); + if (level > len) + buffer = (unsigned char *) realloc(buffer, len = (level + 1) * 4); - while (tree != 0) { - if ((buffer[level] = tree->ch) == 0) - buffer[level] = 128; - buffer[level+1] = 0; - if (tree->value != 0) { - _tracef("%5d: %s (%s)", tree->value, _nc_visbuf((char *)buffer), keyname(tree->value)); - } - if (tree->child) - recur_tries(tree->child, level+1); - tree = tree->sibling; + while (tree != 0) { + if ((buffer[level] = tree->ch) == 0) + buffer[level] = 128; + buffer[level + 1] = 0; + if (tree->value != 0) { + _tracef("%5d: %s (%s)", tree->value, + _nc_visbuf((char *) buffer), keyname(tree->value)); } + if (tree->child) + recur_tries(tree->child, level + 1); + tree = tree->sibling; + } } -void _nc_trace_tries(struct tries *tree) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree) { - buffer = typeMalloc(unsigned char, len = 80); - _tracef("BEGIN tries %p", tree); - recur_tries(tree, 0); - _tracef(". . . tries %p", tree); - free(buffer); + buffer = typeMalloc(unsigned char, len = 80); + _tracef("BEGIN tries %p", tree); + recur_tries(tree, 0); + _tracef(". . . tries %p", tree); + free(buffer); } + #else -void _nc_trace_tries(struct tries *tree GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree GCC_UNUSED) { } #endif diff --git a/lib/libcurses/trace/trace_xnames.c b/lib/libcurses/trace/trace_xnames.c index a7fa1cbfb65..22dc761419f 100644 --- a/lib/libcurses/trace/trace_xnames.c +++ b/lib/libcurses/trace/trace_xnames.c @@ -1,7 +1,7 @@ -/* $OpenBSD: trace_xnames.c,v 1.2 1999/05/08 20:29:02 millert Exp $ */ +/* $OpenBSD: trace_xnames.c,v 1.3 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -38,9 +38,10 @@ #include <curses.priv.h> #include <term_entry.h> -MODULE_ID("$From: trace_xnames.c,v 1.3 1999/03/02 01:20:38 tom Exp $") +MODULE_ID("$From: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $") -void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED) { #ifdef TRACE #if NCURSES_XNAMES @@ -58,16 +59,16 @@ void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) for (n = 0; n < limit; n++) { if ((m = n - begin_str) >= 0) { _tracef("[%d] %s = %s", n, - tp->ext_Names[n], - _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); + tp->ext_Names[n], + _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); } else if ((m = n - begin_num) >= 0) { _tracef("[%d] %s = %d (num)", n, - tp->ext_Names[n], - tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); + tp->ext_Names[n], + tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); } else { _tracef("[%d] %s = %d (bool)", n, - tp->ext_Names[n], - tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); + tp->ext_Names[n], + tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); } } } diff --git a/lib/libcurses/tty/MKexpanded.sh b/lib/libcurses/tty/MKexpanded.sh index 2c4ef80d427..c9de5292ec3 100644 --- a/lib/libcurses/tty/MKexpanded.sh +++ b/lib/libcurses/tty/MKexpanded.sh @@ -29,8 +29,8 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1997 # -# $OpenBSD: MKexpanded.sh,v 1.2 2000/10/08 22:47:04 millert Exp $ -# $From: MKexpanded.sh,v 1.9 2000/09/02 22:55:21 tom Exp $ +# $OpenBSD: MKexpanded.sh,v 1.3 2001/01/22 18:01:59 millert Exp $ +# $From: MKexpanded.sh,v 1.10 2000/12/10 00:24:33 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -69,23 +69,23 @@ cat >$TMP <<EOF #undef FALSE /* this is a marker */ IGNORE -void _nc_toggle_attr_on(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *S, attr_t at) { toggle_attr_on(*S,at); } -void _nc_toggle_attr_off(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *S, attr_t at) { toggle_attr_off(*S,at); } -int _nc_DelCharCost(int count) +NCURSES_EXPORT(int) _nc_DelCharCost (int count) { return DelCharCost(count); } -int _nc_InsCharCost(int count) +NCURSES_EXPORT(int) _nc_InsCharCost (int count) { return InsCharCost(count); } -void _nc_UpdateAttrs(chtype c) +NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype c) { UpdateAttrs(c); } @@ -95,6 +95,6 @@ $preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' cat <<EOF #else /* ! NCURSES_EXPANDED */ -void _nc_expanded(void) { } +NCURSES_EXPORT(void) _nc_expanded (void) { } #endif /* NCURSES_EXPANDED */ EOF diff --git a/lib/libcurses/tty/hardscroll.c b/lib/libcurses/tty/hardscroll.c index 2c88ed1f829..7673cffa9c3 100644 --- a/lib/libcurses/tty/hardscroll.c +++ b/lib/libcurses/tty/hardscroll.c @@ -1,7 +1,7 @@ -/* $OpenBSD: hardscroll.c,v 1.2 1999/03/02 06:23:30 millert Exp $ */ +/* $OpenBSD: hardscroll.c,v 1.3 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /****************************************************************************** NAME @@ -148,13 +147,14 @@ AUTHOR #include <curses.priv.h> -MODULE_ID("$From: hardscroll.c,v 1.33 1999/02/27 20:01:29 tom Exp $") +MODULE_ID("$From: hardscroll.c,v 1.36 2001/01/14 00:17:28 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) # undef screen_lines # define screen_lines MAXLINES -int oldnums[MAXLINES]; +NCURSES_EXPORT_VAR(int) +oldnums[MAXLINES]; # define OLDNUM(n) oldnums[n] # define _tracef printf # undef TR @@ -165,19 +165,21 @@ int oldnums[MAXLINES]; /* OLDNUM(n) indicates which line will be shifted to the position n. if OLDNUM(n) == _NEWINDEX, then the line n in new, not shifted from somewhere. */ +NCURSES_EXPORT_VAR(int *) +_nc_oldnums = 0; + # if USE_HASHMAP -int *_nc_oldnums = 0; -static int oldnums_allocated = 0; + static int oldnums_allocated = 0; # define oldnums _nc_oldnums # define OLDNUM(n) oldnums[n] -# else /* !USE_HASHMAP */ +# else /* !USE_HASHMAP */ # define OLDNUM(n) newscr->_line[n].oldindex -# endif /* !USE_HASHMAP */ +# endif /* !USE_HASHMAP */ #endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ - -void _nc_scroll_optimize(void) +NCURSES_EXPORT(void) +_nc_scroll_optimize(void) /* scroll optimization to transform curscr to newscr */ { int i; @@ -188,8 +190,7 @@ void _nc_scroll_optimize(void) #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) #if USE_HASHMAP /* get enough storage */ - if (oldnums_allocated < screen_lines) - { + if (oldnums_allocated < screen_lines) { int *new_oldnums = typeRealloc(int, screen_lines, oldnums); if (!new_oldnums) return; @@ -207,25 +208,24 @@ void _nc_scroll_optimize(void) #endif /* TRACE */ /* pass 1 - from top to bottom scrolling up */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) <= i)) i++; if (i >= screen_lines) break; - shift = OLDNUM(i) - i; /* shift > 0 */ + shift = OLDNUM(i) - i; /* shift > 0 */ start = i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; - end = i-1 + shift; + end = i - 1 + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -233,25 +233,23 @@ void _nc_scroll_optimize(void) } /* pass 2 - from bottom to top scrolling down */ - for (i = screen_lines-1; i >= 0; ) - { + for (i = screen_lines - 1; i >= 0;) { while (i >= 0 && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) >= i)) i--; if (i < 0) break; - shift = OLDNUM(i) - i; /* shift < 0 */ + shift = OLDNUM(i) - i; /* shift < 0 */ end = i; i--; while (i >= 0 && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) i--; - start = i+1 - (-shift); + start = i + 1 - (-shift); TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -260,14 +258,15 @@ void _nc_scroll_optimize(void) } #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -void _nc_linedump(void) +NCURSES_EXPORT(void) +_nc_linedump(void) /* dump the state of the real and virtual oldnum fields */ { static size_t have; static char *buf; - int n; - size_t want = (screen_lines + 1) * 4; + int n; + size_t want = (screen_lines + 1) * 4; if (have < want) buf = typeMalloc(char, have = want); @@ -286,28 +285,26 @@ void _nc_linedump(void) #ifdef SCROLLDEBUG int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; + char line[BUFSIZ], *st; #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { - int n; + for (;;) { + int n; for (n = 0; n < screen_lines; n++) oldnums[n] = _NEWINDEX; /* grab the test vector */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); /* parse it */ n = 0; - if (line[0] == '#') - { + if (line[0] == '#') { (void) fputs(line, stderr); continue; } @@ -315,7 +312,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); /* display it */ (void) fputs("Initial input:\n", stderr); diff --git a/lib/libcurses/tty/hashmap.c b/lib/libcurses/tty/hashmap.c index a2442f97c1a..c57e36527cd 100644 --- a/lib/libcurses/tty/hashmap.c +++ b/lib/libcurses/tty/hashmap.c @@ -1,7 +1,7 @@ -/* $OpenBSD: hashmap.c,v 1.5 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: hashmap.c,v 1.6 2001/01/22 18:01:59 millert Exp $ */ /**************************************************************************** - * 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 * @@ -70,9 +70,9 @@ AUTHOR *****************************************************************************/ #include <curses.priv.h> -#include <term.h> /* for back_color_erase */ +#include <term.h> /* for back_color_erase */ -MODULE_ID("$From: hashmap.c,v 1.34 1999/11/28 00:10:57 tom Exp $") +MODULE_ID("$From: hashmap.c,v 1.36 2000/12/10 03:04:30 tom Exp $") #ifdef HASHDEBUG @@ -102,41 +102,43 @@ static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH]; #define oldhash (SP->oldhash) #define newhash (SP->newhash) -static inline unsigned long hash(chtype *text) +static inline unsigned long +hash(chtype * text) { int i; chtype ch; unsigned long result = 0; - for (i = TEXTWIDTH; i>0; i--) - { + for (i = TEXTWIDTH; i > 0; i--) { ch = *text++; - result += (result<<5) + ch; + result += (result << 5) + ch; } return result; } /* approximate update cost */ -static int update_cost(chtype *from,chtype *to) +static int +update_cost(chtype * from, chtype * to) { - int cost=0; + int cost = 0; int i; - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (*from++ != *to++) cost++; return cost; } -static int update_cost_from_blank(chtype *to) +static int +update_cost_from_blank(chtype * to) { - int cost=0; + int cost = 0; int i; chtype blank = BLANK; if (back_color_erase) blank |= (stdscr->_bkgd & A_COLOR); - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (blank != *to++) cost++; @@ -147,7 +149,8 @@ static int update_cost_from_blank(chtype *to) * Returns true when moving line 'from' to line 'to' seems to be cost * effective. 'blank' indicates whether the line 'to' would become blank. */ -static inline bool cost_effective(const int from, const int to, const bool blank) +static inline bool +cost_effective(const int from, const int to, const bool blank) { int new_from; @@ -163,30 +166,28 @@ static inline bool cost_effective(const int from, const int to, const bool blank * on the right side -- cost after moving. */ return (((blank ? update_cost_from_blank(NEWTEXT(to)) - : update_cost(OLDTEXT(to),NEWTEXT(to))) - + update_cost(OLDTEXT(new_from),NEWTEXT(from))) - >= ((new_from==from ? update_cost_from_blank(NEWTEXT(from)) - : update_cost(OLDTEXT(new_from),NEWTEXT(from))) - + update_cost(OLDTEXT(from),NEWTEXT(to)))) ? TRUE : FALSE; + : update_cost(OLDTEXT(to), NEWTEXT(to))) + + update_cost(OLDTEXT(new_from), NEWTEXT(from))) + >= ((new_from == from ? update_cost_from_blank(NEWTEXT(from)) + : update_cost(OLDTEXT(new_from), NEWTEXT(from))) + + update_cost(OLDTEXT(from), NEWTEXT(to)))) ? TRUE : FALSE; } +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} sym; -typedef struct -{ - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} - sym; - -static sym *hashtab=0; -static int lines_alloc=0; +static sym *hashtab = 0; +static int lines_alloc = 0; -static void grow_hunks(void) +static void +grow_hunks(void) { int start, end, shift; - int back_limit, forward_limit; /* limits for cells to fill */ - int back_ref_limit, forward_ref_limit; /* limits for refrences */ + int back_limit, forward_limit; /* limits for cells to fill */ + int back_ref_limit, forward_ref_limit; /* limits for refrences */ int i; int next_hunk; @@ -200,14 +201,14 @@ static void grow_hunks(void) i = 0; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; - for ( ; i < screen_lines; i=next_hunk) - { + for (; i < screen_lines; i = next_hunk) { start = i; shift = OLDNUM(i) - i; /* get forward limit */ - i = start+1; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i = start + 1; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; end = i; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) @@ -219,25 +220,21 @@ static void grow_hunks(void) else forward_ref_limit = OLDNUM(i); - i = start-1; + i = start - 1; /* grow back */ if (shift < 0) back_limit = back_ref_limit + (-shift); - while (i >= back_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift<0)) - { - OLDNUM(i) = i+shift; + while (i >= back_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift < 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (backward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (backward continuation)", - i, i+shift)); + i, i + shift)); break; } i--; @@ -247,21 +244,17 @@ static void grow_hunks(void) /* grow forward */ if (shift > 0) forward_limit = forward_ref_limit - shift; - while (i < forward_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift>0)) - { - OLDNUM(i) = i+shift; + while (i < forward_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift > 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (forward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (forward continuation)", - i, i+shift)); + i, i + shift)); break; } i++; @@ -273,22 +266,19 @@ static void grow_hunks(void) } } -void _nc_hash_map(void) +NCURSES_EXPORT(void) +_nc_hash_map(void) { sym *sp; register int i; int start, shift, size; - - if (screen_lines > lines_alloc) - { + if (screen_lines > lines_alloc) { if (hashtab) - free (hashtab); - hashtab = typeMalloc(sym, (screen_lines+1)*2); - if (!hashtab) - { - if (oldhash) - { + free(hashtab); + hashtab = typeMalloc(sym, (screen_lines + 1) * 2); + if (!hashtab) { + if (oldhash) { FreeAndNull(oldhash); } lines_alloc = 0; @@ -297,47 +287,40 @@ void _nc_hash_map(void) lines_alloc = screen_lines; } - if (oldhash && newhash) - { + if (oldhash && newhash) { /* re-hash only changed lines */ - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { if (PENDING(i)) newhash[i] = hash(NEWTEXT(i)); } - } - else - { + } else { /* re-hash all */ if (oldhash == 0) - oldhash = typeCalloc (unsigned long, screen_lines); + oldhash = typeCalloc(unsigned long, screen_lines); if (newhash == 0) - newhash = typeCalloc (unsigned long, screen_lines); + newhash = typeCalloc(unsigned long, screen_lines); if (!oldhash || !newhash) - return; /* malloc failure */ - for (i = 0; i < screen_lines; i++) - { + return; /* malloc failure */ + for (i = 0; i < screen_lines; i++) { newhash[i] = hash(NEWTEXT(i)); oldhash[i] = hash(OLDTEXT(i)); } } #ifdef HASH_VERIFY - for (i = 0; i < screen_lines; i++) - { - if(newhash[i] != hash(NEWTEXT(i))) - fprintf(stderr,"error in newhash[%d]\n",i); - if(oldhash[i] != hash(OLDTEXT(i))) - fprintf(stderr,"error in oldhash[%d]\n",i); + for (i = 0; i < screen_lines; i++) { + if (newhash[i] != hash(NEWTEXT(i))) + fprintf(stderr, "error in newhash[%d]\n", i); + if (oldhash[i] != hash(OLDTEXT(i))) + fprintf(stderr, "error in oldhash[%d]\n", i); } #endif /* * Set up and count line-hash values. */ - memset(hashtab, '\0', sizeof(*hashtab)*(screen_lines+1)*2); - for (i = 0; i < screen_lines; i++) - { + memset(hashtab, '\0', sizeof(*hashtab) * (screen_lines + 1) * 2); + for (i = 0; i < screen_lines; i++) { unsigned long hashval = oldhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -347,8 +330,7 @@ void _nc_hash_map(void) sp->oldcount++; sp->oldindex = i; } - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { unsigned long hashval = newhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -370,11 +352,10 @@ void _nc_hash_map(void) */ for (sp = hashtab; sp->hashval; sp++) if (sp->oldcount == 1 && sp->newcount == 1 - && sp->oldindex != sp->newindex) - { + && sp->oldindex != sp->newindex) { TR(TRACE_UPDATE | TRACE_MOVE, ("new line %d is hash-identical to old line %d (unique)", - sp->newindex, sp->oldindex)); + sp->newindex, sp->oldindex)); OLDNUM(sp->newindex) = sp->oldindex; } @@ -386,8 +367,7 @@ void _nc_hash_map(void) * those which are to be moved too far, they are likely to destroy * more than carry. */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; if (i >= screen_lines) @@ -395,13 +375,12 @@ void _nc_hash_map(void) start = i; shift = OLDNUM(i) - i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; size = i - start; - if (size < 3 || size+min(size/8,2) < abs(shift)) - { - while (start < i) - { + if (size < 3 || size + min(size / 8, 2) < abs(shift)) { + while (start < i) { OLDNUM(start) = _NEWINDEX; start++; } @@ -417,13 +396,15 @@ void _nc_hash_map(void) #endif } -void _nc_make_oldhash(int i) +NCURSES_EXPORT(void) +_nc_make_oldhash(int i) { if (oldhash) oldhash[i] = hash(OLDTEXT(i)); } -void _nc_scroll_oldhash(int n, int top, int bot) +NCURSES_EXPORT(void) +_nc_scroll_oldhash(int n, int top, int bot) { int size; int i; @@ -431,27 +412,24 @@ void _nc_scroll_oldhash(int n, int top, int bot) if (!oldhash) return; - size = sizeof(*oldhash) * (bot-top+1-abs(n)); - if (n > 0) - { - memmove (oldhash+top, oldhash+top+n, size); - for (i = bot; i > bot-n; i--) + size = sizeof(*oldhash) * (bot - top + 1 - abs(n)); + if (n > 0) { + memmove(oldhash + top, oldhash + top + n, size); + for (i = bot; i > bot - n; i--) oldhash[i] = hash(OLDTEXT(i)); - } - else - { - memmove (oldhash+top-n, oldhash+top, size); - for (i = top; i < top-n; i++) + } else { + memmove(oldhash + top - n, oldhash + top, size); + for (i = top; i < top - n; i++) oldhash[i] = hash(OLDTEXT(i)); } } - #ifdef HASHDEBUG static void usage(void) { - static const char *table[] = { + static const char *table[] = + { "hashmap test-driver", "", "# comment", @@ -463,19 +441,18 @@ usage(void) "? this message" }; size_t n; - for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) fprintf(stderr, "%s\n", table[n]); } int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; - int n; + char line[BUFSIZ], *st; + int n; - SP = typeCalloc(SCREEN,1); - for (n = 0; n < screen_lines; n++) - { + SP = typeCalloc(SCREEN, 1); + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; oldtext[n][0] = newtext[n][0] = '.'; @@ -487,21 +464,18 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { + for (;;) { /* grab a test command */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); - switch(line[0]) - { - case '#': /* comment */ + switch (line[0]) { + case '#': /* comment */ (void) fputs(line, stderr); break; - case 'l': /* get initial line number vector */ - for (n = 0; n < screen_lines; n++) - { + case 'l': /* get initial line number vector */ + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; } @@ -510,30 +484,30 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); break; - case 'n': /* use following letters as text of new lines */ + case 'n': /* use following letters as text of new lines */ for (n = 0; n < screen_lines; n++) newtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - newtext[n][0] = line[n+1]; + newtext[n][0] = line[n + 1]; break; - case 'o': /* use following letters as text of old lines */ + case 'o': /* use following letters as text of old lines */ for (n = 0; n < screen_lines; n++) oldtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - oldtext[n][0] = line[n+1]; + oldtext[n][0] = line[n + 1]; break; - case 'd': /* dump state of test arrays */ + case 'd': /* dump state of test arrays */ #ifdef TRACE _nc_linedump(); #endif @@ -549,7 +523,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) putchar('\n'); break; - case 'h': /* apply hash mapper and see scroll optimization */ + case 'h': /* apply hash mapper and see scroll optimization */ _nc_hash_map(); (void) fputs("Result:\n", stderr); #ifdef TRACE diff --git a/lib/libcurses/tty/lib_mvcur.c b/lib/libcurses/tty/lib_mvcur.c index 0c72f2b5c96..45b0a2b7178 100644 --- a/lib/libcurses/tty/lib_mvcur.c +++ b/lib/libcurses/tty/lib_mvcur.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mvcur.c,v 1.9 2000/10/08 22:47:04 millert Exp $ */ +/* $OpenBSD: lib_mvcur.c,v 1.10 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -154,7 +154,7 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$From: lib_mvcur.c,v 1.72 2000/10/08 00:58:25 tom Exp $") +MODULE_ID("$From: lib_mvcur.c,v 1.77 2000/12/10 03:04:30 tom Exp $") #define CURRENT_ROW SP->_cursrow /* phys cursor row */ #define CURRENT_COLUMN SP->_curscol /* phys cursor column */ @@ -208,8 +208,9 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #endif -int -_nc_msec_cost(const char *const cap, int affcnt) +NCURSES_EXPORT(int) +_nc_msec_cost +(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) @@ -224,11 +225,11 @@ _nc_msec_cost(const char *const cap, int affcnt) float number = 0.0; for (cp += 2; *cp != '>'; cp++) { - if (isdigit(*cp)) + if (isdigit(CharOf(*cp))) number = number * 10 + (*cp - '0'); else if (*cp == '*') number *= affcnt; - else if (*cp == '.' && (*++cp != '>') && isdigit(*cp)) + else if (*cp == '.' && (*++cp != '>') && isdigit(CharOf(*cp))) number += (*cp - '0') / 10.0; } @@ -264,7 +265,7 @@ reset_scroll_region(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_resume(void) /* what to do at initialization time and after each shellout */ { @@ -294,7 +295,7 @@ _nc_mvcur_resume(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_init(void) /* initialize the cost structure */ { @@ -408,7 +409,7 @@ _nc_mvcur_init(void) _nc_mvcur_resume(); } -void +NCURSES_EXPORT(void) _nc_mvcur_wrap(void) /* wrap up cursor-addressing mode */ { @@ -571,6 +572,8 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int #endif /* USE_HARD_TABS */ #if defined(REAL_ATTR) && defined(WANT_CHAR) + if (n <= 0 || n >= (int) check.s_size) + ovw = FALSE; #if BSD_TPUTS /* * If we're allowing BSD-style padding in tputs, don't generate @@ -828,8 +831,9 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) return (ERR); } -int -mvcur(int yold, int xold, int ynew, int xnew) +NCURSES_EXPORT(int) +mvcur +(int yold, int xold, int ynew, int xnew) /* optimized cursor move from (yold, xold) to (ynew, xnew) */ { TR(TRACE_MOVE, ("mvcur(%d,%d,%d,%d) called", yold, xold, ynew, xnew)); @@ -883,7 +887,7 @@ mvcur(int yold, int xold, int ynew, int xnew) } #if defined(TRACE) || defined(NCURSES_TEST) -int _nc_optimize_enable = OPTIMIZE_ALL; +NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; #endif #if defined(MAIN) || defined(NCURSES_TEST) @@ -896,13 +900,15 @@ int _nc_optimize_enable = OPTIMIZE_ALL; #include <tic.h> #include <dump_entry.h> -const char *_nc_progname = "mvcur"; +NCURSES_EXPORT_VAR(const char *) +_nc_progname = "mvcur"; -static unsigned long xmits; + static unsigned long xmits; /* these override lib_tputs.c */ -int -tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) @@ -912,24 +918,25 @@ tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) return (OK); } -int +NCURSES_EXPORT(int) putp(const char *string) { return (tputs(string, 1, _nc_outch)); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { putc(ch, stdout); return OK; } -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(int) +_nc_nulls_sent = 0; /* used by 'tack' program */ -int +NCURSES_EXPORT(int) delay_output(int ms GCC_UNUSED) { return OK; diff --git a/lib/libcurses/tty/lib_tstp.c b/lib/libcurses/tty/lib_tstp.c index e3f0e36e372..23e99cf453e 100644 --- a/lib/libcurses/tty/lib_tstp.c +++ b/lib/libcurses/tty/lib_tstp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tstp.c,v 1.7 2000/10/08 22:47:05 millert Exp $ */ +/* $OpenBSD: lib_tstp.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$From: lib_tstp.c,v 1.22 2000/09/02 18:33:17 tom Exp $") +MODULE_ID("$From: lib_tstp.c,v 1.24 2000/12/10 03:04:30 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -306,7 +306,7 @@ CatchIfDefault(int sig, RETSIGTYPE(*handler) (int)) * The XSI document implies that we shouldn't keep the SIGTSTP handler if * the caller later changes its mind, but that doesn't seem correct. */ -void +NCURSES_EXPORT(void) _nc_signal_handler(bool enable) { #if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ diff --git a/lib/libcurses/tty/lib_twait.c b/lib/libcurses/tty/lib_twait.c index f882f915b71..0b7c4d2949b 100644 --- a/lib/libcurses/tty/lib_twait.c +++ b/lib/libcurses/tty/lib_twait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_twait.c,v 1.7 2000/10/10 15:10:32 millert Exp $ */ +/* $OpenBSD: lib_twait.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -61,7 +61,7 @@ # endif #endif -MODULE_ID("$From: lib_twait.c,v 1.39 2000/08/26 19:34:15 tom Exp $") +MODULE_ID("$From: lib_twait.c,v 1.41 2000/12/10 03:04:30 tom Exp $") static long _nc_gettime(bool first) @@ -104,8 +104,9 @@ _nc_gettime(bool first) * If the milliseconds given are -1, the wait blocks until activity on the * descriptors. */ -int -_nc_timed_wait(int mode, int milliseconds, int *timeleft) +NCURSES_EXPORT(int) +_nc_timed_wait +(int mode, int milliseconds, int *timeleft) { int fd; int count; diff --git a/lib/libcurses/tty/lib_vidattr.c b/lib/libcurses/tty/lib_vidattr.c index e9639a730c6..4a5c9354b72 100644 --- a/lib/libcurses/tty/lib_vidattr.c +++ b/lib/libcurses/tty/lib_vidattr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_vidattr.c,v 1.7 2000/10/22 18:27:24 millert Exp $ */ +/* $OpenBSD: lib_vidattr.c,v 1.8 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -66,7 +66,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") +MODULE_ID("$From: lib_vidattr.c,v 1.36 2000/12/10 03:05:48 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -88,8 +88,9 @@ MODULE_ID("$From: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") } \ } -int -vidputs(attr_t newmode, int (*outc) (int)) +NCURSES_EXPORT(int) +vidputs +(attr_t newmode, int (*outc) (int)) { static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; @@ -136,11 +137,13 @@ vidputs(attr_t newmode, int (*outc) (int)) * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS * macro so this will work properly for the wide-character layout. */ - attr_t mask = NCURSES_BITS((no_color_video & 63) - | ((no_color_video & 192) << 1) - | ((no_color_video & 256) >> 2), 8); + unsigned value = no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); - if (mask & A_REVERSE && newmode & A_REVERSE) { + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { reverse = TRUE; mask &= ~A_REVERSE; } @@ -250,7 +253,7 @@ vidputs(attr_t newmode, int (*outc) (int)) returnCode(OK); } -int +NCURSES_EXPORT(int) vidattr(attr_t newmode) { T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); @@ -258,7 +261,7 @@ vidattr(attr_t newmode) returnCode(vidputs(newmode, _nc_outch)); } -chtype +NCURSES_EXPORT(chtype) termattrs(void) { chtype attrs = A_NORMAL; diff --git a/lib/libcurses/tty/tty_display.h b/lib/libcurses/tty/tty_display.h index 198843f51e6..f1e0f47e1d1 100644 --- a/lib/libcurses/tty/tty_display.h +++ b/lib/libcurses/tty/tty_display.h @@ -1,7 +1,7 @@ -/* $OpenBSD: tty_display.h,v 1.2 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: tty_display.h,v 1.3 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** - * 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,20 +31,20 @@ #ifndef TTY_DISPLAY_H #define TTY_DISPLAY_H 1 -extern bool _nc_tty_beep(void); -extern bool _nc_tty_check_resize(void); -extern bool _nc_tty_cursor(int); -extern bool _nc_tty_flash(void); -extern bool _nc_tty_init_color(int,int,int,int); -extern bool _nc_tty_init_pair(int,int,int); -extern bool _nc_tty_slk_hide(bool); -extern bool _nc_tty_slk_update(int,const char *); -extern bool _nc_tty_start_color(void); -extern void _nc_tty_display_resume(void); -extern void _nc_tty_display_suspend(void); -extern void _nc_tty_dispose(void); /* frees SP->_term */ -extern void _nc_tty_switch_to(void); -extern void _nc_tty_update(void); +extern NCURSES_EXPORT(bool) _nc_tty_beep (void); +extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); +extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); +extern NCURSES_EXPORT(bool) _nc_tty_flash (void); +extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); +extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); +extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); +extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); +extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ +extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); +extern NCURSES_EXPORT(void) _nc_tty_update (void); struct tty_display_data { int _fifohold; /* set if breakout marked */ diff --git a/lib/libcurses/tty/tty_input.h b/lib/libcurses/tty/tty_input.h index c42774be14b..21f551a49a2 100644 --- a/lib/libcurses/tty/tty_input.h +++ b/lib/libcurses/tty/tty_input.h @@ -1,7 +1,7 @@ -/* $OpenBSD: tty_input.h,v 1.1 1999/01/18 19:10:27 millert Exp $ */ +/* $OpenBSD: tty_input.h,v 1.2 2001/01/22 18:02:00 millert Exp $ */ /**************************************************************************** - * 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 * @@ -29,19 +29,19 @@ ****************************************************************************/ /* - * $From: tty_input.h,v 1.1 1998/12/19 22:42:57 tom Exp $ + * $From: tty_input.h,v 1.2 2000/12/10 02:26:51 tom Exp $ */ #ifndef TTY_INPUT_H #define TTY_INPUT_H 1 -extern bool _nc_tty_mouse_mask(mmask_t); -extern bool _nc_tty_pending(void); -extern int _nc_tty_next_event(int); -extern void _nc_tty_flags_changed(void); -extern void _nc_tty_flush(void); -extern void _nc_tty_input_resume(void); -extern void _nc_tty_input_suspend(void); +extern NCURSES_EXPORT(bool) _nc_tty_mouse_mask (mmask_t); +extern NCURSES_EXPORT(bool) _nc_tty_pending (void); +extern NCURSES_EXPORT(int) _nc_tty_next_event (int); +extern NCURSES_EXPORT(void) _nc_tty_flags_changed (void); +extern NCURSES_EXPORT(void) _nc_tty_flush (void); +extern NCURSES_EXPORT(void) _nc_tty_input_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_input_suspend (void); struct tty_input_data { int _ifd; /* input file ptr for screen */ diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c index 25f04b0339e..194bc4343d9 100644 --- a/lib/libcurses/tty/tty_update.c +++ b/lib/libcurses/tty/tty_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_update.c,v 1.13 2000/10/10 15:10:32 millert Exp $ */ +/* $OpenBSD: tty_update.c,v 1.14 2001/01/22 18:02:01 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -72,7 +72,7 @@ #include <term.h> -MODULE_ID("$From: tty_update.c,v 1.146 2000/10/07 01:11:44 tom Exp $") +MODULE_ID("$From: tty_update.c,v 1.150 2001/01/14 00:16:22 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -527,7 +527,7 @@ callPutChar(chtype const ch) win->_line[row].lastchar = _NOCHANGE; \ if_USE_SCROLL_HINTS(win->_line[row].oldindex = row) -int +NCURSES_EXPORT(int) doupdate(void) { int i; @@ -769,20 +769,20 @@ doupdate(void) /* mark line changed successfully */ if (i <= newscr->_maxy) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } if (i <= curscr->_maxy) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } } } /* put everything back in sync */ for (i = nonempty; i <= newscr->_maxy; i++) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } for (i = nonempty; i <= curscr->_maxy; i++) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } if (!newscr->_leaveok) { @@ -1284,7 +1284,7 @@ ClearScreen(chtype blank) #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { - _nc_do_color(COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); + _nc_do_color((int) COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); if (!back_color_erase) { fast_clear = FALSE; } @@ -1419,7 +1419,7 @@ DelChar(int count) ** Emit a string without waiting for update. */ -void +NCURSES_EXPORT(void) _nc_outstr(const char *str) { (void) putp(str); @@ -1612,8 +1612,9 @@ scroll_idl(int n, int del, int ins, chtype blank) return OK; } -int -_nc_scrolln(int n, int top, int bot, int maxy) +NCURSES_EXPORT(int) +_nc_scrolln +(int n, int top, int bot, int maxy) /* scroll region from top to bot by n lines */ { chtype blank = ClrBlank(stdscr); @@ -1734,7 +1735,7 @@ _nc_scrolln(int n, int top, int bot, int maxy) return (OK); } -void +NCURSES_EXPORT(void) _nc_screen_resume(void) { /* make sure terminal is in a sane known state */ @@ -1760,14 +1761,14 @@ _nc_screen_resume(void) putp(auto_right_margin ? enter_am_mode : exit_am_mode); } -void +NCURSES_EXPORT(void) _nc_screen_init(void) { _nc_screen_resume(); } /* wrap up screen handling */ -void +NCURSES_EXPORT(void) _nc_screen_wrap(void) { UpdateAttrs(A_NORMAL); @@ -1788,7 +1789,7 @@ _nc_screen_wrap(void) } #if USE_XMC_SUPPORT -void +NCURSES_EXPORT(void) _nc_do_xmc_glitch(attr_t previous) { attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); diff --git a/lib/libcurses/unctrl.h b/lib/libcurses/unctrl.h index 92d94a49a65..211540418b9 100644 --- a/lib/libcurses/unctrl.h +++ b/lib/libcurses/unctrl.h @@ -1,7 +1,7 @@ -/* $OpenBSD: unctrl.h,v 1.7 2000/10/22 18:27:21 millert Exp $ */ +/* $OpenBSD: unctrl.h,v 1.8 2001/01/22 18:01:35 millert Exp $ */ /**************************************************************************** - * 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 * @@ -41,7 +41,7 @@ * as ^?. Printable characters are displayed as is. */ -/* $From: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */ +/* $From: unctrl.h.in,v 1.9 2000/12/10 02:02:15 tom Exp $ */ #ifndef _UNCTRL_H #define _UNCTRL_H 1 @@ -56,7 +56,7 @@ extern "C" { #include <curses.h> #undef unctrl -extern NCURSES_CONST char *unctrl(chtype); +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); #ifdef __cplusplus } diff --git a/lib/libform/fld_arg.c b/lib/libform/fld_arg.c index babe4661fd2..5087cd986fc 100644 --- a/lib/libform/fld_arg.c +++ b/lib/libform/fld_arg.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_arg.c,v 1.3 1999/05/17 03:04:09 millert Exp $ */ +/* $OpenBSD: fld_arg.c,v 1.4 2001/01/22 18:02:11 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_arg.c,v 1.4 1999/05/16 17:16:04 juergen Exp $") +MODULE_ID("$From: fld_arg.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -62,10 +62,12 @@ MODULE_ID("$From: fld_arg.c,v 1.4 1999/05/16 17:16:04 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int set_fieldtype_arg(FIELDTYPE * typ, - void * (* const make_arg)(va_list *), - void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)) +NCURSES_EXPORT(int) +set_fieldtype_arg + (FIELDTYPE * typ, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)) { if ( !typ || !make_arg ) RETURN(E_BAD_ARGUMENT); @@ -85,7 +87,8 @@ int set_fieldtype_arg(FIELDTYPE * typ, | | Return Values : Pointer to structure or NULL if none is defined. +--------------------------------------------------------------------------*/ -void *field_arg(const FIELD * field) +NCURSES_EXPORT(void *) +field_arg (const FIELD * field) { return Normalize_Field(field)->arg; } diff --git a/lib/libform/fld_attr.c b/lib/libform/fld_attr.c index 1aa350c3390..01f71c99008 100644 --- a/lib/libform/fld_attr.c +++ b/lib/libform/fld_attr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_attr.c,v 1.3 1999/05/17 03:04:10 millert Exp $ */ +/* $OpenBSD: fld_attr.c,v 1.4 2001/01/22 18:02:11 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,14 +33,14 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: fld_attr.c,v 1.4 1999/05/16 17:16:30 juergen Exp $") +MODULE_ID("$From: fld_attr.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines --------------------------------------------------------------------------*/ /* "Template" macro to generate a function to set a fields attribute */ #define GEN_FIELD_ATTR_SET_FCT( name ) \ -int set_field_ ## name (FIELD * field, chtype attr)\ +NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ {\ int res = E_BAD_ARGUMENT;\ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ @@ -59,7 +59,7 @@ int set_field_ ## name (FIELD * field, chtype attr)\ /* "Template" macro to generate a function to get a fields attribute */ #define GEN_FIELD_ATTR_GET_FCT( name ) \ -chtype field_ ## name (const FIELD * field)\ +NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ {\ return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ } diff --git a/lib/libform/fld_current.c b/lib/libform/fld_current.c index bca92b4135a..530dfbd69c5 100644 --- a/lib/libform/fld_current.c +++ b/lib/libform/fld_current.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_current.c,v 1.3 1999/05/17 03:04:10 millert Exp $ */ +/* $OpenBSD: fld_current.c,v 1.4 2001/01/22 18:02:11 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: fld_current.c,v 1.4 1999/05/16 17:16:46 juergen Exp $") +MODULE_ID("$From: fld_current.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,7 +48,8 @@ MODULE_ID("$From: fld_current.c,v 1.4 1999/05/16 17:16:46 juergen Exp $") | E_INVALID_FIELD - current field can't be left | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_current_field(FORM * form, FIELD * field) +NCURSES_EXPORT(int) +set_current_field (FORM * form, FIELD * field) { int err = E_OK; @@ -103,7 +104,8 @@ int set_current_field(FORM * form, FIELD * field) | | Return Values : Pointer to the current field. +--------------------------------------------------------------------------*/ -FIELD *current_field(const FORM * form) +NCURSES_EXPORT(FIELD *) +current_field (const FORM * form) { return Normalize_Form(form)->current; } @@ -118,7 +120,8 @@ FIELD *current_field(const FORM * form) | Return Values : >= 0 : field index | -1 : fieldpointer invalid or field not connected +--------------------------------------------------------------------------*/ -int field_index(const FIELD * field) +NCURSES_EXPORT(int) +field_index (const FIELD * field) { return ( (field && field->form) ? field->index : -1 ); } diff --git a/lib/libform/fld_def.c b/lib/libform/fld_def.c index ecf876c274f..9ae030440e0 100644 --- a/lib/libform/fld_def.c +++ b/lib/libform/fld_def.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_def.c,v 1.5 1999/05/17 03:04:11 millert Exp $ */ +/* $OpenBSD: fld_def.c,v 1.6 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_def.c,v 1.12 1999/05/16 17:37:48 juergen Exp $") +MODULE_ID("$From: fld_def.c,v 1.13 2000/12/10 02:09:38 tom Exp $") /* this can't be readonly */ static FIELD default_field = { @@ -65,7 +65,7 @@ static FIELD default_field = { (char *)0 /* usrptr */ }; -FIELD *_nc_Default_Field = &default_field; +NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; /*--------------------------------------------------------------------------- | Facility : libnform @@ -81,8 +81,9 @@ FIELD *_nc_Default_Field = &default_field; | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -TypeArgument* -_nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) +NCURSES_EXPORT(TypeArgument*) +_nc_Make_Argument +(const FIELDTYPE *typ, va_list *ap, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -123,9 +124,10 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -TypeArgument* -_nc_Copy_Argument(const FIELDTYPE *typ, - const TypeArgument *argp, int *err) +NCURSES_EXPORT(TypeArgument*) +_nc_Copy_Argument + (const FIELDTYPE *typ, + const TypeArgument *argp, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -168,8 +170,9 @@ _nc_Copy_Argument(const FIELDTYPE *typ, | | Return Values : - +--------------------------------------------------------------------------*/ -void -_nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) +NCURSES_EXPORT(void) +_nc_Free_Argument +(const FIELDTYPE * typ, TypeArgument * argp) { if (!typ || !(typ->status & _HAS_ARGS)) return; @@ -197,8 +200,9 @@ _nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) | Return Values : TRUE - copy worked | FALSE - error occured +--------------------------------------------------------------------------*/ -bool -_nc_Copy_Type(FIELD *dst, FIELD const *src) +NCURSES_EXPORT(bool) +_nc_Copy_Type +(FIELD *dst, FIELD const *src) { int err = 0; @@ -230,8 +234,8 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src) | | Return Values : - +--------------------------------------------------------------------------*/ -void -_nc_Free_Type(FIELD *field) +NCURSES_EXPORT(void) +_nc_Free_Type (FIELD *field) { assert(field); if (field->type) @@ -255,7 +259,9 @@ _nc_Free_Type(FIELD *field) | | Return Values : Pointer to the new field or NULL if failure. +--------------------------------------------------------------------------*/ -FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) +NCURSES_EXPORT(FIELD *) +new_field +(int rows, int cols, int frow, int fcol, int nrow, int nbuf) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; @@ -319,7 +325,8 @@ FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) | E_BAD_ARGUMENT - invalid field pointer | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int free_field(FIELD * field) +NCURSES_EXPORT(int) +free_field (FIELD * field) { if (!field) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_dup.c b/lib/libform/fld_dup.c index ab7d8e7165f..3671141705a 100644 --- a/lib/libform/fld_dup.c +++ b/lib/libform/fld_dup.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_dup.c,v 1.3 1999/05/17 03:04:12 millert Exp $ */ +/* $OpenBSD: fld_dup.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_dup.c,v 1.4 1999/05/16 17:17:08 juergen Exp $") +MODULE_ID("$From: fld_dup.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -49,7 +49,8 @@ MODULE_ID("$From: fld_dup.c,v 1.4 1999/05/16 17:17:08 juergen Exp $") | | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ -FIELD *dup_field(FIELD * field, int frow, int fcol) +NCURSES_EXPORT(FIELD *) +dup_field (FIELD * field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; diff --git a/lib/libform/fld_ftchoice.c b/lib/libform/fld_ftchoice.c index 3d660050070..bf102348924 100644 --- a/lib/libform/fld_ftchoice.c +++ b/lib/libform/fld_ftchoice.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_ftchoice.c,v 1.3 1999/05/17 03:04:13 millert Exp $ */ +/* $OpenBSD: fld_ftchoice.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_ftchoice.c,v 1.4 1999/05/16 17:17:21 juergen Exp $") +MODULE_ID("$From: fld_ftchoice.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,9 +48,11 @@ MODULE_ID("$From: fld_ftchoice.c,v 1.4 1999/05/16 17:17:21 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid arguments +--------------------------------------------------------------------------*/ -int set_fieldtype_choice(FIELDTYPE * typ, - bool (* const next_choice) (FIELD *,const void *), - bool (* const prev_choice) (FIELD *,const void *)) +NCURSES_EXPORT(int) +set_fieldtype_choice + (FIELDTYPE * typ, + bool (* const next_choice) (FIELD *,const void *), + bool (* const prev_choice) (FIELD *,const void *)) { if ( !typ || !next_choice || !prev_choice ) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_ftlink.c b/lib/libform/fld_ftlink.c index c3d2fe69023..07557e59234 100644 --- a/lib/libform/fld_ftlink.c +++ b/lib/libform/fld_ftlink.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_ftlink.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_ftlink.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_ftlink.c,v 1.4 1999/05/16 17:17:33 juergen Exp $") +MODULE_ID("$From: fld_ftlink.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -50,7 +50,9 @@ MODULE_ID("$From: fld_ftlink.c,v 1.4 1999/05/16 17:17:33 juergen Exp $") | | Return Values : Fieldtype pointer or NULL if error occured. +--------------------------------------------------------------------------*/ -FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2) +NCURSES_EXPORT(FIELDTYPE *) +link_fieldtype +(FIELDTYPE * type1, FIELDTYPE * type2) { FIELDTYPE *nftyp = (FIELDTYPE *)0; diff --git a/lib/libform/fld_info.c b/lib/libform/fld_info.c index 9520673229d..da868e6c1d4 100644 --- a/lib/libform/fld_info.c +++ b/lib/libform/fld_info.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_info.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_info.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_info.c,v 1.4 1999/05/16 17:17:52 juergen Exp $") +MODULE_ID("$From: fld_info.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,10 +48,12 @@ MODULE_ID("$From: fld_info.c,v 1.4 1999/05/16 17:17:52 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid field pointer +--------------------------------------------------------------------------*/ -int field_info(const FIELD *field, - int *rows, int *cols, - int *frow, int *fcol, - int *nrow, int *nbuf) +NCURSES_EXPORT(int) +field_info + (const FIELD *field, + int *rows, int *cols, + int *frow, int *fcol, + int *nrow, int *nbuf) { if (!field) RETURN(E_BAD_ARGUMENT); @@ -77,8 +79,9 @@ int field_info(const FIELD *field, | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int dynamic_field_info(const FIELD *field, - int *drows, int *dcols, int *maxgrow) +NCURSES_EXPORT(int) +dynamic_field_info +(const FIELD *field, int *drows, int *dcols, int *maxgrow) { if (!field) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_just.c b/lib/libform/fld_just.c index 52bdb3a760a..61db459b6e7 100644 --- a/lib/libform/fld_just.c +++ b/lib/libform/fld_just.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_just.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_just.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_just.c,v 1.5 1999/05/16 17:18:06 juergen Exp $") +MODULE_ID("$From: fld_just.c,v 1.6 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: fld_just.c,v 1.5 1999/05/16 17:18:06 juergen Exp $") | E_BAD_ARGUMENT - one of the arguments was incorrect | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_just(FIELD * field, int just) +NCURSES_EXPORT(int) +set_field_just (FIELD * field, int just) { int res = E_BAD_ARGUMENT; @@ -75,7 +76,8 @@ int set_field_just(FIELD * field, int just) | | Return Values : The justification type. +--------------------------------------------------------------------------*/ -int field_just(const FIELD * field) +NCURSES_EXPORT(int) +field_just (const FIELD * field) { return Normalize_Field( field )->just; } diff --git a/lib/libform/fld_link.c b/lib/libform/fld_link.c index 0dc5c09defb..8ee22de0067 100644 --- a/lib/libform/fld_link.c +++ b/lib/libform/fld_link.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_link.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_link.c,v 1.4 2001/01/22 18:02:12 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_link.c,v 1.4 1999/05/16 17:18:18 juergen Exp $") +MODULE_ID("$From: fld_link.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -50,7 +50,8 @@ MODULE_ID("$From: fld_link.c,v 1.4 1999/05/16 17:18:18 juergen Exp $") | | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ -FIELD *link_field(FIELD * field, int frow, int fcol) +NCURSES_EXPORT(FIELD *) +link_field (FIELD * field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; diff --git a/lib/libform/fld_max.c b/lib/libform/fld_max.c index 8d1e34c115d..64ca77bfde4 100644 --- a/lib/libform/fld_max.c +++ b/lib/libform/fld_max.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_max.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_max.c,v 1.4 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") +MODULE_ID("$From: fld_max.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int set_max_field(FIELD *field, int maxgrow) +NCURSES_EXPORT(int) +set_max_field (FIELD *field, int maxgrow) { if (!field || (maxgrow<0)) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_move.c b/lib/libform/fld_move.c index 137079dc426..3fe67e621f2 100644 --- a/lib/libform/fld_move.c +++ b/lib/libform/fld_move.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_move.c,v 1.3 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_move.c,v 1.4 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_move.c,v 1.4 1999/05/16 17:38:51 juergen Exp $") +MODULE_ID("$From: fld_move.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,7 +47,8 @@ MODULE_ID("$From: fld_move.c,v 1.4 1999/05/16 17:38:51 juergen Exp $") | E_BAD_ARGUMENT - invalid argument passed | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int move_field(FIELD *field, int frow, int fcol) +NCURSES_EXPORT(int) +move_field (FIELD *field, int frow, int fcol) { if ( !field || (frow<0) || (fcol<0) ) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_newftyp.c b/lib/libform/fld_newftyp.c index 27950ca91bd..4abd3d5f16d 100644 --- a/lib/libform/fld_newftyp.c +++ b/lib/libform/fld_newftyp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_newftyp.c,v 1.4 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_newftyp.c,v 1.5 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_newftyp.c,v 1.5 1999/05/16 17:18:54 juergen Exp $") +MODULE_ID("$From: fld_newftyp.c,v 1.6 2000/12/10 02:09:38 tom Exp $") static FIELDTYPE const default_fieldtype = { 0, /* status */ @@ -50,7 +50,7 @@ static FIELDTYPE const default_fieldtype = { NULL /* enumerate previous function */ }; -const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; +NCURSES_EXPORT_VAR(const FIELDTYPE*) _nc_Default_FieldType = &default_fieldtype; /*--------------------------------------------------------------------------- | Facility : libnform @@ -67,7 +67,8 @@ const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; | | Return Values : Fieldtype pointer or NULL if error occured +--------------------------------------------------------------------------*/ -FIELDTYPE *new_fieldtype( +NCURSES_EXPORT(FIELDTYPE *) +new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check) (int,const void *) ) { @@ -104,7 +105,8 @@ FIELDTYPE *new_fieldtype( | E_CONNECTED - there are fields referencing the type | E_BAD_ARGUMENT - invalid fieldtype pointer +--------------------------------------------------------------------------*/ -int free_fieldtype(FIELDTYPE *typ) +NCURSES_EXPORT(int) +free_fieldtype (FIELDTYPE *typ) { if (!typ) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/fld_opts.c b/lib/libform/fld_opts.c index c298ece38c7..2a2bbea6f39 100644 --- a/lib/libform/fld_opts.c +++ b/lib/libform/fld_opts.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_opts.c,v 1.4 1999/05/17 03:04:14 millert Exp $ */ +/* $OpenBSD: fld_opts.c,v 1.5 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: fld_opts.c,v 1.6 1999/05/16 17:19:06 juergen Exp $") +MODULE_ID("$From: fld_opts.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*---------------------------------------------------------------------------- Field-Options manipulation routines @@ -51,7 +51,8 @@ MODULE_ID("$From: fld_opts.c,v 1.6 1999/05/16 17:19:06 juergen Exp $") | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_opts(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +set_field_opts (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; opts &= ALL_FIELD_OPTS; @@ -68,7 +69,8 @@ int set_field_opts(FIELD * field, Field_Options opts) | | Return Values : The options. +--------------------------------------------------------------------------*/ -Field_Options field_opts(const FIELD * field) +NCURSES_EXPORT(Field_Options) +field_opts (const FIELD * field) { return ALL_FIELD_OPTS & Normalize_Field( field )->opts; } @@ -85,7 +87,8 @@ Field_Options field_opts(const FIELD * field) | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int field_opts_on(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +field_opts_on (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; @@ -110,7 +113,8 @@ int field_opts_on(FIELD * field, Field_Options opts) | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int field_opts_off(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +field_opts_off (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; diff --git a/lib/libform/fld_pad.c b/lib/libform/fld_pad.c index 0623fb1e032..5d2e4dfdceb 100644 --- a/lib/libform/fld_pad.c +++ b/lib/libform/fld_pad.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_pad.c,v 1.3 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: fld_pad.c,v 1.4 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: fld_pad.c,v 1.4 1999/05/16 17:38:58 juergen Exp $") +MODULE_ID("$From: fld_pad.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: fld_pad.c,v 1.4 1999/05/16 17:38:58 juergen Exp $") | E_BAD_ARGUMENT - invalid field pointer or pad character | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_pad(FIELD * field, int ch) +NCURSES_EXPORT(int) +set_field_pad (FIELD * field, int ch) { int res = E_BAD_ARGUMENT; @@ -72,7 +73,8 @@ int set_field_pad(FIELD * field, int ch) | | Return Values : The pad character. +--------------------------------------------------------------------------*/ -int field_pad(const FIELD * field) +NCURSES_EXPORT(int) +field_pad (const FIELD * field) { return Normalize_Field( field )->pad; } diff --git a/lib/libform/fld_page.c b/lib/libform/fld_page.c index caf19a523dc..3e37d022917 100644 --- a/lib/libform/fld_page.c +++ b/lib/libform/fld_page.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_page.c,v 1.3 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: fld_page.c,v 1.4 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_page.c,v 1.4 1999/05/16 17:19:37 juergen Exp $") +MODULE_ID("$From: fld_page.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: fld_page.c,v 1.4 1999/05/16 17:19:37 juergen Exp $") | Return Values : E_OK - success | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int set_new_page(FIELD * field, bool new_page_flag) +NCURSES_EXPORT(int) +set_new_page (FIELD * field, bool new_page_flag) { Normalize_Field(field); if (field->form) @@ -70,7 +71,8 @@ int set_new_page(FIELD * field, bool new_page_flag) | Return Values : TRUE - field starts a new page | FALSE - field doesn't start a new page +--------------------------------------------------------------------------*/ -bool new_page(const FIELD * field) +NCURSES_EXPORT(bool) +new_page (const FIELD * field) { return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; } diff --git a/lib/libform/fld_stat.c b/lib/libform/fld_stat.c index c0316412fbc..297f09022c1 100644 --- a/lib/libform/fld_stat.c +++ b/lib/libform/fld_stat.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_stat.c,v 1.5 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: fld_stat.c,v 1.6 2001/01/22 18:02:13 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_stat.c,v 1.6 1999/05/16 17:19:48 juergen Exp $") +MODULE_ID("$From: fld_stat.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$From: fld_stat.c,v 1.6 1999/05/16 17:19:48 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_field_status(FIELD * field, bool status) +NCURSES_EXPORT(int) +set_field_status (FIELD * field, bool status) { Normalize_Field( field ); @@ -67,7 +68,8 @@ int set_field_status(FIELD * field, bool status) | Return Values : TRUE - buffer has been changed | FALSE - buffer has not been changed +--------------------------------------------------------------------------*/ -bool field_status(const FIELD * field) +NCURSES_EXPORT(bool) +field_status (const FIELD * field) { return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); } diff --git a/lib/libform/fld_type.c b/lib/libform/fld_type.c index e0f9c1346df..dd3754c5c27 100644 --- a/lib/libform/fld_type.c +++ b/lib/libform/fld_type.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_type.c,v 1.5 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: fld_type.c,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_type.c,v 1.9 1999/05/16 17:19:59 juergen Exp $") +MODULE_ID("$From: fld_type.c,v 1.10 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,7 +47,8 @@ MODULE_ID("$From: fld_type.c,v 1.9 1999/05/16 17:19:59 juergen Exp $") | Return Values : E_OK - success | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_type(FIELD *field,FIELDTYPE *type, ...) +NCURSES_EXPORT(int) +set_field_type (FIELD *field,FIELDTYPE *type, ...) { va_list ap; int res = E_SYSTEM_ERROR; @@ -86,7 +87,8 @@ int set_field_type(FIELD *field,FIELDTYPE *type, ...) | | Return Values : Pointer to fieldtype of NULL if none is defined. +--------------------------------------------------------------------------*/ -FIELDTYPE *field_type(const FIELD * field) +NCURSES_EXPORT(FIELDTYPE *) +field_type (const FIELD * field) { return Normalize_Field(field)->type; } diff --git a/lib/libform/fld_user.c b/lib/libform/fld_user.c index cede0078c0d..2e08d902fbc 100644 --- a/lib/libform/fld_user.c +++ b/lib/libform/fld_user.c @@ -1,7 +1,7 @@ -/* $OpenBSD: fld_user.c,v 1.5 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: fld_user.c,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: fld_user.c,v 1.8 1999/05/16 17:20:09 juergen Exp $") +MODULE_ID("$From: fld_user.c,v 1.9 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$From: fld_user.c,v 1.8 1999/05/16 17:20:09 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_field_userptr(FIELD * field, void *usrptr) +NCURSES_EXPORT(int) +set_field_userptr (FIELD * field, void *usrptr) { Normalize_Field( field )->usrptr = usrptr; RETURN(E_OK); @@ -61,7 +62,8 @@ int set_field_userptr(FIELD * field, void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *field_userptr(const FIELD *field) +NCURSES_EXPORT(void *) +field_userptr (const FIELD *field) { return Normalize_Field( field )->usrptr; } diff --git a/lib/libform/form.h b/lib/libform/form.h index 4f78a8c578b..f0ce4260a2b 100644 --- a/lib/libform/form.h +++ b/lib/libform/form.h @@ -1,7 +1,7 @@ -/* $OpenBSD: form.h,v 1.5 1999/05/17 03:04:15 millert Exp $ */ +/* $OpenBSD: form.h,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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 * @@ -248,140 +248,135 @@ typedef void (*Form_Hook)(FORM *); /************************* * standard field types * *************************/ -extern FIELDTYPE *TYPE_ALPHA, - *TYPE_ALNUM, - *TYPE_ENUM, - *TYPE_INTEGER, - *TYPE_NUMERIC, - *TYPE_REGEXP; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; /************************************ * built-in additional field types * * They are not defined in SVr4 * ************************************/ -extern FIELDTYPE *TYPE_IPV4; /* Internet IP Version 4 address */ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ /*********************** * Default objects * ***********************/ -extern FORM *_nc_Default_Form; -extern FIELD *_nc_Default_Field; +extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; +extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; /*********************** * FIELDTYPE routines * ***********************/ -extern FIELDTYPE - *new_fieldtype( +extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check)(int,const void *)), *link_fieldtype(FIELDTYPE *,FIELDTYPE *); -extern int free_fieldtype(FIELDTYPE *), - set_fieldtype_arg(FIELDTYPE *, +extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, void * (* const make_arg)(va_list *), void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)), - set_fieldtype_choice (FIELDTYPE *, + void (* const free_arg)(void *)); +extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, bool (* const next_choice)(FIELD *,const void *), bool (* const prev_choice)(FIELD *,const void *)); /******************* * FIELD routines * *******************/ -extern FIELD *new_field(int,int,int,int,int,int), - *dup_field(FIELD *,int,int), - *link_field(FIELD *,int,int); - -extern int free_field(FIELD *), - field_info(const FIELD *,int *,int *,int *,int *,int *,int *), - dynamic_field_info(const FIELD *,int *,int *,int *), - set_max_field( FIELD *,int), - move_field(FIELD *,int,int), - set_field_type(FIELD *,FIELDTYPE *,...), - set_new_page(FIELD *,bool), - set_field_just(FIELD *,int), - field_just(const FIELD *), - set_field_fore(FIELD *,chtype), - set_field_back(FIELD *,chtype), - set_field_pad(FIELD *,int), - field_pad(const FIELD *), - set_field_buffer(FIELD *,int,const char *), - set_field_status(FIELD *,bool), - set_field_userptr(FIELD *, void *), - set_field_opts(FIELD *,Field_Options), - field_opts_on(FIELD *,Field_Options), - field_opts_off(FIELD *,Field_Options); - -extern chtype field_fore(const FIELD *), - field_back(const FIELD *); - -extern bool new_page(const FIELD *), - field_status(const FIELD *); - -extern void *field_arg(const FIELD *); - -extern void *field_userptr(const FIELD *); - -extern FIELDTYPE - *field_type(const FIELD *); - -extern char* field_buffer(const FIELD *,int); - -extern Field_Options - field_opts(const FIELD *); +extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern NCURSES_EXPORT(int) free_field (FIELD *); +extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); +extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); +extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); +extern NCURSES_EXPORT(int) field_just (const FIELD *); +extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); +extern NCURSES_EXPORT(int) field_pad (const FIELD *); +extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); +extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); +extern NCURSES_EXPORT(chtype) field_back (const FIELD *); + +extern NCURSES_EXPORT(bool) new_page (const FIELD *); +extern NCURSES_EXPORT(bool) field_status (const FIELD *); + +extern NCURSES_EXPORT(void *) field_arg (const FIELD *); + +extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); + +extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); + +extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); /****************** * FORM routines * ******************/ -extern FORM *new_form(FIELD **); - -extern FIELD **form_fields(const FORM *), - *current_field(const FORM *); - -extern WINDOW *form_win(const FORM *), - *form_sub(const FORM *); - -extern Form_Hook - form_init(const FORM *), - form_term(const FORM *), - field_init(const FORM *), - field_term(const FORM *); - -extern int free_form(FORM *), - set_form_fields(FORM *,FIELD **), - field_count(const FORM *), - set_form_win(FORM *,WINDOW *), - set_form_sub(FORM *,WINDOW *), - set_current_field(FORM *,FIELD *), - field_index(const FIELD *), - set_form_page(FORM *,int), - form_page(const FORM *), - scale_form(const FORM *,int *,int *), - set_form_init(FORM *,Form_Hook), - set_form_term(FORM *,Form_Hook), - set_field_init(FORM *,Form_Hook), - set_field_term(FORM *,Form_Hook), - post_form(FORM *), - unpost_form(FORM *), - pos_form_cursor(FORM *), - form_driver(FORM *,int), - set_form_userptr(FORM *,void *), - set_form_opts(FORM *,Form_Options), - form_opts_on(FORM *,Form_Options), - form_opts_off(FORM *,Form_Options), - form_request_by_name(const char *); - -extern const char - *form_request_name(int); - -extern void *form_userptr(const FORM *); - -extern Form_Options - form_opts(const FORM *); - -extern bool data_ahead(const FORM *), - data_behind(const FORM *); + +extern NCURSES_EXPORT(FORM *) new_form (FIELD **); + +extern NCURSES_EXPORT(FIELD **)form_fields (const FORM *); +extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); + +extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); +extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); + +extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); + +extern NCURSES_EXPORT(int) free_form (FORM *); +extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern NCURSES_EXPORT(int) field_count (const FORM *); +extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); +extern NCURSES_EXPORT(int) field_index (const FIELD *); +extern NCURSES_EXPORT(int) set_form_page (FORM *,int); +extern NCURSES_EXPORT(int) form_page (const FORM *); +extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); +extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) post_form (FORM *); +extern NCURSES_EXPORT(int) unpost_form (FORM *); +extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); +extern NCURSES_EXPORT(int) form_driver (FORM *,int); +extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); +extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name (const char *); + +extern NCURSES_EXPORT(const char *) form_request_name (int); + +extern NCURSES_EXPORT(void *) form_userptr (const FORM *); + +extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); + +extern NCURSES_EXPORT(bool) data_ahead (const FORM *); +extern NCURSES_EXPORT(bool) data_behind (const FORM *); #ifdef __cplusplus } diff --git a/lib/libform/form.priv.h b/lib/libform/form.priv.h index 39d8d4b1b9e..f2770a65642 100644 --- a/lib/libform/form.priv.h +++ b/lib/libform/form.priv.h @@ -1,7 +1,7 @@ -/* $OpenBSD: form.priv.h,v 1.5 1999/05/17 03:04:16 millert Exp $ */ +/* $OpenBSD: form.priv.h,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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 * @@ -112,19 +112,19 @@ typedef struct typearg { #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) -extern const FIELDTYPE* _nc_Default_FieldType; - -extern TypeArgument* _nc_Make_Argument(const FIELDTYPE*,va_list*,int*); -extern TypeArgument *_nc_Copy_Argument(const FIELDTYPE*,const TypeArgument*, int*); -extern void _nc_Free_Argument(const FIELDTYPE*,TypeArgument*); -extern bool _nc_Copy_Type(FIELD*, FIELD const *); -extern void _nc_Free_Type(FIELD *); - -extern int _nc_Synchronize_Attributes(FIELD*); -extern int _nc_Synchronize_Options(FIELD*,Field_Options); -extern int _nc_Set_Form_Page(FORM*,int,FIELD*); -extern int _nc_Refresh_Current_Field(FORM*); -extern FIELD* _nc_First_Active_Field(FORM*); -extern bool _nc_Internal_Validation(FORM*); -extern int _nc_Set_Current_Field(FORM*,FIELD*); -extern int _nc_Position_Form_Cursor(FORM*); +extern NCURSES_EXPORT_VAR(const FIELDTYPE *) _nc_Default_FieldType; + +extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*,va_list*,int*); +extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*,const TypeArgument*, int*); +extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*,TypeArgument*); +extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *); +extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *); + +extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*); +extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*,Field_Options); +extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*,int,FIELD*); +extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*); +extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); +extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*); +extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*,FIELD*); +extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*); diff --git a/lib/libform/frm_cursor.c b/lib/libform/frm_cursor.c index f1112a32f41..8eec04c5b46 100644 --- a/lib/libform/frm_cursor.c +++ b/lib/libform/frm_cursor.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_cursor.c,v 1.3 1999/05/17 03:04:16 millert Exp $ */ +/* $OpenBSD: frm_cursor.c,v 1.4 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: frm_cursor.c,v 1.4 1999/05/16 17:20:19 juergen Exp $") +MODULE_ID("$From: frm_cursor.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -49,7 +49,8 @@ MODULE_ID("$From: frm_cursor.c,v 1.4 1999/05/16 17:20:19 juergen Exp $") | E_BAD_ARGUMENT - Invalid form pointer | E_NOT_POSTED - Form is not posted +--------------------------------------------------------------------------*/ -int pos_form_cursor(FORM * form) +NCURSES_EXPORT(int) +pos_form_cursor (FORM * form) { int res; diff --git a/lib/libform/frm_data.c b/lib/libform/frm_data.c index 06f11ccd7c2..7f6dde0fd07 100644 --- a/lib/libform/frm_data.c +++ b/lib/libform/frm_data.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_data.c,v 1.5 1999/05/17 03:04:16 millert Exp $ */ +/* $OpenBSD: frm_data.c,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_data.c,v 1.6 1999/05/16 17:20:29 juergen Exp $") +MODULE_ID("$From: frm_data.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: frm_data.c,v 1.6 1999/05/16 17:20:29 juergen Exp $") | Return Values : TRUE - there are off-screen data behind | FALSE - there are no off-screen data behind +--------------------------------------------------------------------------*/ -bool data_behind(const FORM *form) +NCURSES_EXPORT(bool) +data_behind (const FORM *form) { bool result = FALSE; @@ -103,7 +104,8 @@ static char * After_Last_Non_Pad_Position(char *buffer, int len, int pad) | Return Values : TRUE - there are off-screen data ahead | FALSE - there are no off-screen data ahead +--------------------------------------------------------------------------*/ -bool data_ahead(const FORM *form) +NCURSES_EXPORT(bool) +data_ahead (const FORM *form) { bool result = FALSE; diff --git a/lib/libform/frm_def.c b/lib/libform/frm_def.c index 4678166e6d2..ac123147d4a 100644 --- a/lib/libform/frm_def.c +++ b/lib/libform/frm_def.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_def.c,v 1.5 1999/05/17 03:04:16 millert Exp $ */ +/* $OpenBSD: frm_def.c,v 1.6 2001/01/22 18:02:14 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_def.c,v 1.9 1999/05/16 17:20:43 juergen Exp $") +MODULE_ID("$From: frm_def.c,v 1.10 2000/12/10 02:09:38 tom Exp $") /* this can't be readonly */ static FORM default_form = { @@ -62,7 +62,7 @@ static FORM default_form = { NULL /* fieldterm */ }; -FORM *_nc_Default_Form = &default_form; +NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; /*--------------------------------------------------------------------------- | Facility : libnform @@ -271,7 +271,8 @@ INLINE static int Associate_Fields(FORM *form, FIELD **fields) | | Return Values : Pointer to form. NULL if error occured. +--------------------------------------------------------------------------*/ -FORM *new_form(FIELD ** fields) +NCURSES_EXPORT(FORM *) +new_form (FIELD ** fields) { int err = E_SYSTEM_ERROR; @@ -303,7 +304,8 @@ FORM *new_form(FIELD ** fields) | E_BAD_ARGUMENT - invalid form pointer | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int free_form(FORM * form) +NCURSES_EXPORT(int) +free_form (FORM * form) { if ( !form ) RETURN(E_BAD_ARGUMENT); @@ -329,7 +331,8 @@ int free_form(FORM * form) | E_BAD_ARGUMENT - invalid form pointer | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_fields(FORM * form, FIELD ** fields) +NCURSES_EXPORT(int) +set_form_fields (FORM * form, FIELD ** fields) { FIELD **old; int res; @@ -357,7 +360,8 @@ int set_form_fields(FORM * form, FIELD ** fields) | | Return Values : Pointer to field array +--------------------------------------------------------------------------*/ -FIELD **form_fields(const FORM * form) +NCURSES_EXPORT(FIELD **) +form_fields (const FORM * form) { return (Normalize_Form( form )->field); } @@ -370,7 +374,8 @@ FIELD **form_fields(const FORM * form) | | Return Values : Number of fields, -1 if none are defined +--------------------------------------------------------------------------*/ -int field_count(const FORM * form) +NCURSES_EXPORT(int) +field_count (const FORM * form) { return (Normalize_Form( form )->maxfield); } diff --git a/lib/libform/frm_driver.c b/lib/libform/frm_driver.c index 1e60d49de2b..f6178015d6d 100644 --- a/lib/libform/frm_driver.c +++ b/lib/libform/frm_driver.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_driver.c,v 1.6 1999/05/17 03:04:16 millert Exp $ */ +/* $OpenBSD: frm_driver.c,v 1.7 2001/01/22 18:02:15 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: frm_driver.c,v 1.35 1999/05/16 17:20:52 juergen Exp $") +MODULE_ID("$From: frm_driver.c,v 1.37 2000/12/10 02:09:38 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -560,8 +560,8 @@ static bool Field_Grown(FIELD * field, int amount) | E_SYSTEM_ERROR - form has no current field or | field-window +--------------------------------------------------------------------------*/ -int -_nc_Position_Form_Cursor(FORM * form) +NCURSES_EXPORT(int) +_nc_Position_Form_Cursor (FORM * form) { FIELD *field; WINDOW *formwin; @@ -601,8 +601,8 @@ _nc_Position_Form_Cursor(FORM * form) | E_BAD_ARGUMENT - invalid form pointer | E_SYSTEM_ERROR - general error +--------------------------------------------------------------------------*/ -int -_nc_Refresh_Current_Field(FORM * form) +NCURSES_EXPORT(int) +_nc_Refresh_Current_Field (FORM * form) { WINDOW *formwin; FIELD *field; @@ -959,7 +959,8 @@ static int Synchronize_Linked_Fields(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int _nc_Synchronize_Attributes(FIELD * field) +NCURSES_EXPORT(int) +_nc_Synchronize_Attributes (FIELD * field) { FORM *form; int res = E_OK; @@ -1017,8 +1018,9 @@ int _nc_Synchronize_Attributes(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int -_nc_Synchronize_Options(FIELD *field, Field_Options newopts) +NCURSES_EXPORT(int) +_nc_Synchronize_Options +(FIELD *field, Field_Options newopts) { Field_Options oldopts; Field_Options changed_opts; @@ -1115,8 +1117,9 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts) | E_BAD_ARGUMENT - invalid form or field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int -_nc_Set_Current_Field(FORM *form, FIELD *newfield) +NCURSES_EXPORT(int) +_nc_Set_Current_Field +(FORM *form, FIELD *newfield) { FIELD *field; WINDOW *new_window; @@ -2688,8 +2691,8 @@ static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -bool -_nc_Internal_Validation(FORM *form) +NCURSES_EXPORT(bool) +_nc_Internal_Validation (FORM *form) { FIELD *field; @@ -2778,8 +2781,8 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field) | | Return Values : Pointer to calculated field. +--------------------------------------------------------------------------*/ -FIELD* -_nc_First_Active_Field(FORM * form) +NCURSES_EXPORT(FIELD*) +_nc_First_Active_Field (FORM * form) { FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; FIELD *proposed = Next_Field_On_Page(*last_on_page); @@ -3285,8 +3288,9 @@ static int FN_Down_Field(FORM * form) | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -int -_nc_Set_Form_Page(FORM * form, int page, FIELD * field) +NCURSES_EXPORT(int) +_nc_Set_Form_Page +(FORM * form, int page, FIELD * field) { int res = E_OK; @@ -3639,7 +3643,8 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = | E_REQUEST_DENIED - request failed | E_UNKNOWN_COMMAND - command not known +--------------------------------------------------------------------------*/ -int form_driver(FORM * form, int c) +NCURSES_EXPORT(int) +form_driver (FORM * form, int c) { const Binding_Info* BI = (Binding_Info *)0; int res = E_UNKNOWN_COMMAND; @@ -3738,7 +3743,9 @@ int form_driver(FORM * form, int c) | E_BAD_ARGUMENT - invalid argument | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_buffer(FIELD * field, int buffer, const char * value) +NCURSES_EXPORT(int) +set_field_buffer +(FIELD * field, int buffer, const char * value) { char *s, *p; int res = E_OK; @@ -3780,7 +3787,7 @@ int set_field_buffer(FIELD * field, int buffer, const char * value) unsigned int i; for(i=len; i<vlen; i++) - if (!isprint(value[i])) + if (!isprint((unsigned char)value[i])) RETURN(E_BAD_ARGUMENT); } len = vlen; @@ -3834,7 +3841,8 @@ int set_field_buffer(FIELD * field, int buffer, const char * value) | | Return Values : Pointer to buffer or NULL if arguments were invalid. +--------------------------------------------------------------------------*/ -char *field_buffer(const FIELD * field, int buffer) +NCURSES_EXPORT(char *) +field_buffer (const FIELD * field, int buffer) { if (field && (buffer >= 0) && (buffer <= field->nbuf)) return Address_Of_Nth_Buffer(field,buffer); diff --git a/lib/libform/frm_hook.c b/lib/libform/frm_hook.c index 5378dcec0ec..8b4c3dfc8e5 100644 --- a/lib/libform/frm_hook.c +++ b/lib/libform/frm_hook.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_hook.c,v 1.5 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_hook.c,v 1.6 2001/01/22 18:02:15 millert Exp $ */ /**************************************************************************** - * 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,11 +34,11 @@ #include "form.priv.h" -MODULE_ID("$From: frm_hook.c,v 1.8 1999/05/16 17:21:04 juergen Exp $") +MODULE_ID("$From: frm_hook.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ -int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ +NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ {\ (Normalize_Form( form ) -> typ ## name) = func ;\ RETURN(E_OK);\ @@ -46,7 +46,7 @@ int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ /* "Template" macro to generate function to get application specific hook */ #define GEN_HOOK_GET_FUNCTION( typ, name ) \ -Form_Hook typ ## _ ## name ( const FORM *form )\ +NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ {\ return ( Normalize_Form( form ) -> typ ## name );\ } diff --git a/lib/libform/frm_opts.c b/lib/libform/frm_opts.c index 813f083c815..300493d518e 100644 --- a/lib/libform/frm_opts.c +++ b/lib/libform/frm_opts.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_opts.c,v 1.6 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_opts.c,v 1.7 2001/01/22 18:02:15 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_opts.c,v 1.8 1999/05/16 17:38:05 juergen Exp $") +MODULE_ID("$From: frm_opts.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: frm_opts.c,v 1.8 1999/05/16 17:38:05 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int set_form_opts(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +set_form_opts (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) @@ -66,7 +67,8 @@ int set_form_opts(FORM * form, Form_Options opts) | | Return Values : The option flags. +--------------------------------------------------------------------------*/ -Form_Options form_opts(const FORM * form) +NCURSES_EXPORT(Form_Options) +form_opts (const FORM * form) { return (Normalize_Form(form)->opts & ALL_FORM_OPTS); } @@ -81,7 +83,8 @@ Form_Options form_opts(const FORM * form) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_on(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +form_opts_on (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) @@ -103,7 +106,8 @@ int form_opts_on(FORM * form, Form_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_off(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +form_opts_off (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) diff --git a/lib/libform/frm_page.c b/lib/libform/frm_page.c index fc75138c0bd..fbad21e25cf 100644 --- a/lib/libform/frm_page.c +++ b/lib/libform/frm_page.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_page.c,v 1.3 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_page.c,v 1.4 2001/01/22 18:02:15 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_page.c,v 1.5 1999/05/16 17:21:26 juergen Exp $") +MODULE_ID("$From: frm_page.c,v 1.6 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,7 +48,8 @@ MODULE_ID("$From: frm_page.c,v 1.5 1999/05/16 17:21:26 juergen Exp $") | E_INVALID_FIELD - current field can't be left | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_form_page(FORM * form, int page) +NCURSES_EXPORT(int) +set_form_page (FORM * form, int page) { int err = E_OK; @@ -94,7 +95,8 @@ int set_form_page(FORM * form, int page) | Return Values : >= 0 : current page number | -1 : invalid form pointer +--------------------------------------------------------------------------*/ -int form_page(const FORM * form) +NCURSES_EXPORT(int) +form_page (const FORM * form) { return Normalize_Form(form)->curpage; } diff --git a/lib/libform/frm_post.c b/lib/libform/frm_post.c index 7ad1db1b543..4027c5f29f8 100644 --- a/lib/libform/frm_post.c +++ b/lib/libform/frm_post.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_post.c,v 1.3 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_post.c,v 1.4 2001/01/22 18:02:15 millert Exp $ */ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$From: frm_post.c,v 1.4 1999/05/16 17:21:39 juergen Exp $") +MODULE_ID("$From: frm_post.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,7 +48,8 @@ MODULE_ID("$From: frm_post.c,v 1.4 1999/05/16 17:21:39 juergen Exp $") | E_NO_ROOM - form doesn't fit into subwindow | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int post_form(FORM * form) +NCURSES_EXPORT(int) +post_form (FORM * form) { WINDOW *formwin; int err; @@ -95,7 +96,8 @@ int post_form(FORM * form) | E_NOT_POSTED - form isn't posted | E_BAD_STATE - called from a hook routine +--------------------------------------------------------------------------*/ -int unpost_form(FORM * form) +NCURSES_EXPORT(int) +unpost_form (FORM * form) { if (!form) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/frm_req_name.c b/lib/libform/frm_req_name.c index a97e9bae69e..069fe6df1d6 100644 --- a/lib/libform/frm_req_name.c +++ b/lib/libform/frm_req_name.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_req_name.c,v 1.4 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_req_name.c,v 1.5 2001/01/22 18:02:16 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_req_name.c,v 1.7 1999/05/16 17:21:53 juergen Exp $") +MODULE_ID("$From: frm_req_name.c,v 1.8 2000/12/10 02:09:37 tom Exp $") static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { "NEXT_PAGE" , @@ -115,7 +115,8 @@ static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { | Return Values : Pointer to name - on success | NULL - on invalid request code +--------------------------------------------------------------------------*/ -const char *form_request_name( int request ) +NCURSES_EXPORT(const char *) +form_request_name ( int request ) { if ( (request < MIN_FORM_COMMAND) || (request > MAX_FORM_COMMAND) ) { @@ -136,7 +137,8 @@ const char *form_request_name( int request ) | Return Values : Request Id - on success | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ -int form_request_by_name( const char *str ) +NCURSES_EXPORT(int) +form_request_by_name ( const char *str ) { /* because the table is so small, it doesn't really hurt to run sequentially through it. diff --git a/lib/libform/frm_scale.c b/lib/libform/frm_scale.c index 207fedd8ef7..45ef3c1c8a3 100644 --- a/lib/libform/frm_scale.c +++ b/lib/libform/frm_scale.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_scale.c,v 1.3 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_scale.c,v 1.4 2001/01/22 18:02:16 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_scale.c,v 1.4 1999/05/16 17:22:02 juergen Exp $") +MODULE_ID("$From: frm_scale.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$From: frm_scale.c,v 1.4 1999/05/16 17:22:02 juergen Exp $") | E_BAD_ARGUMENT - invalid form pointer | E_NOT_CONNECTED - no fields connected to form +--------------------------------------------------------------------------*/ -int scale_form(const FORM * form, int * rows, int * cols) +NCURSES_EXPORT(int) +scale_form (const FORM * form, int * rows, int * cols) { if ( !form ) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libform/frm_sub.c b/lib/libform/frm_sub.c index e0c8b48c137..6a6f50278b5 100644 --- a/lib/libform/frm_sub.c +++ b/lib/libform/frm_sub.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_sub.c,v 1.3 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_sub.c,v 1.4 2001/01/22 18:02:16 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_sub.c,v 1.4 1999/05/16 17:22:11 juergen Exp $") +MODULE_ID("$From: frm_sub.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$From: frm_sub.c,v 1.4 1999/05/16 17:22:11 juergen Exp $") | Return Values : E_OK - success | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_sub(FORM * form, WINDOW * win) +NCURSES_EXPORT(int) +set_form_sub (FORM * form, WINDOW * win) { if (form && (form->status & _POSTED)) RETURN(E_POSTED); @@ -62,7 +63,8 @@ int set_form_sub(FORM * form, WINDOW * win) | | Return Values : The pointer to the Subwindow. +--------------------------------------------------------------------------*/ -WINDOW *form_sub(const FORM * form) +NCURSES_EXPORT(WINDOW *) +form_sub (const FORM * form) { const FORM* f = Normalize_Form( form ); return Get_Form_Window(f); diff --git a/lib/libform/frm_user.c b/lib/libform/frm_user.c index dfb583dd080..96bfab481ab 100644 --- a/lib/libform/frm_user.c +++ b/lib/libform/frm_user.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_user.c,v 1.5 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_user.c,v 1.6 2001/01/22 18:02:16 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_user.c,v 1.8 1999/05/16 17:22:21 juergen Exp $") +MODULE_ID("$From: frm_user.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$From: frm_user.c,v 1.8 1999/05/16 17:22:21 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_form_userptr(FORM * form, void *usrptr) +NCURSES_EXPORT(int) +set_form_userptr (FORM * form, void *usrptr) { Normalize_Form(form)->usrptr = usrptr; RETURN(E_OK); @@ -61,7 +62,8 @@ int set_form_userptr(FORM * form, void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *form_userptr(const FORM * form) +NCURSES_EXPORT(void *) +form_userptr (const FORM * form) { return Normalize_Form(form)->usrptr; } diff --git a/lib/libform/frm_win.c b/lib/libform/frm_win.c index a850e1c4832..d428b6d274c 100644 --- a/lib/libform/frm_win.c +++ b/lib/libform/frm_win.c @@ -1,7 +1,7 @@ -/* $OpenBSD: frm_win.c,v 1.5 1999/05/17 03:04:17 millert Exp $ */ +/* $OpenBSD: frm_win.c,v 1.6 2001/01/22 18:02:16 millert Exp $ */ /**************************************************************************** - * 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,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$From: frm_win.c,v 1.8 1999/05/16 17:22:32 juergen Exp $") +MODULE_ID("$From: frm_win.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$From: frm_win.c,v 1.8 1999/05/16 17:22:32 juergen Exp $") | Return Values : E_OK - success | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_win(FORM * form, WINDOW * win) +NCURSES_EXPORT(int) +set_form_win (FORM * form, WINDOW * win) { if (form && (form->status & _POSTED)) RETURN(E_POSTED); @@ -62,7 +63,8 @@ int set_form_win(FORM * form, WINDOW * win) | | Return Values : The pointer to the Window or stdscr if there is none. +--------------------------------------------------------------------------*/ -WINDOW *form_win(const FORM * form) +NCURSES_EXPORT(WINDOW *) +form_win (const FORM * form) { const FORM* f = Normalize_Form( form ); return (f->win ? f->win : stdscr); diff --git a/lib/libform/fty_alnum.c b/lib/libform/fty_alnum.c index 1dcb080a630..7fb7ee74d2b 100644 --- a/lib/libform/fty_alnum.c +++ b/lib/libform/fty_alnum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_alnum.c,v 1.5 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: fty_alnum.c,v 1.6 2001/01/22 18:02:16 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_alnum.c,v 1.9 1999/05/16 17:22:49 juergen Exp $") +MODULE_ID("$From: fty_alnum.c,v 1.10 2000/12/09 23:46:12 tom Exp $") typedef struct { int width; @@ -134,6 +134,6 @@ static FIELDTYPE typeALNUM = { NULL }; -FIELDTYPE* TYPE_ALNUM = &typeALNUM; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeALNUM; /* fty_alnum.c ends here */ diff --git a/lib/libform/fty_alpha.c b/lib/libform/fty_alpha.c index f955a2bf1a0..579a675c575 100644 --- a/lib/libform/fty_alpha.c +++ b/lib/libform/fty_alpha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_alpha.c,v 1.5 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: fty_alpha.c,v 1.6 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_alpha.c,v 1.9 1999/05/16 17:22:58 juergen Exp $") +MODULE_ID("$From: fty_alpha.c,v 1.10 2000/12/09 23:46:12 tom Exp $") typedef struct { int width; @@ -135,6 +135,6 @@ static FIELDTYPE typeALPHA = { NULL }; -FIELDTYPE* TYPE_ALPHA = &typeALPHA; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeALPHA; /* fty_alpha.c ends here */ diff --git a/lib/libform/fty_enum.c b/lib/libform/fty_enum.c index 42aebc38098..adf61a7c384 100644 --- a/lib/libform/fty_enum.c +++ b/lib/libform/fty_enum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_enum.c,v 1.8 2000/10/22 18:27:24 millert Exp $ */ +/* $OpenBSD: fty_enum.c,v 1.9 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_enum.c,v 1.14 2000/10/18 09:28:19 juergen Exp $") +MODULE_ID("$From: fty_enum.c,v 1.15 2000/12/09 23:46:12 tom Exp $") typedef struct { char **kwds; @@ -292,6 +292,6 @@ static FIELDTYPE typeENUM = { Previous_Enum }; -FIELDTYPE* TYPE_ENUM = &typeENUM; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM = &typeENUM; /* fty_enum.c ends here */ diff --git a/lib/libform/fty_int.c b/lib/libform/fty_int.c index 741e12979b7..cc6dc34d3bd 100644 --- a/lib/libform/fty_int.c +++ b/lib/libform/fty_int.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_int.c,v 1.5 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: fty_int.c,v 1.6 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_int.c,v 1.10 1999/05/16 17:23:22 juergen Exp $") +MODULE_ID("$From: fty_int.c,v 1.11 2000/12/09 23:46:12 tom Exp $") typedef struct { int precision; @@ -157,6 +157,6 @@ static FIELDTYPE typeINTEGER = { NULL }; -FIELDTYPE* TYPE_INTEGER = &typeINTEGER; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeINTEGER; /* fty_int.c ends here */ diff --git a/lib/libform/fty_ipv4.c b/lib/libform/fty_ipv4.c index 8f0badd15af..162c96f9090 100644 --- a/lib/libform/fty_ipv4.c +++ b/lib/libform/fty_ipv4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_ipv4.c,v 1.3 1998/07/24 02:37:46 millert Exp $ */ +/* $OpenBSD: fty_ipv4.c,v 1.4 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_ipv4.c,v 1.2 1997/04/26 22:06:00 tom Exp $") +MODULE_ID("$From: fty_ipv4.c,v 1.4 2000/12/09 23:46:12 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -34,13 +34,13 @@ static bool Check_IPV4_Field(FIELD * field, const void * argp GCC_UNUSED) int num = 0, len; unsigned int d1, d2, d3, d4; - if(isdigit(*bp)) /* Must start with digit */ + if(isdigit((unsigned char)*bp)) /* Must start with digit */ { num = sscanf(bp, "%u.%u.%u.%u%n", &d1, &d2, &d3, &d4, &len); if (num == 4) { bp += len; /* Make bp point to what sscanf() left */ - while (*bp && isspace(*bp)) + while (*bp && isspace((unsigned char)*bp)) bp++; /* Allow trailing whitespace */ } } @@ -78,6 +78,6 @@ static FIELDTYPE typeIPV4 = { NULL }; -FIELDTYPE* TYPE_IPV4 = &typeIPV4; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4; /* fty_ipv4.c ends here */ diff --git a/lib/libform/fty_num.c b/lib/libform/fty_num.c index f0b72d1a599..7e3b76fc367 100644 --- a/lib/libform/fty_num.c +++ b/lib/libform/fty_num.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_num.c,v 1.5 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: fty_num.c,v 1.6 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_num.c,v 1.13 1999/05/16 17:23:30 juergen Exp $") +MODULE_ID("$From: fty_num.c,v 1.14 2000/12/09 23:46:12 tom Exp $") #if HAVE_LOCALE_H #include <locale.h> @@ -192,6 +192,6 @@ static FIELDTYPE typeNUMERIC = { NULL }; -FIELDTYPE* TYPE_NUMERIC = &typeNUMERIC; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeNUMERIC; /* fty_num.c ends here */ diff --git a/lib/libform/fty_regex.c b/lib/libform/fty_regex.c index fad041867ad..8910777da19 100644 --- a/lib/libform/fty_regex.c +++ b/lib/libform/fty_regex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fty_regex.c,v 1.6 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: fty_regex.c,v 1.7 2001/01/22 18:02:17 millert Exp $ */ /* @@ -15,7 +15,7 @@ #include "form.priv.h" -MODULE_ID("$From: fty_regex.c,v 1.14 1999/05/16 17:23:38 juergen Exp $") +MODULE_ID("$From: fty_regex.c,v 1.15 2000/12/09 23:46:12 tom Exp $") #if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ #include <regex.h> @@ -254,6 +254,6 @@ static FIELDTYPE typeREGEXP = { NULL }; -FIELDTYPE* TYPE_REGEXP = &typeREGEXP; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP; /* fty_regex.c ends here */ diff --git a/lib/libmenu/m_attribs.c b/lib/libmenu/m_attribs.c index 053e50071f2..2008b8ec113 100644 --- a/lib/libmenu/m_attribs.c +++ b/lib/libmenu/m_attribs.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_attribs.c,v 1.5 1999/05/17 03:04:18 millert Exp $ */ +/* $OpenBSD: m_attribs.c,v 1.6 2001/01/22 18:02:02 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_attribs.c,v 1.8 1999/05/16 17:24:24 juergen Exp $") +MODULE_ID("$From: m_attribs.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -51,7 +51,7 @@ MODULE_ID("$From: m_attribs.c,v 1.8 1999/05/16 17:24:24 juergen Exp $") /* "Template" macro to generate a function to set a menus attribute */ #define GEN_MENU_ATTR_SET_FCT( name ) \ -int set_menu_ ## name (MENU * menu, chtype attr)\ +NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\ {\ if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ RETURN(E_BAD_ARGUMENT);\ @@ -66,7 +66,7 @@ int set_menu_ ## name (MENU * menu, chtype attr)\ /* "Template" macro to generate a function to get a menus attribute */ #define GEN_MENU_ATTR_GET_FCT( name ) \ -chtype menu_ ## name (const MENU * menu)\ +NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\ {\ return (Normalize_Menu( menu ) -> name);\ } diff --git a/lib/libmenu/m_cursor.c b/lib/libmenu/m_cursor.c index 166a01d58af..4562a46efec 100644 --- a/lib/libmenu/m_cursor.c +++ b/lib/libmenu/m_cursor.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_cursor.c,v 1.6 1999/05/17 03:04:19 millert Exp $ */ +/* $OpenBSD: m_cursor.c,v 1.7 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_cursor.c,v 1.13 1999/05/16 17:24:43 juergen Exp $") +MODULE_ID("$From: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,9 +51,9 @@ MODULE_ID("$From: m_cursor.c,v 1.13 1999/05/16 17:24:43 juergen Exp $") | E_BAD_ARGUMENT - invalid menu | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ -int _nc_menu_cursor_pos(const MENU* menu, - const ITEM* item, - int* pY, int* pX) +NCURSES_EXPORT(int) +_nc_menu_cursor_pos +(const MENU* menu, const ITEM* item, int* pY, int* pX) { if (!menu || !pX || !pY) return(E_BAD_ARGUMENT); @@ -82,7 +82,8 @@ int _nc_menu_cursor_pos(const MENU* menu, | E_BAD_ARGUMENT - invalid menu | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ -int pos_menu_cursor(const MENU * menu) +NCURSES_EXPORT(int) +pos_menu_cursor (const MENU * menu) { WINDOW *win, *sub; int x, y; diff --git a/lib/libmenu/m_driver.c b/lib/libmenu/m_driver.c index 7fb3f079772..ccf9a82c9c8 100644 --- a/lib/libmenu/m_driver.c +++ b/lib/libmenu/m_driver.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_driver.c,v 1.6 1999/05/17 03:04:20 millert Exp $ */ +/* $OpenBSD: m_driver.c,v 1.7 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_driver.c,v 1.17 1999/05/16 17:24:55 juergen Exp $") +MODULE_ID("$From: m_driver.c,v 1.18 2000/12/10 02:16:48 tom Exp $") /* Macros */ @@ -113,7 +113,9 @@ static bool Is_Sub_String( | Return Values : E_OK - an item matching the pattern was found | E_NO_MATCH - nothing found +--------------------------------------------------------------------------*/ -int _nc_Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) +NCURSES_EXPORT(int) +_nc_Match_Next_Character_In_Item_Name +(MENU *menu, int ch, ITEM **item) { bool found = FALSE, passed = FALSE; int idx, last; @@ -200,7 +202,8 @@ int _nc_Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) | E_BAD_STATE - menu is in user hook routine | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ -int menu_driver(MENU * menu, int c) +NCURSES_EXPORT(int) +menu_driver (MENU * menu, int c) { #define NAVIGATE(dir) \ if (!item->dir)\ diff --git a/lib/libmenu/m_format.c b/lib/libmenu/m_format.c index 128954ada1b..8a16f001b9a 100644 --- a/lib/libmenu/m_format.c +++ b/lib/libmenu/m_format.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_format.c,v 1.5 1999/05/17 03:04:21 millert Exp $ */ +/* $OpenBSD: m_format.c,v 1.6 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_format.c,v 1.9 1999/05/16 17:25:04 juergen Exp $") +MODULE_ID("$From: m_format.c,v 1.10 2000/12/10 02:16:48 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) @@ -57,7 +57,8 @@ MODULE_ID("$From: m_format.c,v 1.9 1999/05/16 17:25:04 juergen Exp $") | E_NOT_CONNECTED - there are no items connected | E_POSTED - the menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_format(MENU *menu, int rows, int cols) +NCURSES_EXPORT(int) +set_menu_format (MENU *menu, int rows, int cols) { int total_rows, total_cols; @@ -116,7 +117,8 @@ int set_menu_format(MENU *menu, int rows, int cols) | | Return Values : - +--------------------------------------------------------------------------*/ -void menu_format(const MENU *menu, int *rows, int *cols) +NCURSES_EXPORT(void) +menu_format (const MENU *menu, int *rows, int *cols) { if (rows) *rows = Normalize_Menu(menu)->frows; diff --git a/lib/libmenu/m_global.c b/lib/libmenu/m_global.c index 9ae284b2f47..fa7392cdd2c 100644 --- a/lib/libmenu/m_global.c +++ b/lib/libmenu/m_global.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_global.c,v 1.5 1999/05/17 03:04:22 millert Exp $ */ +/* $OpenBSD: m_global.c,v 1.6 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,9 +39,9 @@ #include "menu.priv.h" -MODULE_ID("$From: m_global.c,v 1.11 1999/05/16 17:25:14 juergen Exp $") +MODULE_ID("$From: m_global.c,v 1.12 2000/12/10 02:16:48 tom Exp $") -MENU _nc_Default_Menu = { +NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { 16, /* Nr. of chars high */ 1, /* Nr. of chars wide */ 16, /* Nr. of items high */ @@ -80,7 +80,7 @@ MENU _nc_Default_Menu = { 0 /* status */ }; -ITEM _nc_Default_Item = { +NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { { (char *)0, 0 }, /* name */ { (char *)0, 0 }, /* description */ (MENU *)0, /* Pointer to parent menu */ @@ -163,7 +163,8 @@ INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items) | Return Values : TRUE - successfull connection | FALSE - connection failed +--------------------------------------------------------------------------*/ -bool _nc_Connect_Items(MENU *menu, ITEM **items) +NCURSES_EXPORT(bool) +_nc_Connect_Items (MENU *menu, ITEM **items) { ITEM **item; unsigned int ItemCount = 0; @@ -224,7 +225,8 @@ bool _nc_Connect_Items(MENU *menu, ITEM **items) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Disconnect_Items(MENU * menu) +NCURSES_EXPORT(void) +_nc_Disconnect_Items (MENU * menu) { if (menu && menu->items) ResetConnectionInfo( menu, menu->items ); @@ -239,7 +241,8 @@ void _nc_Disconnect_Items(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Calculate_Item_Length_and_Width(MENU * menu) +NCURSES_EXPORT(void) +_nc_Calculate_Item_Length_and_Width (MENU * menu) { int l; @@ -267,7 +270,8 @@ void _nc_Calculate_Item_Length_and_Width(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Link_Items(MENU * menu) +NCURSES_EXPORT(void) +_nc_Link_Items (MENU * menu) { if (menu && menu->items && *(menu->items)) { @@ -393,7 +397,8 @@ void _nc_Link_Items(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Show_Menu(const MENU *menu) +NCURSES_EXPORT(void) +_nc_Show_Menu (const MENU *menu) { WINDOW *win; int maxy, maxx; @@ -432,8 +437,9 @@ void _nc_Show_Menu(const MENU *menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_New_TopRow_and_CurrentItem(MENU *menu, int new_toprow, - ITEM *new_current_item) +NCURSES_EXPORT(void) +_nc_New_TopRow_and_CurrentItem +(MENU *menu, int new_toprow, ITEM *new_current_item) { ITEM *cur_item; bool mterm_called = FALSE; diff --git a/lib/libmenu/m_hook.c b/lib/libmenu/m_hook.c index 539b946d7fd..11b62354d13 100644 --- a/lib/libmenu/m_hook.c +++ b/lib/libmenu/m_hook.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_hook.c,v 1.5 1999/05/17 03:04:23 millert Exp $ */ +/* $OpenBSD: m_hook.c,v 1.6 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,11 +39,11 @@ #include "menu.priv.h" -MODULE_ID("$From: m_hook.c,v 1.8 1999/05/16 17:25:24 juergen Exp $") +MODULE_ID("$From: m_hook.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ -int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ +NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ {\ (Normalize_Menu(menu) -> typ ## name = func );\ RETURN(E_OK);\ @@ -51,7 +51,7 @@ int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ /* "Template" macro to generate function to get application specific hook */ #define GEN_HOOK_GET_FUNCTION( typ, name ) \ -Menu_Hook typ ## _ ## name ( const MENU *menu )\ +NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\ {\ return (Normalize_Menu(menu) -> typ ## name);\ } diff --git a/lib/libmenu/m_item_cur.c b/lib/libmenu/m_item_cur.c index 43e0969ac3e..25be32ff9f0 100644 --- a/lib/libmenu/m_item_cur.c +++ b/lib/libmenu/m_item_cur.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_cur.c,v 1.5 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_cur.c,v 1.6 2001/01/22 18:02:03 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_cur.c,v 1.11 1999/05/16 17:25:34 juergen Exp $") +MODULE_ID("$From: m_item_cur.c,v 1.12 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,7 +49,8 @@ MODULE_ID("$From: m_item_cur.c,v 1.11 1999/05/16 17:25:34 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_current_item(MENU * menu, ITEM * item) +NCURSES_EXPORT(int) +set_current_item (MENU * menu, ITEM * item) { if (menu && item && (item->imenu==menu)) { @@ -87,7 +88,8 @@ int set_current_item(MENU * menu, ITEM * item) | | Return Values : Item pointer or NULL if failure +--------------------------------------------------------------------------*/ -ITEM *current_item(const MENU * menu) +NCURSES_EXPORT(ITEM *) +current_item (const MENU * menu) { return (menu && menu->items) ? menu->curitem : (ITEM *)0; } @@ -100,7 +102,8 @@ ITEM *current_item(const MENU * menu) | | Return Values : The index or ERR if this is an invalid item pointer +--------------------------------------------------------------------------*/ -int item_index(const ITEM *item) +NCURSES_EXPORT(int) +item_index (const ITEM *item) { return (item && item->imenu) ? item->index : ERR; } diff --git a/lib/libmenu/m_item_nam.c b/lib/libmenu/m_item_nam.c index 75ff466fb6b..2a882146737 100644 --- a/lib/libmenu/m_item_nam.c +++ b/lib/libmenu/m_item_nam.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_nam.c,v 1.5 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_nam.c,v 1.6 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_nam.c,v 1.9 1999/05/16 17:25:43 juergen Exp $") +MODULE_ID("$From: m_item_nam.c,v 1.10 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,7 +49,8 @@ MODULE_ID("$From: m_item_nam.c,v 1.9 1999/05/16 17:25:43 juergen Exp $") | | Return Values : See above; returns NULL if item is invalid +--------------------------------------------------------------------------*/ -const char *item_name(const ITEM * item) +NCURSES_EXPORT(const char *) +item_name (const ITEM * item) { return ((item) ? item->name.str : (char *)0); } @@ -62,7 +63,8 @@ const char *item_name(const ITEM * item) | | Return Values : See above; Returns NULL if item is invalid +--------------------------------------------------------------------------*/ -const char *item_description(const ITEM * item) +NCURSES_EXPORT(const char *) +item_description (const ITEM * item) { return ((item) ? item->description.str : (char *)0); } diff --git a/lib/libmenu/m_item_new.c b/lib/libmenu/m_item_new.c index 112390bdd8a..fd3dc1c07b5 100644 --- a/lib/libmenu/m_item_new.c +++ b/lib/libmenu/m_item_new.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_new.c,v 1.6 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_new.c,v 1.7 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -40,7 +40,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_new.c,v 1.11 1999/05/16 17:28:49 juergen Exp $") +MODULE_ID("$From: m_item_new.c,v 1.12 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -74,7 +74,8 @@ static bool Is_Printable_String(const char *s) | | Return Values : The item pointer or NULL if creation failed. +--------------------------------------------------------------------------*/ -ITEM *new_item(const char *name, const char *description) +NCURSES_EXPORT(ITEM *) +new_item (const char *name, const char *description) { ITEM *item; @@ -122,7 +123,8 @@ ITEM *new_item(const char *name, const char *description) | E_BAD_ARGUMENT - invalid value has been passed | E_CONNECTED - item is still connected to a menu +--------------------------------------------------------------------------*/ -int free_item(ITEM * item) +NCURSES_EXPORT(int) +free_item (ITEM * item) { if (!item) RETURN( E_BAD_ARGUMENT ); @@ -152,7 +154,8 @@ int free_item(ITEM * item) | E_BAD_ARGUMENT - an invalid value has been passed | E_SYSTEM_ERROR - no memory to store mark +--------------------------------------------------------------------------*/ -int set_menu_mark(MENU * menu, const char * mark) +NCURSES_EXPORT(int) +set_menu_mark (MENU * menu, const char * mark) { int l; @@ -221,7 +224,8 @@ int set_menu_mark(MENU * menu, const char * mark) | | Return Values : The marker string pointer or NULL if no marker defined +--------------------------------------------------------------------------*/ -const char *menu_mark(const MENU * menu) +NCURSES_EXPORT(const char *) +menu_mark (const MENU * menu) { return Normalize_Menu( menu )->mark; } diff --git a/lib/libmenu/m_item_opt.c b/lib/libmenu/m_item_opt.c index 1d3375b61db..1ee8f030f18 100644 --- a/lib/libmenu/m_item_opt.c +++ b/lib/libmenu/m_item_opt.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_opt.c,v 1.7 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_opt.c,v 1.8 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_opt.c,v 1.10 1999/05/16 17:25:52 juergen Exp $") +MODULE_ID("$From: m_item_opt.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$From: m_item_opt.c,v 1.10 1999/05/16 17:25:52 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid item options +--------------------------------------------------------------------------*/ -int set_item_opts(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +set_item_opts (ITEM *item, Item_Options opts) { opts &= ALL_ITEM_OPTS; @@ -92,7 +93,8 @@ int set_item_opts(ITEM *item, Item_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int item_opts_off(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +item_opts_off (ITEM *item, Item_Options opts) { ITEM *citem = item; /* use a copy because set_item_opts must detect NULL item itself to adjust its behaviour */ @@ -116,7 +118,8 @@ int item_opts_off(ITEM *item, Item_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int item_opts_on(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +item_opts_on (ITEM *item, Item_Options opts) { ITEM *citem = item; /* use a copy because set_item_opts must detect NULL item itself to adjust its behaviour */ @@ -140,7 +143,8 @@ int item_opts_on(ITEM *item, Item_Options opts) | | Return Values : Items options +--------------------------------------------------------------------------*/ -Item_Options item_opts(const ITEM * item) +NCURSES_EXPORT(Item_Options) +item_opts (const ITEM * item) { return (ALL_ITEM_OPTS & Normalize_Item(item)->opt); } diff --git a/lib/libmenu/m_item_top.c b/lib/libmenu/m_item_top.c index 1cce5f31d89..2a492ad986c 100644 --- a/lib/libmenu/m_item_top.c +++ b/lib/libmenu/m_item_top.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_top.c,v 1.3 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_top.c,v 1.4 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_top.c,v 1.4 1999/05/16 17:26:01 juergen Exp $") +MODULE_ID("$From: m_item_top.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,7 +51,8 @@ MODULE_ID("$From: m_item_top.c,v 1.4 1999/05/16 17:26:01 juergen Exp $") | E_BAD_ARGUMENT - not a menu pointer or invalid row | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ -int set_top_row(MENU * menu, int row) +NCURSES_EXPORT(int) +set_top_row (MENU * menu, int row) { ITEM *item; @@ -90,7 +91,8 @@ int set_top_row(MENU * menu, int row) | | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ -int top_row(const MENU * menu) +NCURSES_EXPORT(int) +top_row (const MENU * menu) { if (menu && menu->items && *(menu->items)) { diff --git a/lib/libmenu/m_item_use.c b/lib/libmenu/m_item_use.c index e6c5ce9dc41..b7fcd8633b0 100644 --- a/lib/libmenu/m_item_use.c +++ b/lib/libmenu/m_item_use.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_use.c,v 1.5 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_use.c,v 1.6 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_use.c,v 1.10 1999/05/16 17:26:11 juergen Exp $") +MODULE_ID("$From: m_item_use.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$From: m_item_use.c,v 1.10 1999/05/16 17:26:11 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_item_userptr(ITEM * item, void * userptr) +NCURSES_EXPORT(int) +set_item_userptr (ITEM * item, void * userptr) { Normalize_Item(item)->userptr = userptr; RETURN( E_OK ); @@ -66,7 +67,8 @@ int set_item_userptr(ITEM * item, void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned. +--------------------------------------------------------------------------*/ -void *item_userptr(const ITEM * item) +NCURSES_EXPORT(void *) +item_userptr (const ITEM * item) { return Normalize_Item(item)->userptr; } diff --git a/lib/libmenu/m_item_val.c b/lib/libmenu/m_item_val.c index cda27fbeeae..939ebd76fb5 100644 --- a/lib/libmenu/m_item_val.c +++ b/lib/libmenu/m_item_val.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_val.c,v 1.5 1999/05/17 03:04:24 millert Exp $ */ +/* $OpenBSD: m_item_val.c,v 1.6 2001/01/22 18:02:04 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_val.c,v 1.8 1999/05/16 17:26:20 juergen Exp $") +MODULE_ID("$From: m_item_val.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -54,7 +54,8 @@ MODULE_ID("$From: m_item_val.c,v 1.8 1999/05/16 17:26:20 juergen Exp $") | Return Values : E_OK - success | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ -int set_item_value(ITEM *item, bool value) +NCURSES_EXPORT(int) +set_item_value (ITEM *item, bool value) { MENU *menu; @@ -94,7 +95,8 @@ int set_item_value(ITEM *item, bool value) | Return Values : TRUE - if item is selected | FALSE - if item is not selected +--------------------------------------------------------------------------*/ -bool item_value(const ITEM *item) +NCURSES_EXPORT(bool) +item_value (const ITEM *item) { return ((Normalize_Item(item)->value) ? TRUE : FALSE); } diff --git a/lib/libmenu/m_item_vis.c b/lib/libmenu/m_item_vis.c index 2dcf21a15a9..9fbe0fcc874 100644 --- a/lib/libmenu/m_item_vis.c +++ b/lib/libmenu/m_item_vis.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_item_vis.c,v 1.5 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_item_vis.c,v 1.6 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_item_vis.c,v 1.10 1999/05/16 17:26:34 juergen Exp $") +MODULE_ID("$From: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,7 +51,8 @@ MODULE_ID("$From: m_item_vis.c,v 1.10 1999/05/16 17:26:34 juergen Exp $") | Return Values : TRUE if visible | FALSE if invisible +--------------------------------------------------------------------------*/ -bool item_visible(const ITEM * item) +NCURSES_EXPORT(bool) +item_visible (const ITEM * item) { MENU *menu; diff --git a/lib/libmenu/m_items.c b/lib/libmenu/m_items.c index be6682562f9..133b1534003 100644 --- a/lib/libmenu/m_items.c +++ b/lib/libmenu/m_items.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_items.c,v 1.5 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_items.c,v 1.6 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_items.c,v 1.8 1999/05/16 17:26:50 juergen Exp $") +MODULE_ID("$From: m_items.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -54,7 +54,8 @@ MODULE_ID("$From: m_items.c,v 1.8 1999/05/16 17:26:50 juergen Exp $") | E_BAD_ARGUMENT - An incorrect menu or item array was | passed to the function +--------------------------------------------------------------------------*/ -int set_menu_items(MENU * menu, ITEM ** items) +NCURSES_EXPORT(int) +set_menu_items (MENU * menu, ITEM ** items) { if (!menu || (items && !(*items))) RETURN(E_BAD_ARGUMENT); @@ -83,7 +84,8 @@ int set_menu_items(MENU * menu, ITEM ** items) | | Return Values : NULL on error +--------------------------------------------------------------------------*/ -ITEM **menu_items(const MENU *menu) +NCURSES_EXPORT(ITEM **) +menu_items (const MENU *menu) { return(menu ? menu->items : (ITEM **)0); } @@ -97,7 +99,8 @@ ITEM **menu_items(const MENU *menu) | | Return Values : Number of items or -1 to indicate error. +--------------------------------------------------------------------------*/ -int item_count(const MENU *menu) +NCURSES_EXPORT(int) +item_count (const MENU *menu) { return(menu ? menu->nitems : -1); } diff --git a/lib/libmenu/m_new.c b/lib/libmenu/m_new.c index 127ecb06c94..c237cb976fa 100644 --- a/lib/libmenu/m_new.c +++ b/lib/libmenu/m_new.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_new.c,v 1.6 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_new.c,v 1.7 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_new.c,v 1.10 1999/05/16 17:26:59 juergen Exp $") +MODULE_ID("$From: m_new.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$From: m_new.c,v 1.10 1999/05/16 17:26:59 juergen Exp $") | | Return Values : NULL on error +--------------------------------------------------------------------------*/ -MENU *new_menu(ITEM ** items) +NCURSES_EXPORT(MENU *) +new_menu (ITEM ** items) { MENU *menu = (MENU *)calloc(1,sizeof(MENU)); @@ -89,7 +90,8 @@ MENU *new_menu(ITEM ** items) | E_BAD_ARGUMENT - Invalid menu pointer passed | E_POSTED - Menu is already posted +--------------------------------------------------------------------------*/ -int free_menu(MENU * menu) +NCURSES_EXPORT(int) +free_menu (MENU * menu) { if (!menu) RETURN(E_BAD_ARGUMENT); diff --git a/lib/libmenu/m_opts.c b/lib/libmenu/m_opts.c index 02f9afe837c..9ca1078e27b 100644 --- a/lib/libmenu/m_opts.c +++ b/lib/libmenu/m_opts.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_opts.c,v 1.6 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_opts.c,v 1.7 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_opts.c,v 1.12 1999/05/16 17:27:08 juergen Exp $") +MODULE_ID("$From: m_opts.c,v 1.13 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -54,7 +54,8 @@ MODULE_ID("$From: m_opts.c,v 1.12 1999/05/16 17:27:08 juergen Exp $") | E_BAD_ARGUMENT - invalid menu options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_opts(MENU * menu, Menu_Options opts) +NCURSES_EXPORT(int) +set_menu_opts (MENU * menu, Menu_Options opts) { opts &= ALL_MENU_OPTS; @@ -111,7 +112,8 @@ int set_menu_opts(MENU * menu, Menu_Options opts) | E_BAD_ARGUMENT - invalid options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int menu_opts_off(MENU *menu, Menu_Options opts) +NCURSES_EXPORT(int) +menu_opts_off (MENU *menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ @@ -140,7 +142,8 @@ int menu_opts_off(MENU *menu, Menu_Options opts) | E_BAD_ARGUMENT - invalid menu options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int menu_opts_on(MENU * menu, Menu_Options opts) +NCURSES_EXPORT(int) +menu_opts_on (MENU * menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ @@ -164,7 +167,8 @@ int menu_opts_on(MENU * menu, Menu_Options opts) | | Return Values : Menu options +--------------------------------------------------------------------------*/ -Menu_Options menu_opts(const MENU *menu) +NCURSES_EXPORT(Menu_Options) +menu_opts (const MENU *menu) { return (ALL_MENU_OPTS & Normalize_Menu( menu )->opt); } diff --git a/lib/libmenu/m_pad.c b/lib/libmenu/m_pad.c index 1b60dfd54a7..78122817642 100644 --- a/lib/libmenu/m_pad.c +++ b/lib/libmenu/m_pad.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_pad.c,v 1.3 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_pad.c,v 1.4 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_pad.c,v 1.4 1999/05/16 17:27:17 juergen Exp $") +MODULE_ID("$From: m_pad.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -60,7 +60,8 @@ MODULE_ID("$From: m_pad.c,v 1.4 1999/05/16 17:27:17 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ -int set_menu_pad(MENU *menu, int pad) +NCURSES_EXPORT(int) +set_menu_pad (MENU *menu, int pad) { bool do_refresh = (menu != (MENU*)0); @@ -84,7 +85,8 @@ int set_menu_pad(MENU *menu, int pad) | | Return Values : The pad character +--------------------------------------------------------------------------*/ -int menu_pad(const MENU * menu) +NCURSES_EXPORT(int) +menu_pad (const MENU * menu) { return (Normalize_Menu( menu ) -> pad); } diff --git a/lib/libmenu/m_pattern.c b/lib/libmenu/m_pattern.c index 682111ee40e..f750c02aae3 100644 --- a/lib/libmenu/m_pattern.c +++ b/lib/libmenu/m_pattern.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_pattern.c,v 1.3 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_pattern.c,v 1.4 2001/01/22 18:02:05 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_pattern.c,v 1.4 1999/05/16 17:27:28 juergen Exp $") +MODULE_ID("$From: m_pattern.c,v 1.6 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$From: m_pattern.c,v 1.4 1999/05/16 17:27:28 juergen Exp $") | pattern is stored | PatternString - as expected +--------------------------------------------------------------------------*/ -char *menu_pattern(const MENU * menu) +NCURSES_EXPORT(char *) +menu_pattern (const MENU * menu) { return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0); } @@ -70,7 +71,8 @@ char *menu_pattern(const MENU * menu) | E_BAD_STATE - menu in user hook routine | E_NO_MATCH - no item matches pattern +--------------------------------------------------------------------------*/ -int set_menu_pattern(MENU *menu, const char *p) +NCURSES_EXPORT(int) +set_menu_pattern (MENU *menu, const char *p) { ITEM *matchitem; int matchpos; @@ -101,7 +103,7 @@ int set_menu_pattern(MENU *menu, const char *p) while(*p) { - if ( !isprint(*p) || + if ( !isprint((unsigned char)(*p)) || (_nc_Match_Next_Character_In_Item_Name(menu,*p,&matchitem) != E_OK) ) { Reset_Pattern(menu); diff --git a/lib/libmenu/m_post.c b/lib/libmenu/m_post.c index 37f6485bf75..828177fe568 100644 --- a/lib/libmenu/m_post.c +++ b/lib/libmenu/m_post.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_post.c,v 1.5 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_post.c,v 1.6 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_post.c,v 1.16 1999/05/16 17:27:38 juergen Exp $") +MODULE_ID("$From: m_post.c,v 1.17 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$From: m_post.c,v 1.16 1999/05/16 17:27:38 juergen Exp $") | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Post_Item(const MENU * menu, const ITEM * item) +NCURSES_EXPORT(void) +_nc_Post_Item (const MENU * menu, const ITEM * item) { int i; chtype ch; @@ -191,7 +192,8 @@ void _nc_Post_Item(const MENU * menu, const ITEM * item) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Draw_Menu(const MENU * menu) +NCURSES_EXPORT(void) +_nc_Draw_Menu (const MENU * menu) { ITEM *item = menu->items[0]; ITEM *lasthor, *lastvert; @@ -259,7 +261,8 @@ void _nc_Draw_Menu(const MENU * menu) | E_BAD_STATE - Menu in userexit routine | E_POSTED - Menu already posted +--------------------------------------------------------------------------*/ -int post_menu(MENU * menu) +NCURSES_EXPORT(int) +post_menu (MENU * menu) { if (!menu) RETURN(E_BAD_ARGUMENT); @@ -332,7 +335,8 @@ int post_menu(MENU * menu) | E_BAD_STATE - menu in userexit routine | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ -int unpost_menu(MENU * menu) +NCURSES_EXPORT(int) +unpost_menu (MENU * menu) { WINDOW *win; diff --git a/lib/libmenu/m_req_name.c b/lib/libmenu/m_req_name.c index c421cf06d10..23951eb9c3c 100644 --- a/lib/libmenu/m_req_name.c +++ b/lib/libmenu/m_req_name.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_req_name.c,v 1.4 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_req_name.c,v 1.5 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_req_name.c,v 1.12 1999/05/16 17:27:47 juergen Exp $") +MODULE_ID("$From: m_req_name.c,v 1.13 2000/12/10 02:16:48 tom Exp $") static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { "LEFT_ITEM" , @@ -71,7 +71,8 @@ static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { | Return Values : Pointer to name - on success | NULL - on invalid request code +--------------------------------------------------------------------------*/ -const char *menu_request_name( int request ) +NCURSES_EXPORT(const char *) +menu_request_name ( int request ) { if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) ) { @@ -92,7 +93,8 @@ const char *menu_request_name( int request ) | Return Values : Request Id - on success | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ -int menu_request_by_name( const char *str ) +NCURSES_EXPORT(int) +menu_request_by_name ( const char *str ) { /* because the table is so small, it doesn't really hurt to run sequentially through it. diff --git a/lib/libmenu/m_scale.c b/lib/libmenu/m_scale.c index 431fc3a9b9a..ebd8801e9ec 100644 --- a/lib/libmenu/m_scale.c +++ b/lib/libmenu/m_scale.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_scale.c,v 1.3 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_scale.c,v 1.4 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_scale.c,v 1.4 1999/05/16 17:28:00 juergen Exp $") +MODULE_ID("$From: m_scale.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$From: m_scale.c,v 1.4 1999/05/16 17:28:00 juergen Exp $") | E_BAD_ARGUMENT - invalid menu pointer | E_NOT_CONNECTED - no items are connected to menu +--------------------------------------------------------------------------*/ -int scale_menu(const MENU *menu, int *rows, int *cols) +NCURSES_EXPORT(int) +scale_menu (const MENU *menu, int *rows, int *cols) { if (!menu) RETURN( E_BAD_ARGUMENT ); diff --git a/lib/libmenu/m_spacing.c b/lib/libmenu/m_spacing.c index 082f1008eab..f31f928d3ae 100644 --- a/lib/libmenu/m_spacing.c +++ b/lib/libmenu/m_spacing.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_spacing.c,v 1.4 1999/05/17 03:04:25 millert Exp $ */ +/* $OpenBSD: m_spacing.c,v 1.5 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $") +MODULE_ID("$From: m_spacing.c,v 1.12 2000/12/10 02:16:48 tom Exp $") #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) @@ -53,7 +53,9 @@ MODULE_ID("$From: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) +NCURSES_EXPORT(int) +set_menu_spacing +(MENU *menu, int s_desc, int s_row, int s_col ) { MENU *m; /* split for ATAC workaround */ m = Normalize_Menu(menu); @@ -84,7 +86,8 @@ int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col) +NCURSES_EXPORT(int) +menu_spacing ( const MENU *menu, int* s_desc, int* s_row, int* s_col) { const MENU *m; /* split for ATAC workaround */ m = Normalize_Menu(menu); diff --git a/lib/libmenu/m_sub.c b/lib/libmenu/m_sub.c index 6b3eee9892c..d91658f057d 100644 --- a/lib/libmenu/m_sub.c +++ b/lib/libmenu/m_sub.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_sub.c,v 1.3 1999/05/17 03:04:26 millert Exp $ */ +/* $OpenBSD: m_sub.c,v 1.4 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_sub.c,v 1.4 1999/05/16 17:28:20 juergen Exp $") +MODULE_ID("$From: m_sub.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$From: m_sub.c,v 1.4 1999/05/16 17:28:20 juergen Exp $") | Return Values : E_OK - success | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_sub(MENU *menu, WINDOW *win) +NCURSES_EXPORT(int) +set_menu_sub (MENU *menu, WINDOW *win) { if (menu) { @@ -73,7 +74,8 @@ int set_menu_sub(MENU *menu, WINDOW *win) | | Return Values : NULL on error, otherwise a pointer to the window +--------------------------------------------------------------------------*/ -WINDOW *menu_sub(const MENU * menu) +NCURSES_EXPORT(WINDOW *) +menu_sub (const MENU * menu) { const MENU* m = Normalize_Menu(menu); return Get_Menu_Window(m); diff --git a/lib/libmenu/m_userptr.c b/lib/libmenu/m_userptr.c index 308b98832bb..1e8894e0ca8 100644 --- a/lib/libmenu/m_userptr.c +++ b/lib/libmenu/m_userptr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_userptr.c,v 1.5 1999/05/17 03:04:26 millert Exp $ */ +/* $OpenBSD: m_userptr.c,v 1.6 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_userptr.c,v 1.10 1999/05/16 17:28:29 juergen Exp $") +MODULE_ID("$From: m_userptr.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$From: m_userptr.c,v 1.10 1999/05/16 17:28:29 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_menu_userptr(MENU * menu, void * userptr) +NCURSES_EXPORT(int) +set_menu_userptr (MENU * menu, void * userptr) { Normalize_Menu(menu)->userptr = userptr; RETURN( E_OK ); @@ -66,7 +67,8 @@ int set_menu_userptr(MENU * menu, void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *menu_userptr(const MENU * menu) +NCURSES_EXPORT(void *) +menu_userptr (const MENU * menu) { return( Normalize_Menu(menu)->userptr); } diff --git a/lib/libmenu/m_win.c b/lib/libmenu/m_win.c index 90bd20c20b0..988e9695f18 100644 --- a/lib/libmenu/m_win.c +++ b/lib/libmenu/m_win.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_win.c,v 1.5 1999/05/17 03:04:26 millert Exp $ */ +/* $OpenBSD: m_win.c,v 1.6 2001/01/22 18:02:06 millert Exp $ */ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #include "menu.priv.h" -MODULE_ID("$From: m_win.c,v 1.9 1999/05/16 17:28:37 juergen Exp $") +MODULE_ID("$From: m_win.c,v 1.10 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$From: m_win.c,v 1.9 1999/05/16 17:28:37 juergen Exp $") | Return Values : E_OK - success | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_win(MENU *menu, WINDOW *win) +NCURSES_EXPORT(int) +set_menu_win (MENU *menu, WINDOW *win) { if (menu) { @@ -73,7 +74,8 @@ int set_menu_win(MENU *menu, WINDOW *win) | | Return Values : NULL on error, otherwise pointer to window +--------------------------------------------------------------------------*/ -WINDOW *menu_win(const MENU *menu) +NCURSES_EXPORT(WINDOW *) +menu_win (const MENU *menu) { const MENU* m = Normalize_Menu(menu); return (m->userwin ? m->userwin : stdscr); diff --git a/lib/libmenu/menu.h b/lib/libmenu/menu.h index 519a1a1335e..19d0ab5fe51 100644 --- a/lib/libmenu/menu.h +++ b/lib/libmenu/menu.h @@ -1,7 +1,7 @@ -/* $OpenBSD: menu.h,v 1.6 2000/07/24 04:06:12 millert Exp $ */ +/* $OpenBSD: menu.h,v 1.7 2001/01/22 18:02:07 millert Exp $ */ /**************************************************************************** - * 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 * @@ -172,82 +172,82 @@ typedef struct tagMENU /* --------- prototypes for libmenu functions ----------------------------- */ -extern ITEM **menu_items(const MENU *), - *current_item(const MENU *), - *new_item(const char *,const char *); - -extern MENU *new_menu(ITEM **); - -extern Item_Options item_opts(const ITEM *); -extern Menu_Options menu_opts(const MENU *); - -Menu_Hook item_init(const MENU *), - item_term(const MENU *), - menu_init(const MENU *), - menu_term(const MENU *); - -extern WINDOW *menu_sub(const MENU *), - *menu_win(const MENU *); - -extern const char *item_description(const ITEM *), - *item_name(const ITEM *), - *menu_mark(const MENU *), - *menu_request_name(int); - -extern char *menu_pattern(const MENU *); - -extern void *menu_userptr(const MENU *), - *item_userptr(const ITEM *); - -extern chtype menu_back(const MENU *), - menu_fore(const MENU *), - menu_grey(const MENU *); - -extern int free_item(ITEM *), - free_menu(MENU *), - item_count(const MENU *), - item_index(const ITEM *), - item_opts_off(ITEM *,Item_Options), - item_opts_on(ITEM *,Item_Options), - menu_driver(MENU *,int), - menu_opts_off(MENU *,Menu_Options), - menu_opts_on(MENU *,Menu_Options), - menu_pad(const MENU *), - pos_menu_cursor(const MENU *), - post_menu(MENU *), - scale_menu(const MENU *,int *,int *), - set_current_item(MENU *menu,ITEM *item), - set_item_init(MENU *,void(*)(MENU *)), - set_item_opts(ITEM *,Item_Options), - set_item_term(MENU *,void(*)(MENU *)), - set_item_userptr(ITEM *, void *), - set_item_value(ITEM *,bool), - set_menu_back(MENU *,chtype), - set_menu_fore(MENU *,chtype), - set_menu_format(MENU *,int,int), - set_menu_grey(MENU *,chtype), - set_menu_init(MENU *,void(*)(MENU *)), - set_menu_items(MENU *,ITEM **), - set_menu_mark(MENU *, const char *), - set_menu_opts(MENU *,Menu_Options), - set_menu_pad(MENU *,int), - set_menu_pattern(MENU *,const char *), - set_menu_sub(MENU *,WINDOW *), - set_menu_term(MENU *,void(*)(MENU *)), - set_menu_userptr(MENU *,void *), - set_menu_win(MENU *,WINDOW *), - set_top_row(MENU *,int), - top_row(const MENU *), - unpost_menu(MENU *), - menu_request_by_name(const char *), - set_menu_spacing(MENU *,int,int,int), - menu_spacing(const MENU *,int *,int *,int *); - - -extern bool item_value(const ITEM *), - item_visible(const ITEM *); - -void menu_format(const MENU *,int *,int *); +extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); +extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); +extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); + +extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); + +extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); +extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); + +extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); + +extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); +extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); + +extern NCURSES_EXPORT(const char *) item_description (const ITEM *); +extern NCURSES_EXPORT(const char *) item_name (const ITEM *); +extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); +extern NCURSES_EXPORT(const char *) menu_request_name (int); + +extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); + +extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); +extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); + +extern NCURSES_EXPORT(chtype) menu_back (const MENU *); +extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); +extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); + +extern NCURSES_EXPORT(int) free_item (ITEM *); +extern NCURSES_EXPORT(int) free_menu (MENU *); +extern NCURSES_EXPORT(int) item_count (const MENU *); +extern NCURSES_EXPORT(int) item_index (const ITEM *); +extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) menu_driver (MENU *,int); +extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_pad (const MENU *); +extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); +extern NCURSES_EXPORT(int) post_menu (MENU *); +extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); +extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); +extern NCURSES_EXPORT(int) set_item_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) set_item_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); +extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); +extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); +extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); +extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); +extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); +extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); +extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_menu_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); +extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_top_row (MENU *,int); +extern NCURSES_EXPORT(int) top_row (const MENU *); +extern NCURSES_EXPORT(int) unpost_menu (MENU *); +extern NCURSES_EXPORT(int) menu_request_by_name (const char *); +extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); +extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); + + +extern NCURSES_EXPORT(bool) item_value (const ITEM *); +extern NCURSES_EXPORT(bool) item_visible (const ITEM *); + +extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); #ifdef __cplusplus } diff --git a/lib/libmenu/menu.priv.h b/lib/libmenu/menu.priv.h index cad0fde6c47..3d7527c6b07 100644 --- a/lib/libmenu/menu.priv.h +++ b/lib/libmenu/menu.priv.h @@ -1,7 +1,7 @@ -/* $OpenBSD: menu.priv.h,v 1.6 1999/05/17 03:04:26 millert Exp $ */ +/* $OpenBSD: menu.priv.h,v 1.7 2001/01/22 18:02:07 millert Exp $ */ /**************************************************************************** - * 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 * @@ -43,8 +43,8 @@ /* Backspace code */ #define BS (8) -extern ITEM _nc_Default_Item; -extern MENU _nc_Default_Menu; +extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item; +extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; /* Normalize item to default if none was given */ #define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item) @@ -103,14 +103,14 @@ extern MENU _nc_Default_Menu; (menu)->pattern[0] = '\0'; } /* Internal functions. */ -extern void _nc_Draw_Menu(const MENU *); -extern void _nc_Show_Menu(const MENU *); -extern void _nc_Calculate_Item_Length_and_Width(MENU *); -extern void _nc_Post_Item(const MENU *, const ITEM *); -extern bool _nc_Connect_Items(MENU *, ITEM **); -extern void _nc_Disconnect_Items(MENU *); -extern void _nc_New_TopRow_and_CurrentItem(MENU *,int, ITEM *); -extern void _nc_Link_Items(MENU *); -extern int _nc_Match_Next_Character_In_Item_Name(MENU*,int,ITEM**); -extern int _nc_menu_cursor_pos(const MENU* menu, const ITEM* item, +extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *); +extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *); +extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); +extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); +extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); +extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *); +extern NCURSES_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *); +extern NCURSES_EXPORT(void) _nc_Link_Items (MENU *); +extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**); +extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, int* pY, int* pX); diff --git a/lib/libpanel/p_above.c b/lib/libpanel/p_above.c index c8941a6c89c..697422428d2 100644 --- a/lib/libpanel/p_above.c +++ b/lib/libpanel/p_above.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_above.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_above.c,v 1.4 2001/01/22 18:02:07 millert Exp $ */ /**************************************************************************** - * 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 * @@ -37,10 +37,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_above.c,v 1.3 1999/09/18 11:03:28 juergen Exp $") +MODULE_ID("$From: p_above.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -PANEL* -panel_above(const PANEL *pan) +NCURSES_EXPORT(PANEL *) +panel_above (const PANEL *pan) { if(!pan) { diff --git a/lib/libpanel/p_below.c b/lib/libpanel/p_below.c index 33bad48323f..122cad4f95c 100644 --- a/lib/libpanel/p_below.c +++ b/lib/libpanel/p_below.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_below.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_below.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -37,10 +37,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_below.c,v 1.3 1999/09/18 11:03:33 juergen Exp $") +MODULE_ID("$From: p_below.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -PANEL* -panel_below(const PANEL *pan) +NCURSES_EXPORT(PANEL*) +panel_below (const PANEL *pan) { if(!pan) { diff --git a/lib/libpanel/p_bottom.c b/lib/libpanel/p_bottom.c index e7918017846..608a6db87d0 100644 --- a/lib/libpanel/p_bottom.c +++ b/lib/libpanel/p_bottom.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_bottom.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_bottom.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_bottom.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_bottom.c,v 1.8 2000/12/10 02:20:44 tom Exp $") -int -bottom_panel(PANEL *pan) +NCURSES_EXPORT(int) +bottom_panel (PANEL *pan) { int err = OK; diff --git a/lib/libpanel/p_delete.c b/lib/libpanel/p_delete.c index 9cfebc7f231..371c98bf5df 100644 --- a/lib/libpanel/p_delete.c +++ b/lib/libpanel/p_delete.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_delete.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_delete.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_delete.c,v 1.4 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_delete.c,v 1.5 2000/12/10 02:20:44 tom Exp $") -int -del_panel(PANEL *pan) +NCURSES_EXPORT(int) +del_panel (PANEL *pan) { int err = OK; if(pan) diff --git a/lib/libpanel/p_hidden.c b/lib/libpanel/p_hidden.c index ff47a80d10b..11abe542b96 100644 --- a/lib/libpanel/p_hidden.c +++ b/lib/libpanel/p_hidden.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_hidden.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_hidden.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_hidden.c,v 1.4 1999/11/22 18:02:41 juergen Exp $") +MODULE_ID("$From: p_hidden.c,v 1.5 2000/12/10 02:20:44 tom Exp $") -int -panel_hidden(const PANEL *pan) +NCURSES_EXPORT(int) +panel_hidden (const PANEL *pan) { if(!pan) return(ERR); diff --git a/lib/libpanel/p_hide.c b/lib/libpanel/p_hide.c index d3cd6cab7cb..036fb510d5d 100644 --- a/lib/libpanel/p_hide.c +++ b/lib/libpanel/p_hide.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_hide.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_hide.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_hide.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_hide.c,v 1.6 2000/12/10 02:20:44 tom Exp $") -int -hide_panel(register PANEL *pan) +NCURSES_EXPORT(int) +hide_panel (register PANEL *pan) { int err = OK; diff --git a/lib/libpanel/p_move.c b/lib/libpanel/p_move.c index 552e2164f98..08be50b3875 100644 --- a/lib/libpanel/p_move.c +++ b/lib/libpanel/p_move.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_move.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_move.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_move.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_move.c,v 1.6 2000/12/10 02:20:44 tom Exp $") -int -move_panel(PANEL *pan, int starty, int startx) +NCURSES_EXPORT(int) +move_panel (PANEL *pan, int starty, int startx) { if(!pan) return(ERR); diff --git a/lib/libpanel/p_new.c b/lib/libpanel/p_new.c index b9bd9262562..c9aefacf5c3 100644 --- a/lib/libpanel/p_new.c +++ b/lib/libpanel/p_new.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_new.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_new.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,7 +38,7 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_new.c,v 1.5 1999/11/22 18:02:41 juergen Exp $") +MODULE_ID("$From: p_new.c,v 1.6 2000/12/10 02:20:44 tom Exp $") #ifdef TRACE static char* stdscr_id; @@ -76,8 +76,8 @@ root_panel(void) return _nc_stdscr_pseudo_panel; } -PANEL * -new_panel(WINDOW *win) +NCURSES_EXPORT(PANEL *) +new_panel (WINDOW *win) { PANEL *pan = (PANEL*)0; diff --git a/lib/libpanel/p_replace.c b/lib/libpanel/p_replace.c index bf2506e019f..0999af0f0b9 100644 --- a/lib/libpanel/p_replace.c +++ b/lib/libpanel/p_replace.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_replace.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_replace.c,v 1.4 2001/01/22 18:02:09 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_replace.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_replace.c,v 1.6 2000/12/10 02:20:44 tom Exp $") -int -replace_panel(PANEL *pan, WINDOW *win) +NCURSES_EXPORT(int) +replace_panel (PANEL *pan, WINDOW *win) { if(!pan) return(ERR); diff --git a/lib/libpanel/p_show.c b/lib/libpanel/p_show.c index fb97cb12ab0..c2a8ed7d0df 100644 --- a/lib/libpanel/p_show.c +++ b/lib/libpanel/p_show.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_show.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_show.c,v 1.4 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_show.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_show.c,v 1.8 2000/12/10 02:20:44 tom Exp $") -int -show_panel(PANEL *pan) +NCURSES_EXPORT(int) +show_panel (PANEL *pan) { int err = OK; diff --git a/lib/libpanel/p_top.c b/lib/libpanel/p_top.c index 6a68804f1c5..8a2215e8fd6 100644 --- a/lib/libpanel/p_top.c +++ b/lib/libpanel/p_top.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_top.c,v 1.2 1998/07/24 17:08:16 millert Exp $ */ +/* $OpenBSD: p_top.c,v 1.3 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_top.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: p_top.c,v 1.3 2000/12/10 02:20:44 tom Exp $") -int -top_panel(PANEL *pan) +NCURSES_EXPORT(int) +top_panel (PANEL *pan) { return(show_panel(pan)); } diff --git a/lib/libpanel/p_update.c b/lib/libpanel/p_update.c index 2b65a59602b..8da441ec40a 100644 --- a/lib/libpanel/p_update.c +++ b/lib/libpanel/p_update.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_update.c,v 1.3 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: p_update.c,v 1.4 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_update.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$From: p_update.c,v 1.6 2000/12/10 02:20:44 tom Exp $") -void -update_panels(void) +NCURSES_EXPORT(void) +update_panels (void) { PANEL *pan; diff --git a/lib/libpanel/p_user.c b/lib/libpanel/p_user.c index 30b4e08580b..bb4e692c455 100644 --- a/lib/libpanel/p_user.c +++ b/lib/libpanel/p_user.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_user.c,v 1.2 1998/07/24 17:08:18 millert Exp $ */ +/* $OpenBSD: p_user.c,v 1.3 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,11 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_user.c,v 1.3 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: p_user.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -int -set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) +NCURSES_EXPORT(int) +set_panel_userptr +(PANEL *pan, NCURSES_CONST void *uptr) { if(!pan) return(ERR); @@ -49,8 +50,8 @@ set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) return(OK); } -NCURSES_CONST void* -panel_userptr(const PANEL *pan) +NCURSES_EXPORT(NCURSES_CONST void*) +panel_userptr (const PANEL *pan) { return(pan ? pan->user : (NCURSES_CONST void *)0); } diff --git a/lib/libpanel/p_win.c b/lib/libpanel/p_win.c index ad62dbcc3e4..b986be31234 100644 --- a/lib/libpanel/p_win.c +++ b/lib/libpanel/p_win.c @@ -1,7 +1,7 @@ -/* $OpenBSD: p_win.c,v 1.2 1998/07/24 17:08:20 millert Exp $ */ +/* $OpenBSD: p_win.c,v 1.3 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -38,10 +38,10 @@ */ #include "panel.priv.h" -MODULE_ID("$From: p_win.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$From: p_win.c,v 1.3 2000/12/10 02:20:43 tom Exp $") -WINDOW* -panel_window(const PANEL *pan) +NCURSES_EXPORT(WINDOW *) +panel_window (const PANEL *pan) { return(pan ? pan->win : (WINDOW *)0); } diff --git a/lib/libpanel/panel.c b/lib/libpanel/panel.c index 3971878c63c..d8e9f902940 100644 --- a/lib/libpanel/panel.c +++ b/lib/libpanel/panel.c @@ -1,7 +1,7 @@ -/* $OpenBSD: panel.c,v 1.7 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: panel.c,v 1.8 2001/01/22 18:02:10 millert Exp $ */ /**************************************************************************** - * 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 * @@ -36,11 +36,12 @@ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$From: panel.c,v 1.18 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$From: panel.c,v 1.19 2000/12/10 02:20:43 tom Exp $") #ifdef TRACE #ifndef TRACE_TXT -const char *_nc_my_visbuf(const void *ptr) +NCURSES_EXPORT(const char *) +_nc_my_visbuf (const void *ptr) { char temp[32]; if (ptr != 0) @@ -57,8 +58,9 @@ const char *_nc_my_visbuf(const void *ptr) dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_dPanel(const char *text, const PANEL *pan) +NCURSES_EXPORT(void) +_nc_dPanel +(const char *text, const PANEL *pan) { _tracef("%s id=%s b=%s a=%s y=%d x=%d", text, USER_PTR(pan->user), @@ -72,8 +74,9 @@ _nc_dPanel(const char *text, const PANEL *pan) dStack(fmt,num,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_dStack(const char *fmt, int num, const PANEL *pan) +NCURSES_EXPORT(void) +_nc_dStack +(const char *fmt, int num, const PANEL *pan) { char s80[80]; @@ -96,8 +99,8 @@ _nc_dStack(const char *fmt, int num, const PANEL *pan) Wnoutrefresh(pan) - debugging hook for wnoutrefresh --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Wnoutrefresh(const PANEL *pan) +NCURSES_EXPORT(void) +_nc_Wnoutrefresh (const PANEL *pan) { dPanel("wnoutrefresh",pan); wnoutrefresh(pan->win); @@ -108,8 +111,8 @@ _nc_Wnoutrefresh(const PANEL *pan) Touchpan(pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Touchpan(const PANEL *pan) +NCURSES_EXPORT(void) +_nc_Touchpan (const PANEL *pan) { dPanel("Touchpan",pan); touchwin(pan->win); @@ -120,8 +123,9 @@ _nc_Touchpan(const PANEL *pan) Touchline(pan,start,count) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Touchline(const PANEL *pan, int start, int count) +NCURSES_EXPORT(void) +_nc_Touchline +(const PANEL *pan, int start, int count) { char s80[80]; snprintf(s80,sizeof(s80),"Touchline s=%d c=%d",start,count); diff --git a/lib/libpanel/panel.h b/lib/libpanel/panel.h index 93a620f0023..b0c1f4a9c33 100644 --- a/lib/libpanel/panel.h +++ b/lib/libpanel/panel.h @@ -1,7 +1,7 @@ -/* $OpenBSD: panel.h,v 1.5 1999/11/28 17:49:19 millert Exp $ */ +/* $OpenBSD: panel.h,v 1.6 2001/01/22 18:02:11 millert Exp $ */ /**************************************************************************** - * 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 * @@ -52,21 +52,21 @@ typedef struct panel extern "C" { #endif -extern WINDOW* panel_window(const PANEL *); -extern void update_panels(void); -extern int hide_panel(PANEL *); -extern int show_panel(PANEL *); -extern int del_panel(PANEL *); -extern int top_panel(PANEL *); -extern int bottom_panel(PANEL *); -extern PANEL* new_panel(WINDOW *); -extern PANEL* panel_above(const PANEL *); -extern PANEL* panel_below(const PANEL *); -extern int set_panel_userptr(PANEL *, NCURSES_CONST void *); -extern NCURSES_CONST void* panel_userptr(const PANEL *); -extern int move_panel(PANEL *, int, int); -extern int replace_panel(PANEL *,WINDOW *); -extern int panel_hidden(const PANEL *); +extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); +extern NCURSES_EXPORT(void) update_panels (void); +extern NCURSES_EXPORT(int) hide_panel (PANEL *); +extern NCURSES_EXPORT(int) show_panel (PANEL *); +extern NCURSES_EXPORT(int) del_panel (PANEL *); +extern NCURSES_EXPORT(int) top_panel (PANEL *); +extern NCURSES_EXPORT(int) bottom_panel (PANEL *); +extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); +extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); +extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); +extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); +extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); #if defined(__cplusplus) } diff --git a/lib/libpanel/panel.priv.h b/lib/libpanel/panel.priv.h index 1b497896e43..99388fdf5a6 100644 --- a/lib/libpanel/panel.priv.h +++ b/lib/libpanel/panel.priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: panel.priv.h,v 1.6 2000/10/08 22:47:07 millert Exp $ */ +/* $OpenBSD: panel.priv.h,v 1.7 2001/01/22 18:02:11 millert Exp $ */ /**************************************************************************** * Copyright (c) 2000 Free Software Foundation, Inc. * @@ -28,7 +28,7 @@ * authorization. * ****************************************************************************/ -/* $From: panel.priv.h,v 1.14 2000/09/02 18:22:23 tom Exp $ */ +/* $From: panel.priv.h,v 1.15 2000/12/10 00:27:20 tom Exp $ */ #ifndef _PANEL_PRIV_H #define _PANEL_PRIV_H @@ -49,8 +49,8 @@ # include <dbmalloc.h> /* Conor Cahill's library */ #endif -#include <nc_panel.h> #include "panel.h" +#include <nc_panel.h> #if ( CC_HAS_INLINE_FUNCS && !defined(TRACE) ) # define INLINE inline @@ -66,18 +66,18 @@ #ifdef TRACE - extern const char *_nc_my_visbuf(const void *); + extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *); # ifdef TRACE_TXT # define USER_PTR(ptr) _nc_visbuf((const char *)ptr) # else # define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) # endif - extern void _nc_dPanel(const char*, const PANEL*); - extern void _nc_dStack(const char*, int, const PANEL*); - extern void _nc_Wnoutrefresh(const PANEL*); - extern void _nc_Touchpan(const PANEL*); - extern void _nc_Touchline(const PANEL*, int, int); + extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*); + extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); + extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); + extern NCURSES_EXPORT(void) _nc_Touchpan (const PANEL*); + extern NCURSES_EXPORT(void) _nc_Touchline (const PANEL*, int, int); # define dBug(x) _tracef x # define dPanel(text,pan) _nc_dPanel(text,pan) |