Tim Hughes
11 years ago
37 changed files with 10081 additions and 0 deletions
File diff suppressed because it is too large
@ -0,0 +1,176 @@ |
|||
// * This makes emacs happy -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2003,2005 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
// $Id: cursesapp.h,v 1.11 2005/05/28 21:57:44 tom Exp $
|
|||
|
|||
#ifndef NCURSES_CURSESAPP_H_incl |
|||
#define NCURSES_CURSESAPP_H_incl |
|||
|
|||
#include <ncurses/cursslk.h> |
|||
|
|||
class NCURSES_IMPEXP NCursesApplication { |
|||
public: |
|||
typedef struct _slk_link { // This structure is used to maintain
|
|||
struct _slk_link* prev; // a stack of SLKs
|
|||
Soft_Label_Key_Set* SLKs; |
|||
} SLK_Link; |
|||
private: |
|||
static int rinit(NCursesWindow& w); // Internal Init function for title
|
|||
static NCursesApplication* theApp; // Global ref. to the application
|
|||
|
|||
static SLK_Link* slk_stack; |
|||
|
|||
protected: |
|||
static NCursesWindow* titleWindow; // The Title Window (if any)
|
|||
|
|||
bool b_Colors; // Is this a color application?
|
|||
NCursesWindow* Root_Window; // This is the stdscr equiv.
|
|||
|
|||
// Initialization of attributes;
|
|||
// Rewrite this in your derived class if you prefer other settings
|
|||
virtual void init(bool bColors); |
|||
|
|||
// The number of lines for the title window. Default is no title window
|
|||
// You may rewrite this in your derived class
|
|||
virtual int titlesize() const { |
|||
return 0; |
|||
} |
|||
|
|||
// This method is called to put something into the title window initially
|
|||
// You may rewrite this in your derived class
|
|||
virtual void title() { |
|||
} |
|||
|
|||
// The layout used for the Soft Label Keys. Default is to have no SLKs.
|
|||
// You may rewrite this in your derived class
|
|||
virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { |
|||
return Soft_Label_Key_Set::None; |
|||
} |
|||
|
|||
// This method is called to initialize the SLKs. Default is nothing.
|
|||
// You may rewrite this in your derived class
|
|||
virtual void init_labels(Soft_Label_Key_Set& S) const { |
|||
} |
|||
|
|||
// Your derived class must implement this method. The return value must
|
|||
// be the exit value of your application.
|
|||
virtual int run() = 0; |
|||
|
|||
// The constructor is protected, so you may use it in your derived
|
|||
// class constructor. The argument tells whether or not you want colors.
|
|||
NCursesApplication(bool wantColors = FALSE); |
|||
|
|||
NCursesApplication& operator=(const NCursesApplication& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesApplication(const NCursesApplication& rhs) |
|||
: b_Colors(rhs.b_Colors), |
|||
Root_Window(rhs.Root_Window) |
|||
{ |
|||
} |
|||
|
|||
public: |
|||
virtual ~NCursesApplication(); |
|||
|
|||
// Get a pointer to the current application object
|
|||
static NCursesApplication* getApplication() { |
|||
return theApp; |
|||
} |
|||
|
|||
// This method runs the application and returns its exit value
|
|||
int operator()(void); |
|||
|
|||
// Process the commandline arguments. The default implementation simply
|
|||
// ignores them. Your derived class may rewrite this.
|
|||
virtual void handleArgs(int argc, char* argv[]) { |
|||
} |
|||
|
|||
// Does this application use colors?
|
|||
inline bool useColors() const { |
|||
return b_Colors; |
|||
} |
|||
|
|||
// Push the Key Set S onto the SLK Stack. S then becomes the current set
|
|||
// of Soft Labelled Keys.
|
|||
void push(Soft_Label_Key_Set& S); |
|||
|
|||
// Throw away the current set of SLKs and make the previous one the
|
|||
// new current set.
|
|||
bool pop(); |
|||
|
|||
// Retrieve the current set of Soft Labelled Keys.
|
|||
Soft_Label_Key_Set* top() const; |
|||
|
|||
// Attributes to use for menu and forms foregrounds
|
|||
virtual chtype foregrounds() const { |
|||
return b_Colors ? COLOR_PAIR(1) : A_BOLD; |
|||
} |
|||
|
|||
// Attributes to use for menu and forms backgrounds
|
|||
virtual chtype backgrounds() const { |
|||
return b_Colors ? COLOR_PAIR(2) : A_NORMAL; |
|||
} |
|||
|
|||
// Attributes to use for inactive (menu) elements
|
|||
virtual chtype inactives() const { |
|||
return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM; |
|||
} |
|||
|
|||
// Attributes to use for (form) labels and SLKs
|
|||
virtual chtype labels() const { |
|||
return b_Colors ? COLOR_PAIR(4) : A_NORMAL; |
|||
} |
|||
|
|||
// Attributes to use for form backgrounds
|
|||
virtual chtype dialog_backgrounds() const { |
|||
return b_Colors ? COLOR_PAIR(4) : A_NORMAL; |
|||
} |
|||
|
|||
// Attributes to use as default for (form) window backgrounds
|
|||
virtual chtype window_backgrounds() const { |
|||
return b_Colors ? COLOR_PAIR(5) : A_NORMAL; |
|||
} |
|||
|
|||
// Attributes to use for the title window
|
|||
virtual chtype screen_titles() const { |
|||
return b_Colors ? COLOR_PAIR(6) : A_BOLD; |
|||
} |
|||
|
|||
}; |
|||
|
|||
#endif /* NCURSES_CURSESAPP_H_incl */ |
@ -0,0 +1,967 @@ |
|||
// * This makes emacs happy -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2004,2005 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
// $Id: cursesf.h,v 1.28 2005/08/13 18:08:24 tom Exp $
|
|||
|
|||
#ifndef NCURSES_CURSESF_H_incl |
|||
#define NCURSES_CURSESF_H_incl 1 |
|||
|
|||
#include <ncurses/cursesp.h> |
|||
|
|||
#ifndef __EXT_QNX |
|||
#include <string.h> |
|||
#endif |
|||
|
|||
extern "C" { |
|||
# include <ncurses/form.h> |
|||
} |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// The abstract base class for buitin and user defined Fieldtypes.
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP NCursesFormField; // forward declaration
|
|||
|
|||
// Class to represent builtin field types as well as C++ written new
|
|||
// fieldtypes (see classes UserDefineFieldType...
|
|||
class NCURSES_IMPEXP NCursesFieldType |
|||
{ |
|||
friend class NCursesFormField; |
|||
|
|||
protected: |
|||
FIELDTYPE* fieldtype; |
|||
|
|||
inline void OnError(int err) const THROWS(NCursesFormException) { |
|||
if (err!=E_OK) |
|||
THROW(new NCursesFormException (err)); |
|||
} |
|||
|
|||
NCursesFieldType(FIELDTYPE *f) : fieldtype(f) { |
|||
} |
|||
|
|||
virtual ~NCursesFieldType() {} |
|||
|
|||
// Set the fields f fieldtype to this one.
|
|||
virtual void set(NCursesFormField& f) = 0; |
|||
|
|||
public: |
|||
NCursesFieldType() |
|||
: fieldtype(STATIC_CAST(FIELDTYPE*)(0)) |
|||
{ |
|||
} |
|||
|
|||
NCursesFieldType& operator=(const NCursesFieldType& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesFieldType(const NCursesFieldType& rhs) |
|||
: fieldtype(rhs.fieldtype) |
|||
{ |
|||
} |
|||
|
|||
}; |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// The class representing a forms field, wrapping the lowlevel FIELD struct
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP NCursesFormField |
|||
{ |
|||
friend class NCursesForm; |
|||
|
|||
protected: |
|||
FIELD *field; // lowlevel structure
|
|||
NCursesFieldType* ftype; // Associated field type
|
|||
|
|||
// Error handler
|
|||
inline void OnError (int err) const THROWS(NCursesFormException) { |
|||
if (err != E_OK) |
|||
THROW(new NCursesFormException (err)); |
|||
} |
|||
|
|||
public: |
|||
// Create a 'Null' field. Can be used to delimit a field list
|
|||
NCursesFormField() |
|||
: field(STATIC_CAST(FIELD*)(0)), |
|||
ftype(STATIC_CAST(NCursesFieldType*)(0)) |
|||
{ |
|||
} |
|||
|
|||
// Create a new field
|
|||
NCursesFormField (int rows, |
|||
int ncols, |
|||
int first_row = 0, |
|||
int first_col = 0, |
|||
int offscreen_rows = 0, |
|||
int additional_buffers = 0) |
|||
: field(0), |
|||
ftype(STATIC_CAST(NCursesFieldType*)(0)) |
|||
{ |
|||
field = ::new_field(rows, ncols, first_row, first_col, |
|||
offscreen_rows, additional_buffers); |
|||
if (!field) |
|||
OnError(errno); |
|||
} |
|||
|
|||
NCursesFormField& operator=(const NCursesFormField& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesFormField(const NCursesFormField& rhs) |
|||
: field(rhs.field), ftype(rhs.ftype) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesFormField (); |
|||
|
|||
// Duplicate the field at a new position
|
|||
inline NCursesFormField* dup(int first_row, int first_col) |
|||
{ |
|||
NCursesFormField* f = new NCursesFormField(); |
|||
if (!f) |
|||
OnError(E_SYSTEM_ERROR); |
|||
else { |
|||
f->ftype = ftype; |
|||
f->field = ::dup_field(field,first_row,first_col); |
|||
if (!f->field) |
|||
OnError(errno); |
|||
} |
|||
return f; |
|||
} |
|||
|
|||
// Link the field to a new location
|
|||
inline NCursesFormField* link(int first_row, int first_col) { |
|||
NCursesFormField* f = new NCursesFormField(); |
|||
if (!f) |
|||
OnError(E_SYSTEM_ERROR); |
|||
else { |
|||
f->ftype = ftype; |
|||
f->field = ::link_field(field,first_row,first_col); |
|||
if (!f->field) |
|||
OnError(errno); |
|||
} |
|||
return f; |
|||
} |
|||
|
|||
// Get the lowlevel field representation
|
|||
inline FIELD* get_field() const { |
|||
return field; |
|||
} |
|||
|
|||
// Retrieve info about the field
|
|||
inline void info(int& rows, int& ncols, |
|||
int& first_row, int& first_col, |
|||
int& offscreen_rows, int& additional_buffers) const { |
|||
OnError(::field_info(field, &rows, &ncols, |
|||
&first_row, &first_col, |
|||
&offscreen_rows, &additional_buffers)); |
|||
} |
|||
|
|||
// Retrieve info about the fields dynamic properties.
|
|||
inline void dynamic_info(int& dynamic_rows, int& dynamic_cols, |
|||
int& max_growth) const { |
|||
OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, |
|||
&max_growth)); |
|||
} |
|||
|
|||
// For a dynamic field you may set the maximum growth limit.
|
|||
// A zero means unlimited growth.
|
|||
inline void set_maximum_growth(int growth = 0) { |
|||
OnError(::set_max_field(field,growth)); |
|||
} |
|||
|
|||
// Move the field to a new position
|
|||
inline void move(int row, int col) { |
|||
OnError(::move_field(field,row,col)); |
|||
} |
|||
|
|||
// Mark the field to start a new page
|
|||
inline void new_page(bool pageFlag = FALSE) { |
|||
OnError(::set_new_page(field,pageFlag)); |
|||
} |
|||
|
|||
// Retrieve whether or not the field starts a new page.
|
|||
inline bool is_new_page() const { |
|||
return ::new_page(field); |
|||
} |
|||
|
|||
// Set the justification for the field
|
|||
inline void set_justification(int just) { |
|||
OnError(::set_field_just(field,just)); |
|||
} |
|||
|
|||
// Retrieve the fields justification
|
|||
inline int justification() const { |
|||
return ::field_just(field); |
|||
} |
|||
// Set the foreground attribute for the field
|
|||
inline void set_foreground(chtype foreground) { |
|||
OnError(::set_field_fore(field,foreground)); |
|||
} |
|||
|
|||
// Retrieve the fields foreground attribute
|
|||
inline chtype fore() const { |
|||
return ::field_fore(field); |
|||
} |
|||
|
|||
// Set the background attribute for the field
|
|||
inline void set_background(chtype background) { |
|||
OnError(::set_field_back(field,background)); |
|||
} |
|||
|
|||
// Retrieve the fields background attribute
|
|||
inline chtype back() const { |
|||
return ::field_back(field); |
|||
} |
|||
|
|||
// Set the padding character for the field
|
|||
inline void set_pad_character(int padding) { |
|||
OnError(::set_field_pad(field, padding)); |
|||
} |
|||
|
|||
// Retrieve the fields padding character
|
|||
inline int pad() const { |
|||
return ::field_pad(field); |
|||
} |
|||
|
|||
// Switch on the fields options
|
|||
inline void options_on (Field_Options opts) { |
|||
OnError (::field_opts_on (field, opts)); |
|||
} |
|||
|
|||
// Switch off the fields options
|
|||
inline void options_off (Field_Options opts) { |
|||
OnError (::field_opts_off (field, opts)); |
|||
} |
|||
|
|||
// Retrieve the fields options
|
|||
inline Field_Options options () const { |
|||
return ::field_opts (field); |
|||
} |
|||
|
|||
// Set the fields options
|
|||
inline void set_options (Field_Options opts) { |
|||
OnError (::set_field_opts (field, opts)); |
|||
} |
|||
|
|||
// Mark the field as changed
|
|||
inline void set_changed(bool changeFlag = TRUE) { |
|||
OnError(::set_field_status(field,changeFlag)); |
|||
} |
|||
|
|||
// Test whether or not the field is marked as changed
|
|||
inline bool changed() const { |
|||
return ::field_status(field); |
|||
} |
|||
|
|||
// Return the index of the field in the field array of a form
|
|||
// or -1 if the field is not associated to a form
|
|||
inline int (index)() const { |
|||
return ::field_index(field); |
|||
} |
|||
|
|||
// Store a value in a fields buffer. The default buffer is nr. 0
|
|||
inline void set_value(const char *val, int buffer = 0) { |
|||
OnError(::set_field_buffer(field,buffer,val)); |
|||
} |
|||
|
|||
// Retrieve the value of a fields buffer. The default buffer is nr. 0
|
|||
inline char* value(int buffer = 0) const { |
|||
return ::field_buffer(field,buffer); |
|||
} |
|||
|
|||
// Set the validation type of the field.
|
|||
inline void set_fieldtype(NCursesFieldType& f) { |
|||
ftype = &f; |
|||
f.set(*this); // A good friend may do that...
|
|||
} |
|||
|
|||
// Retrieve the validation type of the field.
|
|||
inline NCursesFieldType* fieldtype() const { |
|||
return ftype; |
|||
} |
|||
|
|||
}; |
|||
|
|||
// This are the built-in hook functions in this C++ binding. In C++ we use
|
|||
// virtual member functions (see below On_..._Init and On_..._Termination)
|
|||
// to provide this functionality in an object oriented manner.
|
|||
extern "C" { |
|||
void _nc_xx_frm_init(FORM *); |
|||
void _nc_xx_frm_term(FORM *); |
|||
void _nc_xx_fld_init(FORM *); |
|||
void _nc_xx_fld_term(FORM *); |
|||
} |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// The class representing a form, wrapping the lowlevel FORM struct
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP NCursesForm : public NCursesPanel |
|||
{ |
|||
protected: |
|||
FORM* form; // the lowlevel structure
|
|||
|
|||
private: |
|||
NCursesWindow* sub; // the subwindow object
|
|||
bool b_sub_owner; // is this our own subwindow?
|
|||
bool b_framed; // has the form a border?
|
|||
bool b_autoDelete; // Delete fields when deleting form?
|
|||
|
|||
NCursesFormField** my_fields; // The array of fields for this form
|
|||
|
|||
// This structure is used for the form's user data field to link the
|
|||
// FORM* to the C++ object and to provide extra space for a user pointer.
|
|||
typedef struct { |
|||
void* m_user; // the pointer for the user's data
|
|||
const NCursesForm* m_back; // backward pointer to C++ object
|
|||
const FORM* m_owner; |
|||
} UserHook; |
|||
|
|||
// Get the backward pointer to the C++ object from a FORM
|
|||
static inline NCursesForm* getHook(const FORM *f) { |
|||
UserHook* hook = reinterpret_cast<UserHook*>(::form_userptr(f)); |
|||
assert(hook != 0 && hook->m_owner==f); |
|||
return const_cast<NCursesForm*>(hook->m_back); |
|||
} |
|||
|
|||
friend void _nc_xx_frm_init(FORM *); |
|||
friend void _nc_xx_frm_term(FORM *); |
|||
friend void _nc_xx_fld_init(FORM *); |
|||
friend void _nc_xx_fld_term(FORM *); |
|||
|
|||
// Calculate FIELD* array for the menu
|
|||
FIELD** mapFields(NCursesFormField* nfields[]); |
|||
|
|||
protected: |
|||
// internal routines
|
|||
inline void set_user(void *user) { |
|||
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form)); |
|||
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); |
|||
uptr->m_user = user; |
|||
} |
|||
|
|||
inline void *get_user() { |
|||
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form)); |
|||
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); |
|||
return uptr->m_user; |
|||
} |
|||
|
|||
void InitForm (NCursesFormField* Fields[], |
|||
bool with_frame, |
|||
bool autoDeleteFields); |
|||
|
|||
inline void OnError (int err) const THROWS(NCursesFormException) { |
|||
if (err != E_OK) |
|||
THROW(new NCursesFormException (err)); |
|||
} |
|||
|
|||
// this wraps the form_driver call.
|
|||
virtual int driver (int c) ; |
|||
|
|||
// 'Internal' constructor, builds an object without association to a
|
|||
// field array.
|
|||
NCursesForm( int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0) |
|||
: NCursesPanel(nlines, ncols, begin_y, begin_x), |
|||
form (STATIC_CAST(FORM*)(0)), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_fields(0) |
|||
{ |
|||
} |
|||
|
|||
public: |
|||
// Create form for the default panel.
|
|||
NCursesForm (NCursesFormField* Fields[], |
|||
bool with_frame=FALSE, // reserve space for a frame?
|
|||
bool autoDelete_Fields=FALSE) // do automatic cleanup?
|
|||
: NCursesPanel(), |
|||
form(0), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_fields(0) |
|||
{ |
|||
InitForm(Fields, with_frame, autoDelete_Fields); |
|||
} |
|||
|
|||
// Create a form in a panel with the given position and size.
|
|||
NCursesForm (NCursesFormField* Fields[], |
|||
int nlines, |
|||
int ncols, |
|||
int begin_y, |
|||
int begin_x, |
|||
bool with_frame=FALSE, // reserve space for a frame?
|
|||
bool autoDelete_Fields=FALSE) // do automatic cleanup?
|
|||
: NCursesPanel(nlines, ncols, begin_y, begin_x), |
|||
form(0), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_fields(0) |
|||
{ |
|||
InitForm(Fields, with_frame, autoDelete_Fields); |
|||
} |
|||
|
|||
NCursesForm& operator=(const NCursesForm& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
NCursesPanel::operator=(rhs); |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesForm(const NCursesForm& rhs) |
|||
: NCursesPanel(rhs), |
|||
form(rhs.form), |
|||
sub(rhs.sub), |
|||
b_sub_owner(rhs.b_sub_owner), |
|||
b_framed(rhs.b_framed), |
|||
b_autoDelete(rhs.b_autoDelete), |
|||
my_fields(rhs.my_fields) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesForm(); |
|||
|
|||
// Set the default attributes for the form
|
|||
virtual void setDefaultAttributes(); |
|||
|
|||
// Retrieve current field of the form.
|
|||
inline NCursesFormField* current_field() const { |
|||
return my_fields[::field_index(::current_field(form))]; |
|||
} |
|||
|
|||
// Set the forms subwindow
|
|||
void setSubWindow(NCursesWindow& sub); |
|||
|
|||
// Set these fields for the form
|
|||
inline void setFields(NCursesFormField* Fields[]) { |
|||
OnError(::set_form_fields(form,mapFields(Fields))); |
|||
} |
|||
|
|||
// Remove the form from the screen
|
|||
inline void unpost (void) { |
|||
OnError (::unpost_form (form)); |
|||
} |
|||
|
|||
// Post the form to the screen if flag is true, unpost it otherwise
|
|||
inline void post(bool flag = TRUE) { |
|||
OnError (flag ? ::post_form(form) : ::unpost_form (form)); |
|||
} |
|||
|
|||
// Decorations
|
|||
inline void frame(const char *title=NULL, const char* btitle=NULL) { |
|||
if (b_framed) |
|||
NCursesPanel::frame(title,btitle); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
inline void boldframe(const char *title=NULL, const char* btitle=NULL) { |
|||
if (b_framed) |
|||
NCursesPanel::boldframe(title,btitle); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
inline void label(const char *topLabel, const char *bottomLabel) { |
|||
if (b_framed) |
|||
NCursesPanel::label(topLabel,bottomLabel); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
// -----
|
|||
// Hooks
|
|||
// -----
|
|||
|
|||
// Called after the form gets repositioned in its window.
|
|||
// This is especially true if the form is posted.
|
|||
virtual void On_Form_Init(); |
|||
|
|||
// Called before the form gets repositioned in its window.
|
|||
// This is especially true if the form is unposted.
|
|||
virtual void On_Form_Termination(); |
|||
|
|||
// Called after the field became the current field
|
|||
virtual void On_Field_Init(NCursesFormField& field); |
|||
|
|||
// Called before this field is left as current field.
|
|||
virtual void On_Field_Termination(NCursesFormField& field); |
|||
|
|||
// Calculate required window size for the form.
|
|||
void scale(int& rows, int& ncols) const { |
|||
OnError(::scale_form(form,&rows,&ncols)); |
|||
} |
|||
|
|||
// Retrieve number of fields in the form.
|
|||
int count() const { |
|||
return ::field_count(form); |
|||
} |
|||
|
|||
// Make the page the current page of the form.
|
|||
void set_page(int pageNum) { |
|||
OnError(::set_form_page(form, pageNum)); |
|||
} |
|||
|
|||
// Retrieve current page number
|
|||
int page() const { |
|||
return ::form_page(form); |
|||
} |
|||
|
|||
// Switch on the forms options
|
|||
inline void options_on (Form_Options opts) { |
|||
OnError (::form_opts_on (form, opts)); |
|||
} |
|||
|
|||
// Switch off the forms options
|
|||
inline void options_off (Form_Options opts) { |
|||
OnError (::form_opts_off (form, opts)); |
|||
} |
|||
|
|||
// Retrieve the forms options
|
|||
inline Form_Options options () const { |
|||
return ::form_opts (form); |
|||
} |
|||
|
|||
// Set the forms options
|
|||
inline void set_options (Form_Options opts) { |
|||
OnError (::set_form_opts (form, opts)); |
|||
} |
|||
|
|||
// Are there more data in the current field after the data shown
|
|||
inline bool data_ahead() const { |
|||
return ::data_ahead(form); |
|||
} |
|||
|
|||
// Are there more data in the current field before the data shown
|
|||
inline bool data_behind() const { |
|||
return ::data_behind(form); |
|||
} |
|||
|
|||
// Position the cursor to the current field
|
|||
inline void position_cursor () { |
|||
OnError (::pos_form_cursor (form)); |
|||
} |
|||
// Set the current field
|
|||
inline void set_current(NCursesFormField& F) { |
|||
OnError (::set_current_field(form, F.field)); |
|||
} |
|||
|
|||
// Provide a default key virtualization. Translate the keyboard
|
|||
// code c into a form request code.
|
|||
// The default implementation provides a hopefully straightforward
|
|||
// mapping for the most common keystrokes and form requests.
|
|||
virtual int virtualize(int c); |
|||
|
|||
// Operators
|
|||
inline NCursesFormField* operator[](int i) const { |
|||
if ( (i < 0) || (i >= ::field_count (form)) ) |
|||
OnError (E_BAD_ARGUMENT); |
|||
return my_fields[i]; |
|||
} |
|||
|
|||
// Perform the menu's operation
|
|||
// Return the field where you left the form.
|
|||
virtual NCursesFormField* operator()(void); |
|||
|
|||
// Exception handlers. The default is a Beep.
|
|||
virtual void On_Request_Denied(int c) const; |
|||
virtual void On_Invalid_Field(int c) const; |
|||
virtual void On_Unknown_Command(int c) const; |
|||
|
|||
}; |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// This is the typical C++ typesafe way to allow to attach
|
|||
// user data to a field of a form. Its assumed that the user
|
|||
// data belongs to some class T. Use T as template argument
|
|||
// to create a UserField.
|
|||
// -------------------------------------------------------------------------
|
|||
template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField |
|||
{ |
|||
public: |
|||
NCursesUserField (int rows, |
|||
int ncols, |
|||
int first_row = 0, |
|||
int first_col = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0), |
|||
int offscreen_rows = 0, |
|||
int additional_buffers = 0) |
|||
: NCursesFormField (rows, ncols, |
|||
first_row, first_col, |
|||
offscreen_rows, additional_buffers) { |
|||
if (field) |
|||
OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData))); |
|||
} |
|||
|
|||
virtual ~NCursesUserField() {}; |
|||
|
|||
inline const T* UserData (void) const { |
|||
return reinterpret_cast<const T*>(::field_userptr (field)); |
|||
} |
|||
|
|||
inline virtual void setUserData(const T* p_UserData) { |
|||
if (field) |
|||
OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData))); |
|||
} |
|||
}; |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// The same mechanism is used to attach user data to a form
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm |
|||
{ |
|||
protected: |
|||
// 'Internal' constructor, builds an object without association to a
|
|||
// field array.
|
|||
NCursesUserForm( int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0)) |
|||
: NCursesForm(nlines,ncols,begin_y,begin_x) { |
|||
if (form) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
} |
|||
|
|||
public: |
|||
NCursesUserForm (NCursesFormField Fields[], |
|||
const T* p_UserData = STATIC_CAST(T*)(0), |
|||
bool with_frame=FALSE, |
|||
bool autoDelete_Fields=FALSE) |
|||
: NCursesForm (Fields, with_frame, autoDelete_Fields) { |
|||
if (form) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
}; |
|||
|
|||
NCursesUserForm (NCursesFormField Fields[], |
|||
int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0), |
|||
bool with_frame=FALSE, |
|||
bool autoDelete_Fields=FALSE) |
|||
: NCursesForm (Fields, nlines, ncols, begin_y, begin_x, |
|||
with_frame, autoDelete_Fields) { |
|||
if (form) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
}; |
|||
|
|||
virtual ~NCursesUserForm() { |
|||
}; |
|||
|
|||
inline T* UserData (void) const { |
|||
return reinterpret_cast<T*>(get_user ()); |
|||
}; |
|||
|
|||
inline virtual void setUserData (const T* p_UserData) { |
|||
if (form) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
} |
|||
|
|||
}; |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// Builtin Fieldtypes
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
int min_field_width; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); |
|||
} |
|||
|
|||
public: |
|||
Alpha_Field(int width) |
|||
: NCursesFieldType(TYPE_ALPHA), |
|||
min_field_width(width) { |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
int min_field_width; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); |
|||
} |
|||
|
|||
public: |
|||
Alphanumeric_Field(int width) |
|||
: NCursesFieldType(TYPE_ALNUM), |
|||
min_field_width(width) { |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP Integer_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
int precision; |
|||
long lower_limit, upper_limit; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype, |
|||
precision,lower_limit,upper_limit)); |
|||
} |
|||
|
|||
public: |
|||
Integer_Field(int prec, long low=0L, long high=0L) |
|||
: NCursesFieldType(TYPE_INTEGER), |
|||
precision(prec), lower_limit(low), upper_limit(high) { |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
int precision; |
|||
double lower_limit, upper_limit; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype, |
|||
precision,lower_limit,upper_limit)); |
|||
} |
|||
|
|||
public: |
|||
Numeric_Field(int prec, double low=0.0, double high=0.0) |
|||
: NCursesFieldType(TYPE_NUMERIC), |
|||
precision(prec), lower_limit(low), upper_limit(high) { |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
char* regex; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype,regex)); |
|||
} |
|||
|
|||
void copy_regex(const char *source) |
|||
{ |
|||
regex = new char[1 + ::strlen(source)]; |
|||
(::strcpy)(regex, source); |
|||
} |
|||
|
|||
public: |
|||
Regular_Expression_Field(const char *expr) |
|||
: NCursesFieldType(TYPE_REGEXP), |
|||
regex(NULL) |
|||
{ |
|||
copy_regex(expr); |
|||
} |
|||
|
|||
Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
copy_regex(rhs.regex); |
|||
NCursesFieldType::operator=(rhs); |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
Regular_Expression_Field(const Regular_Expression_Field& rhs) |
|||
: NCursesFieldType(rhs), |
|||
regex(NULL) |
|||
{ |
|||
copy_regex(rhs.regex); |
|||
} |
|||
|
|||
~Regular_Expression_Field() { |
|||
delete[] regex; |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
const char** list; |
|||
int case_sensitive; |
|||
int non_unique_matches; |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype, |
|||
list,case_sensitive,non_unique_matches)); |
|||
} |
|||
public: |
|||
Enumeration_Field(const char* enums[], |
|||
bool case_sens=FALSE, |
|||
bool non_unique=FALSE) |
|||
: NCursesFieldType(TYPE_ENUM), |
|||
list(enums), |
|||
case_sensitive(case_sens ? -1 : 0), |
|||
non_unique_matches(non_unique ? -1 : 0) { |
|||
} |
|||
|
|||
Enumeration_Field& operator=(const Enumeration_Field& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
NCursesFieldType::operator=(rhs); |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
Enumeration_Field(const Enumeration_Field& rhs) |
|||
: NCursesFieldType(rhs), |
|||
list(rhs.list), |
|||
case_sensitive(rhs.case_sensitive), |
|||
non_unique_matches(rhs.non_unique_matches) |
|||
{ |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType |
|||
{ |
|||
private: |
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype)); |
|||
} |
|||
|
|||
public: |
|||
IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { |
|||
} |
|||
}; |
|||
|
|||
extern "C" { |
|||
bool _nc_xx_fld_fcheck(FIELD *, const void*); |
|||
bool _nc_xx_fld_ccheck(int c, const void *); |
|||
void* _nc_xx_fld_makearg(va_list*); |
|||
} |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// Abstract base class for User-Defined Fieldtypes
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
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
|
|||
// FIELDTYPE* element.
|
|||
static FIELDTYPE* generic_fieldtype; |
|||
|
|||
protected: |
|||
// This are the functions required by the low level libforms functions
|
|||
// to construct a fieldtype.
|
|||
friend bool _nc_xx_fld_fcheck(FIELD *, const void*); |
|||
friend bool _nc_xx_fld_ccheck(int c, const void *); |
|||
friend void* _nc_xx_fld_makearg(va_list*); |
|||
|
|||
void set(NCursesFormField& f) { |
|||
OnError(::set_field_type(f.get_field(),fieldtype,&f)); |
|||
} |
|||
|
|||
protected: |
|||
// Redefine this function to do a field validation. The argument
|
|||
// is a reference to the field you should validate.
|
|||
virtual bool field_check(NCursesFormField& f) = 0; |
|||
|
|||
// Redefine this function to do a character validation. The argument
|
|||
// is the character to be validated.
|
|||
virtual bool char_check (int c) = 0; |
|||
|
|||
public: |
|||
UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) { |
|||
} |
|||
}; |
|||
|
|||
extern "C" { |
|||
bool _nc_xx_next_choice(FIELD*, const void *); |
|||
bool _nc_xx_prev_choice(FIELD*, const void *); |
|||
} |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// Abstract base class for User-Defined Fieldtypes with Choice functions
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
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
|
|||
// generic lowlevel FIELDTYPE* element.
|
|||
static FIELDTYPE* generic_fieldtype_with_choice; |
|||
|
|||
// This are the functions required by the low level libforms functions
|
|||
// to construct a fieldtype with choice functions.
|
|||
friend bool _nc_xx_next_choice(FIELD*, const void *); |
|||
friend bool _nc_xx_prev_choice(FIELD*, const void *); |
|||
|
|||
protected: |
|||
// Redefine this function to do the retrieval of the next choice value.
|
|||
// The argument is a reference to the field tobe examined.
|
|||
virtual bool next (NCursesFormField& f) = 0; |
|||
|
|||
// Redefine this function to do the retrieval of the previous choice value.
|
|||
// The argument is a reference to the field tobe examined.
|
|||
virtual bool previous(NCursesFormField& f) = 0; |
|||
|
|||
public: |
|||
UserDefinedFieldType_With_Choice() { |
|||
fieldtype = generic_fieldtype_with_choice; |
|||
} |
|||
}; |
|||
|
|||
#endif /* NCURSES_CURSESF_H_incl */ |
@ -0,0 +1,672 @@ |
|||
// * This makes emacs happy -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2003,2005 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
// $Id: cursesm.h,v 1.25 2005/08/13 18:10:36 tom Exp $
|
|||
|
|||
#ifndef NCURSES_CURSESM_H_incl |
|||
#define NCURSES_CURSESM_H_incl 1 |
|||
|
|||
#include <ncurses/cursesp.h> |
|||
|
|||
extern "C" { |
|||
# include <ncurses/menu.h> |
|||
} |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// This wraps the ITEM type of <ncurses/menu.h>
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP NCursesMenuItem |
|||
{ |
|||
friend class NCursesMenu; |
|||
|
|||
protected: |
|||
ITEM *item; |
|||
|
|||
inline void OnError (int err) const THROWS(NCursesMenuException) { |
|||
if (err != E_OK) |
|||
THROW(new NCursesMenuException (err)); |
|||
} |
|||
|
|||
public: |
|||
NCursesMenuItem (const char* p_name = NULL, |
|||
const char* p_descript = NULL) |
|||
: item(0) |
|||
{ |
|||
item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0); |
|||
if (p_name && !item) |
|||
OnError (E_SYSTEM_ERROR); |
|||
} |
|||
// Create an item. If you pass both parameters as NULL, a delimiting
|
|||
// item is constructed which can be used to terminate a list of
|
|||
// NCursesMenu objects.
|
|||
|
|||
NCursesMenuItem& operator=(const NCursesMenuItem& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesMenuItem(const NCursesMenuItem& rhs) |
|||
: item(0) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesMenuItem (); |
|||
// Release the items memory
|
|||
|
|||
inline const char* name () const { |
|||
return ::item_name (item); |
|||
} |
|||
// Name of the item
|
|||
|
|||
inline const char* description () const { |
|||
return ::item_description (item); |
|||
} |
|||
// Description of the item
|
|||
|
|||
inline int (index) (void) const { |
|||
return ::item_index (item); |
|||
} |
|||
// Index of the item in an item array (or -1)
|
|||
|
|||
inline void options_on (Item_Options opts) { |
|||
OnError (::item_opts_on (item, opts)); |
|||
} |
|||
// Switch on the items options
|
|||
|
|||
inline void options_off (Item_Options opts) { |
|||
OnError (::item_opts_off (item, opts)); |
|||
} |
|||
// Switch off the item's option
|
|||
|
|||
inline Item_Options options () const { |
|||
return ::item_opts (item); |
|||
} |
|||
// Retrieve the items options
|
|||
|
|||
inline void set_options (Item_Options opts) { |
|||
OnError (::set_item_opts (item, opts)); |
|||
} |
|||
// Set the items options
|
|||
|
|||
inline void set_value (bool f) { |
|||
OnError (::set_item_value (item,f)); |
|||
} |
|||
// Set/Reset the items selection state
|
|||
|
|||
inline bool value () const { |
|||
return ::item_value (item); |
|||
} |
|||
// Retrieve the items selection state
|
|||
|
|||
inline bool visible () const { |
|||
return ::item_visible (item); |
|||
} |
|||
// Retrieve visibility of the item
|
|||
|
|||
virtual bool action(); |
|||
// Perform an action associated with this item; you may use this in an
|
|||
// user supplied driver for a menu; you may derive from this class and
|
|||
// overload action() to supply items with different actions.
|
|||
// If an action returns true, the menu will be exited. The default action
|
|||
// is to do nothing.
|
|||
}; |
|||
|
|||
// Prototype for an items callback function.
|
|||
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 NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem |
|||
{ |
|||
private: |
|||
ITEMCALLBACK* p_fct; |
|||
|
|||
public: |
|||
NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL, |
|||
const char* p_name = NULL, |
|||
const char* p_descript = NULL ) |
|||
: NCursesMenuItem (p_name, p_descript), |
|||
p_fct (fct) { |
|||
} |
|||
|
|||
NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) |
|||
: NCursesMenuItem(rhs), |
|||
p_fct(0) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesMenuCallbackItem(); |
|||
|
|||
bool action(); |
|||
}; |
|||
|
|||
// This are the built-in hook functions in this C++ binding. In C++ we use
|
|||
// virtual member functions (see below On_..._Init and On_..._Termination)
|
|||
// to provide this functionality in an object oriented manner.
|
|||
extern "C" { |
|||
void _nc_xx_mnu_init(MENU *); |
|||
void _nc_xx_mnu_term(MENU *); |
|||
void _nc_xx_itm_init(MENU *); |
|||
void _nc_xx_itm_term(MENU *); |
|||
} |
|||
|
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// This wraps the MENU type of <ncurses/menu.h>
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
class NCURSES_IMPEXP NCursesMenu : public NCursesPanel |
|||
{ |
|||
protected: |
|||
MENU *menu; |
|||
|
|||
private: |
|||
NCursesWindow* sub; // the subwindow object
|
|||
bool b_sub_owner; // is this our own subwindow?
|
|||
bool b_framed; // has the menu a border?
|
|||
bool b_autoDelete; // Delete items when deleting menu?
|
|||
|
|||
NCursesMenuItem** my_items; // The array of items for this menu
|
|||
|
|||
// This structure is used for the menu's user data field to link the
|
|||
// MENU* to the C++ object and to provide extra space for a user pointer.
|
|||
typedef struct { |
|||
void* m_user; // the pointer for the user's data
|
|||
const NCursesMenu* m_back; // backward pointer to C++ object
|
|||
const MENU* m_owner; |
|||
} UserHook; |
|||
|
|||
// Get the backward pointer to the C++ object from a MENU
|
|||
static inline NCursesMenu* getHook(const MENU *m) { |
|||
UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); |
|||
assert(hook != 0 && hook->m_owner==m); |
|||
return const_cast<NCursesMenu*>(hook->m_back); |
|||
} |
|||
|
|||
friend void _nc_xx_mnu_init(MENU *); |
|||
friend void _nc_xx_mnu_term(MENU *); |
|||
friend void _nc_xx_itm_init(MENU *); |
|||
friend void _nc_xx_itm_term(MENU *); |
|||
|
|||
// Calculate ITEM* array for the menu
|
|||
ITEM** mapItems(NCursesMenuItem* nitems[]); |
|||
|
|||
protected: |
|||
// internal routines
|
|||
inline void set_user(void *user) { |
|||
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); |
|||
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); |
|||
uptr->m_user = user; |
|||
} |
|||
|
|||
inline void *get_user() { |
|||
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); |
|||
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); |
|||
return uptr->m_user; |
|||
} |
|||
|
|||
void InitMenu (NCursesMenuItem* menu[], |
|||
bool with_frame, |
|||
bool autoDeleteItems); |
|||
|
|||
inline void OnError (int err) const THROWS(NCursesMenuException) { |
|||
if (err != E_OK) |
|||
THROW(new NCursesMenuException (this, err)); |
|||
} |
|||
|
|||
// this wraps the menu_driver call.
|
|||
virtual int driver (int c) ; |
|||
|
|||
// 'Internal' constructor to create a menu without association to
|
|||
// an array of items.
|
|||
NCursesMenu( int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0) |
|||
: NCursesPanel(nlines,ncols,begin_y,begin_x), |
|||
menu (STATIC_CAST(MENU*)(0)), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_items(0) |
|||
{ |
|||
} |
|||
|
|||
public: |
|||
// Make a full window size menu
|
|||
NCursesMenu (NCursesMenuItem* Items[], |
|||
bool with_frame=FALSE, // Reserve space for a frame?
|
|||
bool autoDelete_Items=FALSE) // Autocleanup of Items?
|
|||
: NCursesPanel(), |
|||
menu(0), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_items(0) |
|||
{ |
|||
InitMenu(Items, with_frame, autoDelete_Items); |
|||
} |
|||
|
|||
// Make a menu with a window of this size.
|
|||
NCursesMenu (NCursesMenuItem* Items[], |
|||
int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
bool with_frame=FALSE, // Reserve space for a frame?
|
|||
bool autoDelete_Items=FALSE) // Autocleanup of Items?
|
|||
: NCursesPanel(nlines, ncols, begin_y, begin_x), |
|||
menu(0), |
|||
sub(0), |
|||
b_sub_owner(0), |
|||
b_framed(0), |
|||
b_autoDelete(0), |
|||
my_items(0) |
|||
{ |
|||
InitMenu(Items, with_frame, autoDelete_Items); |
|||
} |
|||
|
|||
NCursesMenu& operator=(const NCursesMenu& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
NCursesPanel::operator=(rhs); |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesMenu(const NCursesMenu& rhs) |
|||
: NCursesPanel(rhs), |
|||
menu(rhs.menu), |
|||
sub(rhs.sub), |
|||
b_sub_owner(rhs.b_sub_owner), |
|||
b_framed(rhs.b_framed), |
|||
b_autoDelete(rhs.b_autoDelete), |
|||
my_items(rhs.my_items) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesMenu (); |
|||
|
|||
// Retrieve the menus subwindow
|
|||
inline NCursesWindow& subWindow() const { |
|||
assert(sub!=NULL); |
|||
return *sub; |
|||
} |
|||
|
|||
// Set the menus subwindow
|
|||
void setSubWindow(NCursesWindow& sub); |
|||
|
|||
// Set these items for the menu
|
|||
inline void setItems(NCursesMenuItem* Items[]) { |
|||
OnError(::set_menu_items(menu,mapItems(Items))); |
|||
} |
|||
|
|||
// Remove the menu from the screen
|
|||
inline void unpost (void) { |
|||
OnError (::unpost_menu (menu)); |
|||
} |
|||
|
|||
// Post the menu to the screen if flag is true, unpost it otherwise
|
|||
inline void post(bool flag = TRUE) { |
|||
flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); |
|||
} |
|||
|
|||
// Get the numer of rows and columns for this menu
|
|||
inline void scale (int& mrows, int& mcols) const { |
|||
OnError (::scale_menu (menu, &mrows, &mcols)); |
|||
} |
|||
|
|||
// Set the format of this menu
|
|||
inline void set_format(int mrows, int mcols) { |
|||
OnError (::set_menu_format(menu, mrows, mcols)); |
|||
} |
|||
|
|||
// Get the format of this menu
|
|||
inline void menu_format(int& rows,int& ncols) { |
|||
::menu_format(menu,&rows,&ncols); |
|||
} |
|||
|
|||
// Items of the menu
|
|||
inline NCursesMenuItem* items() const { |
|||
return *my_items; |
|||
} |
|||
|
|||
// Get the number of items in this menu
|
|||
inline int count() const { |
|||
return ::item_count(menu); |
|||
} |
|||
|
|||
// Get the current item (i.e. the one the cursor is located)
|
|||
inline NCursesMenuItem* current_item() const { |
|||
return my_items[::item_index(::current_item(menu))]; |
|||
} |
|||
|
|||
// Get the marker string
|
|||
inline const char* mark() const { |
|||
return ::menu_mark(menu); |
|||
} |
|||
|
|||
// Set the marker string
|
|||
inline void set_mark(const char *marker) { |
|||
OnError (::set_menu_mark (menu, marker)); |
|||
} |
|||
|
|||
// Get the name of the request code c
|
|||
inline static const char* request_name(int c) { |
|||
return ::menu_request_name(c); |
|||
} |
|||
|
|||
// Get the current pattern
|
|||
inline char* pattern() const { |
|||
return ::menu_pattern(menu); |
|||
} |
|||
|
|||
// true if there is a pattern match, false otherwise.
|
|||
bool set_pattern (const char *pat); |
|||
|
|||
// set the default attributes for the menu
|
|||
// i.e. set fore, back and grey attribute
|
|||
virtual void setDefaultAttributes(); |
|||
|
|||
// Get the menus background attributes
|
|||
inline chtype back() const { |
|||
return ::menu_back(menu); |
|||
} |
|||
|
|||
// Get the menus foreground attributes
|
|||
inline chtype fore() const { |
|||
return ::menu_fore(menu); |
|||
} |
|||
|
|||
// Get the menus grey attributes (used for unselectable items)
|
|||
inline chtype grey() const { |
|||
return ::menu_grey(menu); |
|||
} |
|||
|
|||
// Set the menus background attributes
|
|||
inline chtype set_background(chtype a) { |
|||
return ::set_menu_back(menu,a); |
|||
} |
|||
|
|||
// Set the menus foreground attributes
|
|||
inline chtype set_foreground(chtype a) { |
|||
return ::set_menu_fore(menu,a); |
|||
} |
|||
|
|||
// Set the menus grey attributes (used for unselectable items)
|
|||
inline chtype set_grey(chtype a) { |
|||
return ::set_menu_grey(menu,a); |
|||
} |
|||
|
|||
inline void options_on (Menu_Options opts) { |
|||
OnError (::menu_opts_on (menu,opts)); |
|||
} |
|||
|
|||
inline void options_off(Menu_Options opts) { |
|||
OnError (::menu_opts_off(menu,opts)); |
|||
} |
|||
|
|||
inline Menu_Options options() const { |
|||
return ::menu_opts(menu); |
|||
} |
|||
|
|||
inline void set_options (Menu_Options opts) { |
|||
OnError (::set_menu_opts (menu,opts)); |
|||
} |
|||
|
|||
inline int pad() const { |
|||
return ::menu_pad(menu); |
|||
} |
|||
|
|||
inline void set_pad (int padch) { |
|||
OnError (::set_menu_pad (menu, padch)); |
|||
} |
|||
|
|||
// Position the cursor to the current item
|
|||
inline void position_cursor () const { |
|||
OnError (::pos_menu_cursor (menu)); |
|||
} |
|||
|
|||
// Set the current item
|
|||
inline void set_current(NCursesMenuItem& I) { |
|||
OnError (::set_current_item(menu, I.item)); |
|||
} |
|||
|
|||
// Get the current top row of the menu
|
|||
inline int top_row (void) const { |
|||
return ::top_row (menu); |
|||
} |
|||
|
|||
// Set the current top row of the menu
|
|||
inline void set_top_row (int row) { |
|||
OnError (::set_top_row (menu, row)); |
|||
} |
|||
|
|||
// spacing control
|
|||
// Set the spacing for the menu
|
|||
inline void setSpacing(int spc_description, |
|||
int spc_rows, |
|||
int spc_columns) { |
|||
OnError(::set_menu_spacing(menu, |
|||
spc_description, |
|||
spc_rows, |
|||
spc_columns)); |
|||
} |
|||
|
|||
// Get the spacing info for the menu
|
|||
inline void Spacing(int& spc_description, |
|||
int& spc_rows, |
|||
int& spc_columns) const { |
|||
OnError(::menu_spacing(menu, |
|||
&spc_description, |
|||
&spc_rows, |
|||
&spc_columns)); |
|||
} |
|||
|
|||
// Decorations
|
|||
inline void frame(const char *title=NULL, const char* btitle=NULL) { |
|||
if (b_framed) |
|||
NCursesPanel::frame(title,btitle); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
inline void boldframe(const char *title=NULL, const char* btitle=NULL) { |
|||
if (b_framed) |
|||
NCursesPanel::boldframe(title,btitle); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
inline void label(const char *topLabel, const char *bottomLabel) { |
|||
if (b_framed) |
|||
NCursesPanel::label(topLabel,bottomLabel); |
|||
else |
|||
OnError(E_SYSTEM_ERROR); |
|||
} |
|||
|
|||
// -----
|
|||
// Hooks
|
|||
// -----
|
|||
|
|||
// Called after the menu gets repositioned in its window.
|
|||
// This is especially true if the menu is posted.
|
|||
virtual void On_Menu_Init(); |
|||
|
|||
// Called before the menu gets repositioned in its window.
|
|||
// This is especially true if the menu is unposted.
|
|||
virtual void On_Menu_Termination(); |
|||
|
|||
// Called after the item became the current item
|
|||
virtual void On_Item_Init(NCursesMenuItem& item); |
|||
|
|||
// Called before this item is left as current item.
|
|||
virtual void On_Item_Termination(NCursesMenuItem& item); |
|||
|
|||
// Provide a default key virtualization. Translate the keyboard
|
|||
// code c into a menu request code.
|
|||
// The default implementation provides a hopefully straightforward
|
|||
// mapping for the most common keystrokes and menu requests.
|
|||
virtual int virtualize(int c); |
|||
|
|||
|
|||
// Operators
|
|||
inline NCursesMenuItem* operator[](int i) const { |
|||
if ( (i < 0) || (i >= ::item_count (menu)) ) |
|||
OnError (E_BAD_ARGUMENT); |
|||
return (my_items[i]); |
|||
} |
|||
|
|||
// Perform the menu's operation
|
|||
// Return the item where you left the selection mark for a single
|
|||
// selection menu, or NULL for a multivalued menu.
|
|||
virtual NCursesMenuItem* operator()(void); |
|||
|
|||
// --------------------
|
|||
// Exception handlers
|
|||
// Called by operator()
|
|||
// --------------------
|
|||
|
|||
// Called if the request is denied
|
|||
virtual void On_Request_Denied(int c) const; |
|||
|
|||
// Called if the item is not selectable
|
|||
virtual void On_Not_Selectable(int c) const; |
|||
|
|||
// Called if pattern doesn't match
|
|||
virtual void On_No_Match(int c) const; |
|||
|
|||
// Called if the command is unknown
|
|||
virtual void On_Unknown_Command(int c) const; |
|||
|
|||
}; |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// This is the typical C++ typesafe way to allow to attach
|
|||
// user data to an item of a menu. Its assumed that the user
|
|||
// data belongs to some class T. Use T as template argument
|
|||
// to create a UserItem.
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem |
|||
{ |
|||
public: |
|||
NCursesUserItem (const char* p_name, |
|||
const char* p_descript = NULL, |
|||
const T* p_UserData = STATIC_CAST(T*)(0)) |
|||
: NCursesMenuItem (p_name, p_descript) { |
|||
if (item) |
|||
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void*>(p_UserData)))); |
|||
} |
|||
|
|||
virtual ~NCursesUserItem() {} |
|||
|
|||
inline const T* UserData (void) const { |
|||
return reinterpret_cast<const T*>(::item_userptr (item)); |
|||
}; |
|||
|
|||
inline virtual void setUserData(const T* p_UserData) { |
|||
if (item) |
|||
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void *>(p_UserData)))); |
|||
} |
|||
}; |
|||
//
|
|||
// -------------------------------------------------------------------------
|
|||
// The same mechanism is used to attach user data to a menu
|
|||
// -------------------------------------------------------------------------
|
|||
//
|
|||
template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu |
|||
{ |
|||
protected: |
|||
NCursesUserMenu( int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0)) |
|||
: NCursesMenu(nlines,ncols,begin_y,begin_x) { |
|||
if (menu) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
} |
|||
|
|||
public: |
|||
NCursesUserMenu (NCursesMenuItem Items[], |
|||
const T* p_UserData = STATIC_CAST(T*)(0), |
|||
bool with_frame=FALSE, |
|||
bool autoDelete_Items=FALSE) |
|||
: NCursesMenu (Items, with_frame, autoDelete_Items) { |
|||
if (menu) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
}; |
|||
|
|||
NCursesUserMenu (NCursesMenuItem Items[], |
|||
int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0), |
|||
bool with_frame=FALSE) |
|||
: NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { |
|||
if (menu) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
}; |
|||
|
|||
virtual ~NCursesUserMenu() { |
|||
}; |
|||
|
|||
inline T* UserData (void) const { |
|||
return reinterpret_cast<T*>(get_user ()); |
|||
}; |
|||
|
|||
inline virtual void setUserData (const T* p_UserData) { |
|||
if (menu) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
} |
|||
}; |
|||
|
|||
#endif /* NCURSES_CURSESM_H_incl */ |
@ -0,0 +1,268 @@ |
|||
// * This makes emacs happy -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2007,2008 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
#ifndef NCURSES_CURSESP_H_incl |
|||
#define NCURSES_CURSESP_H_incl 1 |
|||
|
|||
// $Id: cursesp.h,v 1.29 2008/08/16 17:20:23 tom Exp $
|
|||
|
|||
#include <ncurses/cursesw.h> |
|||
|
|||
extern "C" { |
|||
# include <ncurses/panel.h> |
|||
} |
|||
|
|||
class NCURSES_IMPEXP NCursesPanel |
|||
: public NCursesWindow |
|||
{ |
|||
protected: |
|||
PANEL *p; |
|||
static NCursesPanel *dummy; |
|||
|
|||
private: |
|||
// This structure is used for the panel's user data field to link the
|
|||
// PANEL* to the C++ object and to provide extra space for a user pointer.
|
|||
typedef struct { |
|||
void* m_user; // the pointer for the user's data
|
|||
const NCursesPanel* m_back; // backward pointer to C++ object
|
|||
const PANEL* m_owner; // the panel itself
|
|||
} UserHook; |
|||
|
|||
inline UserHook *UserPointer() |
|||
{ |
|||
UserHook* uptr = reinterpret_cast<UserHook*>( |
|||
const_cast<void *>(::panel_userptr (p))); |
|||
return uptr; |
|||
} |
|||
|
|||
void init(); // Initialize the panel object
|
|||
|
|||
protected: |
|||
void set_user(void *user) |
|||
{ |
|||
UserHook* uptr = UserPointer(); |
|||
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) { |
|||
uptr->m_user = user; |
|||
} |
|||
} |
|||
// Set the user pointer of the panel.
|
|||
|
|||
void *get_user() |
|||
{ |
|||
UserHook* uptr = UserPointer(); |
|||
void *result = 0; |
|||
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) |
|||
result = uptr->m_user; |
|||
return result; |
|||
} |
|||
|
|||
void OnError (int err) const THROWS(NCursesPanelException) |
|||
{ |
|||
if (err==ERR) |
|||
THROW(new NCursesPanelException (this, err)); |
|||
} |
|||
// If err is equal to the curses error indicator ERR, an error handler
|
|||
// is called.
|
|||
|
|||
// Get a keystroke. Default implementation calls getch()
|
|||
virtual int getKey(void); |
|||
|
|||
public: |
|||
NCursesPanel(int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0) |
|||
: NCursesWindow(nlines,ncols,begin_y,begin_x), p(0) |
|||
{ |
|||
init(); |
|||
} |
|||
// Create a panel with this size starting at the requested position.
|
|||
|
|||
NCursesPanel() |
|||
: NCursesWindow(::stdscr), p(0) |
|||
{ |
|||
init(); |
|||
} |
|||
// This constructor creates the default Panel associated with the
|
|||
// ::stdscr window
|
|||
|
|||
NCursesPanel& operator=(const NCursesPanel& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
NCursesWindow::operator=(rhs); |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesPanel(const NCursesPanel& rhs) |
|||
: NCursesWindow(rhs), |
|||
p(rhs.p) |
|||
{ |
|||
} |
|||
|
|||
virtual ~NCursesPanel(); |
|||
|
|||
// basic manipulation
|
|||
inline void hide() |
|||
{ |
|||
OnError (::hide_panel(p)); |
|||
} |
|||
// Hide the panel. It stays in the stack but becomes invisible.
|
|||
|
|||
inline void show() |
|||
{ |
|||
OnError (::show_panel(p)); |
|||
} |
|||
// Show the panel, i.e. make it visible.
|
|||
|
|||
inline void top() |
|||
{ |
|||
OnError (::top_panel(p)); |
|||
} |
|||
// Make this panel the top panel in the stack.
|
|||
|
|||
inline void bottom() |
|||
{ |
|||
OnError (::bottom_panel(p)); |
|||
} |
|||
// Make this panel the bottom panel in the stack.
|
|||
// N.B.: The panel associated with ::stdscr is always on the bottom. So
|
|||
// actually bottom() makes the panel the first above ::stdscr.
|
|||
|
|||
virtual int mvwin(int y, int x) |
|||
{ |
|||
OnError(::move_panel(p, y, x)); |
|||
return OK; |
|||
} |
|||
|
|||
inline bool hidden() const |
|||
{ |
|||
return (::panel_hidden (p) ? TRUE : FALSE); |
|||
} |
|||
// Return TRUE if the panel is hidden, FALSE otherwise.
|
|||
|
|||
/* The functions panel_above() and panel_below() are not reflected in
|
|||
the NCursesPanel class. The reason for this is, that we cannot |
|||
assume that a panel retrieved by those operations is one wrapped |
|||
by a C++ class. Although this situation might be handled, we also |
|||
need a reverse mapping from PANEL to NCursesPanel which needs some |
|||
redesign of the low level stuff. At the moment, we define them in the |
|||
interface but they will always produce an error. */ |
|||
inline NCursesPanel& above() const |
|||
{ |
|||
OnError(ERR); |
|||
return *dummy; |
|||
} |
|||
|
|||
inline NCursesPanel& below() const |
|||
{ |
|||
OnError(ERR); |
|||
return *dummy; |
|||
} |
|||
|
|||
// Those two are rewrites of the corresponding virtual members of
|
|||
// NCursesWindow
|
|||
virtual int refresh(); |
|||
// Propagate all panel changes to the virtual screen and update the
|
|||
// physical screen.
|
|||
|
|||
virtual int noutrefresh(); |
|||
// Propagate all panel changes to the virtual screen.
|
|||
|
|||
static void redraw(); |
|||
// Redraw all panels.
|
|||
|
|||
// decorations
|
|||
virtual void frame(const char* title=NULL, |
|||
const char* btitle=NULL); |
|||
// Put a frame around the panel and put the title centered in the top line
|
|||
// and btitle in the bottom line.
|
|||
|
|||
virtual void boldframe(const char* title=NULL, |
|||
const char* btitle=NULL); |
|||
// Same as frame(), but use highlighted attributes.
|
|||
|
|||
virtual void label(const char* topLabel, |
|||
const char* bottomLabel); |
|||
// Put the title centered in the top line and btitle in the bottom line.
|
|||
|
|||
virtual void centertext(int row,const char* label); |
|||
// Put the label text centered in the specified row.
|
|||
}; |
|||
|
|||
/* We use templates to provide a typesafe mechanism to associate
|
|||
* user data with a panel. A NCursesUserPanel<T> is a panel |
|||
* associated with some user data of type T. |
|||
*/ |
|||
template<class T> class NCursesUserPanel : public NCursesPanel |
|||
{ |
|||
public: |
|||
NCursesUserPanel (int nlines, |
|||
int ncols, |
|||
int begin_y = 0, |
|||
int begin_x = 0, |
|||
const T* p_UserData = STATIC_CAST(T*)(0)) |
|||
: NCursesPanel (nlines, ncols, begin_y, begin_x) |
|||
{ |
|||
if (p) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
}; |
|||
// This creates an user panel of the requested size with associated
|
|||
// user data pointed to by p_UserData.
|
|||
|
|||
NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() |
|||
{ |
|||
if (p) |
|||
set_user(const_cast<void *>(p_UserData)); |
|||
}; |
|||
// This creates an user panel associated with the ::stdscr and user data
|
|||
// pointed to by p_UserData.
|
|||
|
|||
virtual ~NCursesUserPanel() {}; |
|||
|
|||
T* UserData (void) const |
|||
{ |
|||
return reinterpret_cast<T*>(get_user ()); |
|||
}; |
|||
// Retrieve the user data associated with the panel.
|
|||
|
|||
virtual void setUserData (const T* p_UserData) |
|||
{ |
|||
if (p) |
|||
set_user (const_cast<void *>(p_UserData)); |
|||
} |
|||
// Associate the user panel with the user data pointed to by p_UserData.
|
|||
}; |
|||
|
|||
#endif /* NCURSES_CURSESP_H_incl */ |
File diff suppressed because it is too large
@ -0,0 +1,238 @@ |
|||
// * this is for making emacs happy: -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2003,2005 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $
|
|||
|
|||
#ifndef NCURSES_CURSSLK_H_incl |
|||
#define NCURSES_CURSSLK_H_incl |
|||
|
|||
#include <ncurses/cursesw.h> |
|||
|
|||
class NCURSES_IMPEXP Soft_Label_Key_Set { |
|||
public: |
|||
// This inner class represents the attributes of a Soft Label Key (SLK)
|
|||
class NCURSES_IMPEXP Soft_Label_Key { |
|||
friend class Soft_Label_Key_Set; |
|||
public: |
|||
typedef enum { Left=0, Center=1, Right=2 } Justification; |
|||
|
|||
private: |
|||
char *label; // The Text of the Label
|
|||
Justification format; // The Justification
|
|||
int num; // The number of the Label
|
|||
|
|||
Soft_Label_Key() : label(NULL), format(Left), num(-1) { |
|||
} |
|||
|
|||
virtual ~Soft_Label_Key() { |
|||
delete[] label; |
|||
}; |
|||
|
|||
public: |
|||
// Set the text of the Label
|
|||
Soft_Label_Key& operator=(char *text); |
|||
|
|||
// Set the Justification of the Label
|
|||
Soft_Label_Key& operator=(Justification just) { |
|||
format = just; |
|||
return *this; |
|||
} |
|||
|
|||
// Retrieve the text of the label
|
|||
inline char* operator()(void) const { |
|||
return label; |
|||
} |
|||
|
|||
Soft_Label_Key& operator=(const Soft_Label_Key& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
Soft_Label_Key(const Soft_Label_Key& rhs) |
|||
: label(NULL), |
|||
format(rhs.format), |
|||
num(rhs.num) |
|||
{ |
|||
*this = rhs.label; |
|||
} |
|||
}; |
|||
|
|||
public: |
|||
typedef enum { |
|||
None = -1, |
|||
Three_Two_Three = 0, |
|||
Four_Four = 1, |
|||
PC_Style = 2, |
|||
PC_Style_With_Index = 3 |
|||
} Label_Layout; |
|||
|
|||
private: |
|||
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
|
|||
|
|||
// Init the Key Set
|
|||
void init(); |
|||
|
|||
// Activate or Deactivate Label# i, Label counting starts with 1!
|
|||
void activate_label(int i, bool bf=TRUE); |
|||
|
|||
// Activate of Deactivate all Labels
|
|||
void activate_labels(bool bf); |
|||
|
|||
protected: |
|||
inline void Error (const char* msg) const THROWS(NCursesException) { |
|||
THROW(new NCursesException (msg)); |
|||
} |
|||
|
|||
// Remove SLK's from screen
|
|||
void clear() { |
|||
if (ERR==::slk_clear()) |
|||
Error("slk_clear"); |
|||
} |
|||
|
|||
// Restore them
|
|||
void restore() { |
|||
if (ERR==::slk_restore()) |
|||
Error("slk_restore"); |
|||
} |
|||
|
|||
public: |
|||
|
|||
// Construct a Key Set, use the most comfortable layout as default.
|
|||
// You must create a Soft_Label_Key_Set before you create any object of
|
|||
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
|
|||
// ::initscr() is called).
|
|||
Soft_Label_Key_Set(Label_Layout fmt); |
|||
|
|||
// This constructor assumes, that you already constructed a Key Set
|
|||
// with a layout by the constructor above. This layout will be reused.
|
|||
NCURSES_IMPEXP Soft_Label_Key_Set(); |
|||
|
|||
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
*this = rhs; |
|||
init(); // allocate a new slk_array[]
|
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) |
|||
: b_attrInit(rhs.b_attrInit), |
|||
slk_array(NULL) |
|||
{ |
|||
init(); // allocate a new slk_array[]
|
|||
} |
|||
|
|||
virtual ~Soft_Label_Key_Set(); |
|||
|
|||
// Get Label# i. Label counting starts with 1!
|
|||
NCURSES_IMPEXP Soft_Label_Key& operator[](int i); |
|||
|
|||
// Retrieve number of Labels
|
|||
inline int labels() const { return num_labels; } |
|||
|
|||
// Refresh the SLK portion of the screen
|
|||
inline void refresh() { |
|||
if (ERR==::slk_refresh()) |
|||
Error("slk_refresh"); |
|||
} |
|||
|
|||
// Mark the SLK portion of the screen for refresh, defer actual refresh
|
|||
// until next update call.
|
|||
inline void noutrefresh() { |
|||
if (ERR==::slk_noutrefresh()) |
|||
Error("slk_noutrefresh"); |
|||
} |
|||
|
|||
// Mark the whole SLK portion of the screen as modified
|
|||
inline void touch() { |
|||
if (ERR==::slk_touch()) |
|||
Error("slk_touch"); |
|||
} |
|||
|
|||
// Activate Label# i
|
|||
inline void show(int i) { |
|||
activate_label(i,FALSE); |
|||
activate_label(i,TRUE); |
|||
} |
|||
|
|||
// Hide Label# i
|
|||
inline void hide(int i) { |
|||
activate_label(i,FALSE); |
|||
} |
|||
|
|||
// Show all Labels
|
|||
inline void show() { |
|||
activate_labels(FALSE); |
|||
activate_labels(TRUE); |
|||
} |
|||
|
|||
// Hide all Labels
|
|||
inline void hide() { |
|||
activate_labels(FALSE); |
|||
} |
|||
|
|||
inline void attron(attr_t attrs) { |
|||
if (ERR==::slk_attron(attrs)) |
|||
Error("slk_attron"); |
|||
} |
|||
|
|||
inline void attroff(attr_t attrs) { |
|||
if (ERR==::slk_attroff(attrs)) |
|||
Error("slk_attroff"); |
|||
} |
|||
|
|||
inline void attrset(attr_t attrs) { |
|||
if (ERR==::slk_attrset(attrs)) |
|||
Error("slk_attrset"); |
|||
} |
|||
|
|||
inline void color(short color_pair_number) { |
|||
if (ERR==::slk_color(color_pair_number)) |
|||
Error("slk_color"); |
|||
} |
|||
|
|||
inline attr_t attr() const { |
|||
return ::slk_attr(); |
|||
} |
|||
}; |
|||
|
|||
#endif /* NCURSES_CURSSLK_H_incl */ |
@ -0,0 +1,54 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2002,2003 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1995,1997 * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ |
|||
|
|||
#ifndef NCURSES_ETI_H_incl |
|||
#define NCURSES_ETI_H_incl 1 |
|||
|
|||
#define E_OK (0) |
|||
#define E_SYSTEM_ERROR (-1) |
|||
#define E_BAD_ARGUMENT (-2) |
|||
#define E_POSTED (-3) |
|||
#define E_CONNECTED (-4) |
|||
#define E_BAD_STATE (-5) |
|||
#define E_NO_ROOM (-6) |
|||
#define E_NOT_POSTED (-7) |
|||
#define E_UNKNOWN_COMMAND (-8) |
|||
#define E_NO_MATCH (-9) |
|||
#define E_NOT_SELECTABLE (-10) |
|||
#define E_NOT_CONNECTED (-11) |
|||
#define E_REQUEST_DENIED (-12) |
|||
#define E_INVALID_FIELD (-13) |
|||
#define E_CURRENT (-14) |
|||
|
|||
#endif |
@ -0,0 +1,378 @@ |
|||
// * This makes emacs happy -*-Mode: C++;-*-
|
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2007,2008 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1997 * |
|||
****************************************************************************/ |
|||
|
|||
// $Id: etip.h.in,v 1.37 2008/08/30 19:27:32 tom Exp $
|
|||
|
|||
#ifndef NCURSES_ETIP_H_incl |
|||
#define NCURSES_ETIP_H_incl 1 |
|||
|
|||
// These are substituted at configure/build time
|
|||
#ifndef HAVE_BUILTIN_H |
|||
#define HAVE_BUILTIN_H 0 |
|||
#endif |
|||
|
|||
#ifndef HAVE_GXX_BUILTIN_H |
|||
#define HAVE_GXX_BUILTIN_H 0 |
|||
#endif |
|||
|
|||
#ifndef HAVE_GPP_BUILTIN_H |
|||
#define HAVE_GPP_BUILTIN_H 0 |
|||
#endif |
|||
|
|||
#ifndef HAVE_IOSTREAM |
|||
#define HAVE_IOSTREAM 1 |
|||
#endif |
|||
|
|||
#ifndef HAVE_TYPEINFO |
|||
#define HAVE_TYPEINFO 1 |
|||
#endif |
|||
|
|||
#ifndef HAVE_VALUES_H |
|||
#define HAVE_VALUES_H 0 |
|||
#endif |
|||
|
|||
#ifndef ETIP_NEEDS_MATH_H |
|||
#define ETIP_NEEDS_MATH_H 0 |
|||
#endif |
|||
|
|||
#ifndef ETIP_NEEDS_MATH_EXCEPTION |
|||
#define ETIP_NEEDS_MATH_EXCEPTION 0 |
|||
#endif |
|||
|
|||
#ifndef CPP_HAS_PARAM_INIT |
|||
#define CPP_HAS_PARAM_INIT 0 |
|||
#endif |
|||
|
|||
#ifndef CPP_HAS_STATIC_CAST |
|||
#define CPP_HAS_STATIC_CAST 1 |
|||
#endif |
|||
|
|||
#ifndef IOSTREAM_NAMESPACE |
|||
#define IOSTREAM_NAMESPACE 1 |
|||
#endif |
|||
|
|||
#ifdef __GNUG__ |
|||
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) |
|||
# if HAVE_TYPEINFO |
|||
# include <typeinfo> |
|||
# endif |
|||
# endif |
|||
#endif |
|||
|
|||
#if defined(__GNUG__) |
|||
# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H |
|||
# if ETIP_NEEDS_MATH_H |
|||
# if ETIP_NEEDS_MATH_EXCEPTION |
|||
# undef exception |
|||
# define exception math_exception |
|||
# endif |
|||
# include <math.h> |
|||
# endif |
|||
# undef exception |
|||
# define exception builtin_exception |
|||
# if HAVE_GPP_BUILTIN_H |
|||
# include <gpp/builtin.h> |
|||
# elif HAVE_GXX_BUILTIN_H |
|||
# include <g++/builtin.h> |
|||
# else |
|||
# include <builtin.h> |
|||
# endif |
|||
# undef exception |
|||
# endif |
|||
#elif defined (__SUNPRO_CC) |
|||
# include <generic.h> |
|||
#endif |
|||
|
|||
#include <ncurses/ncurses_dll.h> |
|||
|
|||
extern "C" { |
|||
#if HAVE_VALUES_H |
|||
# include <values.h> |
|||
#endif |
|||
|
|||
#include <assert.h> |
|||
#include <ncurses/eti.h> |
|||
#include <errno.h> |
|||
} |
|||
|
|||
// Language features
|
|||
#if CPP_HAS_PARAM_INIT |
|||
#define NCURSES_PARAM_INIT(value) = value |
|||
#else |
|||
#define NCURSES_PARAM_INIT(value) /*nothing*/ |
|||
#endif |
|||
|
|||
#if CPP_HAS_STATIC_CAST |
|||
#define STATIC_CAST(s) static_cast<s> |
|||
#else |
|||
#define STATIC_CAST(s) (s) |
|||
#endif |
|||
|
|||
// Forward Declarations
|
|||
class NCURSES_IMPEXP NCursesPanel; |
|||
class NCURSES_IMPEXP NCursesMenu; |
|||
class NCURSES_IMPEXP NCursesForm; |
|||
|
|||
class NCURSES_IMPEXP NCursesException |
|||
{ |
|||
public: |
|||
const char *message; |
|||
int errorno; |
|||
|
|||
NCursesException (const char* msg, int err) |
|||
: message(msg), errorno (err) |
|||
{}; |
|||
|
|||
NCursesException (const char* msg) |
|||
: message(msg), errorno (E_SYSTEM_ERROR) |
|||
{}; |
|||
|
|||
NCursesException& operator=(const NCursesException& rhs) |
|||
{ |
|||
errorno = rhs.errorno; |
|||
return *this; |
|||
} |
|||
|
|||
NCursesException(const NCursesException& rhs) |
|||
: message(rhs.message), errorno(rhs.errorno) |
|||
{ |
|||
} |
|||
|
|||
virtual const char *classname() const { |
|||
return "NCursesWindow"; |
|||
} |
|||
|
|||
virtual ~NCursesException() |
|||
{ |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP NCursesPanelException : public NCursesException |
|||
{ |
|||
public: |
|||
const NCursesPanel* p; |
|||
|
|||
NCursesPanelException (const char *msg, int err) : |
|||
NCursesException (msg, err), |
|||
p (NULL) |
|||
{}; |
|||
|
|||
NCursesPanelException (const NCursesPanel* panel, |
|||
const char *msg, |
|||
int err) : |
|||
NCursesException (msg, err), |
|||
p (panel) |
|||
{}; |
|||
|
|||
NCursesPanelException (int err) : |
|||
NCursesException ("panel library error", err), |
|||
p (NULL) |
|||
{}; |
|||
|
|||
NCursesPanelException (const NCursesPanel* panel, |
|||
int err) : |
|||
NCursesException ("panel library error", err), |
|||
p (panel) |
|||
{}; |
|||
|
|||
NCursesPanelException& operator=(const NCursesPanelException& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
NCursesException::operator=(rhs); |
|||
p = rhs.p; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesPanelException(const NCursesPanelException& rhs) |
|||
: NCursesException(rhs), p(rhs.p) |
|||
{ |
|||
} |
|||
|
|||
virtual const char *classname() const { |
|||
return "NCursesPanel"; |
|||
} |
|||
|
|||
virtual ~NCursesPanelException() |
|||
{ |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP NCursesMenuException : public NCursesException |
|||
{ |
|||
public: |
|||
const NCursesMenu* m; |
|||
|
|||
NCursesMenuException (const char *msg, int err) : |
|||
NCursesException (msg, err), |
|||
m (NULL) |
|||
{}; |
|||
|
|||
NCursesMenuException (const NCursesMenu* menu, |
|||
const char *msg, |
|||
int err) : |
|||
NCursesException (msg, err), |
|||
m (menu) |
|||
{}; |
|||
|
|||
NCursesMenuException (int err) : |
|||
NCursesException ("menu library error", err), |
|||
m (NULL) |
|||
{}; |
|||
|
|||
NCursesMenuException (const NCursesMenu* menu, |
|||
int err) : |
|||
NCursesException ("menu library error", err), |
|||
m (menu) |
|||
{}; |
|||
|
|||
NCursesMenuException& operator=(const NCursesMenuException& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
NCursesException::operator=(rhs); |
|||
m = rhs.m; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesMenuException(const NCursesMenuException& rhs) |
|||
: NCursesException(rhs), m(rhs.m) |
|||
{ |
|||
} |
|||
|
|||
virtual const char *classname() const { |
|||
return "NCursesMenu"; |
|||
} |
|||
|
|||
virtual ~NCursesMenuException() |
|||
{ |
|||
} |
|||
}; |
|||
|
|||
class NCURSES_IMPEXP NCursesFormException : public NCursesException |
|||
{ |
|||
public: |
|||
const NCursesForm* f; |
|||
|
|||
NCursesFormException (const char *msg, int err) : |
|||
NCursesException (msg, err), |
|||
f (NULL) |
|||
{}; |
|||
|
|||
NCursesFormException (const NCursesForm* form, |
|||
const char *msg, |
|||
int err) : |
|||
NCursesException (msg, err), |
|||
f (form) |
|||
{}; |
|||
|
|||
NCursesFormException (int err) : |
|||
NCursesException ("form library error", err), |
|||
f (NULL) |
|||
{}; |
|||
|
|||
NCursesFormException (const NCursesForm* form, |
|||
int err) : |
|||
NCursesException ("form library error", err), |
|||
f (form) |
|||
{}; |
|||
|
|||
NCursesFormException& operator=(const NCursesFormException& rhs) |
|||
{ |
|||
if (this != &rhs) { |
|||
NCursesException::operator=(rhs); |
|||
f = rhs.f; |
|||
} |
|||
return *this; |
|||
} |
|||
|
|||
NCursesFormException(const NCursesFormException& rhs) |
|||
: NCursesException(rhs), f(rhs.f) |
|||
{ |
|||
} |
|||
|
|||
virtual const char *classname() const { |
|||
return "NCursesForm"; |
|||
} |
|||
|
|||
virtual ~NCursesFormException() |
|||
{ |
|||
} |
|||
}; |
|||
|
|||
#if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC)) |
|||
# if HAVE_IOSTREAM |
|||
# include <iostream> |
|||
# if IOSTREAM_NAMESPACE |
|||
using std::cerr; |
|||
using std::endl; |
|||
# endif |
|||
# else |
|||
# include <iostream.h> |
|||
# endif |
|||
extern "C" void exit(int); |
|||
#endif |
|||
|
|||
inline void THROW(const NCursesException *e) { |
|||
#if defined(__GNUG__) && defined(__EXCEPTIONS) |
|||
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) |
|||
(*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); |
|||
#else |
|||
#define CPP_HAS_TRY_CATCH 1 |
|||
#endif |
|||
#elif defined(__SUNPRO_CC) |
|||
# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) |
|||
genericerror(1, ((e != 0) ? (char *)(e->message) : "")); |
|||
#else |
|||
#define CPP_HAS_TRY_CATCH 1 |
|||
#endif |
|||
#else |
|||
if (e) |
|||
cerr << e->message << endl; |
|||
exit(0); |
|||
#endif |
|||
|
|||
#ifndef CPP_HAS_TRY_CATCH |
|||
#define CPP_HAS_TRY_CATCH 0 |
|||
#define NCURSES_CPP_TRY /* nothing */ |
|||
#define NCURSES_CPP_CATCH(e) if (false) |
|||
#define THROWS(s) /* nothing */ |
|||
#elif CPP_HAS_TRY_CATCH |
|||
throw *e; |
|||
#define NCURSES_CPP_TRY try |
|||
#define NCURSES_CPP_CATCH(e) catch(e) |
|||
#define THROWS(s) throw(s) |
|||
#endif |
|||
} |
|||
|
|||
#endif /* NCURSES_ETIP_H_incl */ |
@ -0,0 +1,422 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2004,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1995,1997 * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */ |
|||
|
|||
#ifndef FORM_H |
|||
#define FORM_H |
|||
|
|||
#include <ncurses/curses.h> |
|||
#include <ncurses/eti.h> |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#ifndef FORM_PRIV_H |
|||
typedef void *FIELD_CELL; |
|||
#endif |
|||
|
|||
#ifndef NCURSES_FIELD_INTERNALS |
|||
#define NCURSES_FIELD_INTERNALS /* nothing */ |
|||
#endif |
|||
|
|||
typedef int Form_Options; |
|||
typedef int Field_Options; |
|||
|
|||
/**********
|
|||
* _PAGE * |
|||
**********/ |
|||
|
|||
typedef struct { |
|||
short pmin; /* index of first field on page */ |
|||
short pmax; /* index of last field on page */ |
|||
short smin; /* index of top leftmost field on page */ |
|||
short smax; /* index of bottom rightmost field on page */ |
|||
} _PAGE; |
|||
|
|||
/**********
|
|||
* FIELD * |
|||
**********/ |
|||
|
|||
typedef struct fieldnode { |
|||
unsigned short status; /* flags */ |
|||
short rows; /* size in rows */ |
|||
short cols; /* size in cols */ |
|||
short frow; /* first row */ |
|||
short fcol; /* first col */ |
|||
int drows; /* dynamic rows */ |
|||
int dcols; /* dynamic cols */ |
|||
int maxgrow; /* maximum field growth */ |
|||
int nrow; /* off-screen rows */ |
|||
short nbuf; /* additional buffers */ |
|||
short just; /* justification */ |
|||
short page; /* page on form */ |
|||
short index; /* into form -> field */ |
|||
int pad; /* pad character */ |
|||
chtype fore; /* foreground attribute */ |
|||
chtype back; /* background attribute */ |
|||
Field_Options opts; /* options */ |
|||
struct fieldnode * snext; /* sorted order pointer */ |
|||
struct fieldnode * sprev; /* sorted order pointer */ |
|||
struct fieldnode * link; /* linked field chain */ |
|||
struct formnode * form; /* containing form */ |
|||
struct typenode * type; /* field type */ |
|||
void * arg; /* argument for type */ |
|||
FIELD_CELL * buf; /* field buffers */ |
|||
void * usrptr; /* user pointer */ |
|||
/*
|
|||
* The wide-character configuration requires extra information. Because |
|||
* there are existing applications that manipulate the members of FIELD |
|||
* directly, we cannot make the struct opaque. Offsets of members up to |
|||
* this point are the same in the narrow- and wide-character configuration. |
|||
* But note that the type of buf depends on the configuration, and is made |
|||
* opaque for that reason. |
|||
*/ |
|||
NCURSES_FIELD_INTERNALS |
|||
} FIELD; |
|||
|
|||
|
|||
/*********
|
|||
* FORM * |
|||
*********/ |
|||
|
|||
typedef struct formnode { |
|||
unsigned short status; /* flags */ |
|||
short rows; /* size in rows */ |
|||
short cols; /* size in cols */ |
|||
int currow; /* current row in field window */ |
|||
int curcol; /* current col in field window */ |
|||
int toprow; /* in scrollable field window */ |
|||
int begincol; /* in horiz. scrollable field */ |
|||
short maxfield; /* number of fields */ |
|||
short maxpage; /* number of pages */ |
|||
short curpage; /* index into page */ |
|||
Form_Options opts; /* options */ |
|||
WINDOW * win; /* window */ |
|||
WINDOW * sub; /* subwindow */ |
|||
WINDOW * w; /* window for current field */ |
|||
FIELD ** field; /* field [maxfield] */ |
|||
FIELD * current; /* current field */ |
|||
_PAGE * page; /* page [maxpage] */ |
|||
void * usrptr; /* user pointer */ |
|||
|
|||
void (*forminit)(struct formnode *); |
|||
void (*formterm)(struct formnode *); |
|||
void (*fieldinit)(struct formnode *); |
|||
void (*fieldterm)(struct formnode *); |
|||
|
|||
} FORM; |
|||
|
|||
|
|||
/**************
|
|||
* FIELDTYPE * |
|||
**************/ |
|||
|
|||
typedef struct typenode { |
|||
unsigned short status; /* flags */ |
|||
long ref; /* reference count */ |
|||
struct typenode * left; /* ptr to operand for | */ |
|||
struct typenode * right; /* ptr to operand for | */ |
|||
|
|||
void* (*makearg)(va_list *); /* make fieldtype arg */ |
|||
void* (*copyarg)(const void *); /* copy fieldtype arg */ |
|||
void (*freearg)(void *); /* free fieldtype arg */ |
|||
|
|||
#if NCURSES_INTEROP_FUNCS |
|||
union { |
|||
bool (*ofcheck)(FIELD *,const void *); /* field validation */ |
|||
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */ |
|||
} fieldcheck; |
|||
union { |
|||
bool (*occheck)(int,const void *); /* character validation */ |
|||
bool (*gccheck)(int,FORM*, |
|||
FIELD*,const void*); /* generic char validation */ |
|||
} charcheck; |
|||
union { |
|||
bool (*onext)(FIELD *,const void *); /* enumerate next value */ |
|||
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */ |
|||
} enum_next; |
|||
union { |
|||
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */ |
|||
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */ |
|||
} enum_prev; |
|||
void* (*genericarg)(void*); /* Alternate Arg method */ |
|||
#else |
|||
bool (*fcheck)(FIELD *,const void *); /* field validation */ |
|||
bool (*ccheck)(int,const void *); /* character validation */ |
|||
|
|||
bool (*next)(FIELD *,const void *); /* enumerate next value */ |
|||
bool (*prev)(FIELD *,const void *); /* enumerate prev value */ |
|||
#endif |
|||
} FIELDTYPE; |
|||
|
|||
typedef void (*Form_Hook)(FORM *); |
|||
|
|||
/***************************
|
|||
* miscellaneous #defines * |
|||
***************************/ |
|||
|
|||
/* field justification */ |
|||
#define NO_JUSTIFICATION (0) |
|||
#define JUSTIFY_LEFT (1) |
|||
#define JUSTIFY_CENTER (2) |
|||
#define JUSTIFY_RIGHT (3) |
|||
|
|||
/* field options */ |
|||
#define O_VISIBLE (0x0001U) |
|||
#define O_ACTIVE (0x0002U) |
|||
#define O_PUBLIC (0x0004U) |
|||
#define O_EDIT (0x0008U) |
|||
#define O_WRAP (0x0010U) |
|||
#define O_BLANK (0x0020U) |
|||
#define O_AUTOSKIP (0x0040U) |
|||
#define O_NULLOK (0x0080U) |
|||
#define O_PASSOK (0x0100U) |
|||
#define O_STATIC (0x0200U) |
|||
|
|||
/* form options */ |
|||
#define O_NL_OVERLOAD (0x0001U) |
|||
#define O_BS_OVERLOAD (0x0002U) |
|||
|
|||
/* form driver commands */ |
|||
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ |
|||
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ |
|||
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ |
|||
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ |
|||
|
|||
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ |
|||
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ |
|||
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ |
|||
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ |
|||
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ |
|||
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ |
|||
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ |
|||
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ |
|||
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ |
|||
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ |
|||
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ |
|||
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ |
|||
|
|||
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ |
|||
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ |
|||
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ |
|||
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ |
|||
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ |
|||
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ |
|||
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ |
|||
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ |
|||
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ |
|||
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ |
|||
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ |
|||
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ |
|||
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ |
|||
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ |
|||
|
|||
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ |
|||
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ |
|||
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ |
|||
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ |
|||
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ |
|||
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ |
|||
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ |
|||
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ |
|||
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ |
|||
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ |
|||
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ |
|||
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ |
|||
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ |
|||
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ |
|||
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ |
|||
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ |
|||
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ |
|||
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ |
|||
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ |
|||
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ |
|||
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ |
|||
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ |
|||
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ |
|||
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ |
|||
|
|||
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ |
|||
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ |
|||
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ |
|||
|
|||
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ |
|||
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ |
|||
|
|||
#if defined(MAX_COMMAND) |
|||
# if (MAX_FORM_COMMAND > MAX_COMMAND) |
|||
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND |
|||
# elif (MAX_COMMAND != (KEY_MAX + 128)) |
|||
# error Something is wrong -- MAX_COMMAND is already inconsistently defined. |
|||
# endif |
|||
#else |
|||
# define MAX_COMMAND (KEY_MAX + 128) |
|||
#endif |
|||
|
|||
/*************************
|
|||
* standard field types * |
|||
*************************/ |
|||
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 NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ |
|||
|
|||
/***********************
|
|||
* FIELDTYPE routines * |
|||
***********************/ |
|||
extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( |
|||
bool (* const field_check)(FIELD *,const void *), |
|||
bool (* const char_check)(int,const void *)); |
|||
extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( |
|||
FIELDTYPE *, 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 *)); |
|||
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 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 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 *); |
|||
|
|||
#if NCURSES_SP_FUNCS |
|||
extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); |
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* FORM_H */ |
@ -0,0 +1,260 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2007,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Juergen Pfeifer, 1995,1997 * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ |
|||
|
|||
#ifndef ETI_MENU |
|||
#define ETI_MENU |
|||
|
|||
#ifdef AMIGA |
|||
#define TEXT TEXT_ncurses |
|||
#endif |
|||
|
|||
#include <ncurses/curses.h> |
|||
#include <ncurses/eti.h> |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
typedef int Menu_Options; |
|||
typedef int Item_Options; |
|||
|
|||
/* Menu options: */ |
|||
#define O_ONEVALUE (0x01) |
|||
#define O_SHOWDESC (0x02) |
|||
#define O_ROWMAJOR (0x04) |
|||
#define O_IGNORECASE (0x08) |
|||
#define O_SHOWMATCH (0x10) |
|||
#define O_NONCYCLIC (0x20) |
|||
|
|||
/* Item options: */ |
|||
#define O_SELECTABLE (0x01) |
|||
|
|||
typedef struct |
|||
{ |
|||
const char* str; |
|||
unsigned short length; |
|||
} TEXT; |
|||
|
|||
typedef struct tagITEM |
|||
{ |
|||
TEXT name; /* name of menu item */ |
|||
TEXT description; /* description of item, optional in display */ |
|||
struct tagMENU *imenu; /* Pointer to parent menu */ |
|||
void *userptr; /* Pointer to user defined per item data */ |
|||
Item_Options opt; /* Item options */ |
|||
short index; /* Item number if connected to a menu */ |
|||
short y; /* y and x location of item in menu */ |
|||
short x; |
|||
bool value; /* Selection value */ |
|||
|
|||
struct tagITEM *left; /* neighbor items */ |
|||
struct tagITEM *right; |
|||
struct tagITEM *up; |
|||
struct tagITEM *down; |
|||
|
|||
} ITEM; |
|||
|
|||
typedef void (*Menu_Hook)(struct tagMENU *); |
|||
|
|||
typedef struct tagMENU |
|||
{ |
|||
short height; /* Nr. of chars high */ |
|||
short width; /* Nr. of chars wide */ |
|||
short rows; /* Nr. of items high */ |
|||
short cols; /* Nr. of items wide */ |
|||
short frows; /* Nr. of formatted items high */ |
|||
short fcols; /* Nr. of formatted items wide */ |
|||
short arows; /* Nr. of items high (actual) */ |
|||
short namelen; /* Max. name length */ |
|||
short desclen; /* Max. description length */ |
|||
short marklen; /* Length of mark, if any */ |
|||
short itemlen; /* Length of one item */ |
|||
short spc_desc; /* Spacing for descriptor */ |
|||
short spc_cols; /* Spacing for columns */ |
|||
short spc_rows; /* Spacing for rows */ |
|||
char *pattern; /* Buffer to store match chars */ |
|||
short pindex; /* Index into pattern buffer */ |
|||
WINDOW *win; /* Window containing menu */ |
|||
WINDOW *sub; /* Subwindow for menu display */ |
|||
WINDOW *userwin; /* User's window */ |
|||
WINDOW *usersub; /* User's subwindow */ |
|||
ITEM **items; /* array of items */ |
|||
short nitems; /* Nr. of items in menu */ |
|||
ITEM *curitem; /* Current item */ |
|||
short toprow; /* Top row of menu */ |
|||
chtype fore; /* Selection attribute */ |
|||
chtype back; /* Nonselection attribute */ |
|||
chtype grey; /* Inactive attribute */ |
|||
unsigned char pad; /* Pad character */ |
|||
|
|||
Menu_Hook menuinit; /* User hooks */ |
|||
Menu_Hook menuterm; |
|||
Menu_Hook iteminit; |
|||
Menu_Hook itemterm; |
|||
|
|||
void *userptr; /* Pointer to menus user data */ |
|||
char *mark; /* Pointer to marker string */ |
|||
|
|||
Menu_Options opt; /* Menu options */ |
|||
unsigned short status; /* Internal state of menu */ |
|||
|
|||
} MENU; |
|||
|
|||
|
|||
/* Define keys */ |
|||
|
|||
#define REQ_LEFT_ITEM (KEY_MAX + 1) |
|||
#define REQ_RIGHT_ITEM (KEY_MAX + 2) |
|||
#define REQ_UP_ITEM (KEY_MAX + 3) |
|||
#define REQ_DOWN_ITEM (KEY_MAX + 4) |
|||
#define REQ_SCR_ULINE (KEY_MAX + 5) |
|||
#define REQ_SCR_DLINE (KEY_MAX + 6) |
|||
#define REQ_SCR_DPAGE (KEY_MAX + 7) |
|||
#define REQ_SCR_UPAGE (KEY_MAX + 8) |
|||
#define REQ_FIRST_ITEM (KEY_MAX + 9) |
|||
#define REQ_LAST_ITEM (KEY_MAX + 10) |
|||
#define REQ_NEXT_ITEM (KEY_MAX + 11) |
|||
#define REQ_PREV_ITEM (KEY_MAX + 12) |
|||
#define REQ_TOGGLE_ITEM (KEY_MAX + 13) |
|||
#define REQ_CLEAR_PATTERN (KEY_MAX + 14) |
|||
#define REQ_BACK_PATTERN (KEY_MAX + 15) |
|||
#define REQ_NEXT_MATCH (KEY_MAX + 16) |
|||
#define REQ_PREV_MATCH (KEY_MAX + 17) |
|||
|
|||
#define MIN_MENU_COMMAND (KEY_MAX + 1) |
|||
#define MAX_MENU_COMMAND (KEY_MAX + 17) |
|||
|
|||
/*
|
|||
* Some AT&T code expects MAX_COMMAND to be out-of-band not |
|||
* just for menu commands but for forms ones as well. |
|||
*/ |
|||
#if defined(MAX_COMMAND) |
|||
# if (MAX_MENU_COMMAND > MAX_COMMAND) |
|||
# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND |
|||
# elif (MAX_COMMAND != (KEY_MAX + 128)) |
|||
# error Something is wrong -- MAX_COMMAND is already inconsistently defined. |
|||
# endif |
|||
#else |
|||
# define MAX_COMMAND (KEY_MAX + 128) |
|||
#endif |
|||
|
|||
|
|||
/* --------- prototypes for libmenu functions ----------------------------- */ |
|||
|
|||
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 *, Menu_Hook); |
|||
extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); |
|||
extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); |
|||
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 *, Menu_Hook); |
|||
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 *, Menu_Hook); |
|||
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 *); |
|||
|
|||
#if NCURSES_SP_FUNCS |
|||
extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); |
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* ETI_MENU */ |
@ -0,0 +1,73 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 2006,2010 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Thomas E. Dickey 2006 * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: nc_tparm.h,v 1.5 2010/12/25 20:27:22 tom Exp $ */ |
|||
|
|||
#ifndef NC_TPARM_included |
|||
#define NC_TPARM_included 1 |
|||
|
|||
/*
|
|||
* Cast parameters past the formatting-string for tparm() to match the |
|||
* assumption of the varargs code. |
|||
*/ |
|||
#ifndef TPARM_ARG |
|||
#define TPARM_ARG long |
|||
#endif |
|||
|
|||
#define TPARM_N(n) (TPARM_ARG)(n) |
|||
|
|||
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j)) |
|||
|
|||
#if NCURSES_TPARM_VARARGS |
|||
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i)) |
|||
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h)) |
|||
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g)) |
|||
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f)) |
|||
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e)) |
|||
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d)) |
|||
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c)) |
|||
#define TPARM_1(a,b) tparm(a,TPARM_N(b)) |
|||
#define TPARM_0(a) tparm(a) |
|||
#else |
|||
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0) |
|||
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0) |
|||
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0) |
|||
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0) |
|||
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0) |
|||
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0) |
|||
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0) |
|||
#define TPARM_1(a,b) TPARM_2(a,b,0) |
|||
#define TPARM_1(a,b) TPARM_2(a,b,0) |
|||
#define TPARM_0(a) TPARM_1(a,0) |
|||
#endif |
|||
|
|||
#endif /* NC_TPARM_included */ |
File diff suppressed because it is too large
@ -0,0 +1,86 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2007,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
/* $Id: ncurses_dll.h.in,v 1.8 2009/04/04 22:26:27 tom Exp $ */ |
|||
|
|||
#ifndef NCURSES_DLL_H_incl |
|||
#define NCURSES_DLL_H_incl 1 |
|||
|
|||
/*
|
|||
* For reentrant code, we map the various global variables into SCREEN by |
|||
* using functions to access them. |
|||
*/ |
|||
#define NCURSES_PUBLIC_VAR(name) _nc_##name |
|||
#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void) |
|||
|
|||
/* no longer needed on cygwin or mingw, thanks to auto-import */ |
|||
/* but this structure may be useful at some point for an MSVC build */ |
|||
/* so, for now unconditionally define the important flags */ |
|||
/* "the right way" for proper static and dll+auto-import behavior */ |
|||
#undef NCURSES_DLL |
|||
#define NCURSES_STATIC |
|||
|
|||
#if defined(__CYGWIN__) || defined(__MINGW32__) |
|||
# if defined(NCURSES_DLL) |
|||
# if defined(NCURSES_STATIC) |
|||
# undef NCURSES_STATIC |
|||
# endif |
|||
# endif |
|||
# undef NCURSES_IMPEXP |
|||
# undef NCURSES_API |
|||
# undef NCURSES_EXPORT |
|||
# undef NCURSES_EXPORT_VAR |
|||
# if defined(NCURSES_DLL) |
|||
/* building a DLL */ |
|||
# define NCURSES_IMPEXP __declspec(dllexport) |
|||
# elif defined(NCURSES_STATIC) |
|||
/* building or linking to a static library */ |
|||
# define NCURSES_IMPEXP /* nothing */ |
|||
# else |
|||
/* linking to the DLL */ |
|||
# define NCURSES_IMPEXP __declspec(dllimport) |
|||
# endif |
|||
# define NCURSES_API __cdecl |
|||
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API |
|||
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type |
|||
#endif |
|||
|
|||
/* Take care of non-cygwin platforms */ |
|||
#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) __declspec(dllimport) type |
|||
#endif |
|||
|
|||
#endif /* NCURSES_DLL_H_incl */ |
@ -0,0 +1,85 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2006,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * |
|||
* and: Eric S. Raymond <esr@snark.thyrsus.com> * |
|||
* and: Juergen Pfeifer 1996-1999,2008 * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ |
|||
|
|||
/* panel.h -- interface file for panels library */ |
|||
|
|||
#ifndef NCURSES_PANEL_H_incl |
|||
#define NCURSES_PANEL_H_incl 1 |
|||
|
|||
#include <ncurses/curses.h> |
|||
|
|||
typedef struct panel |
|||
{ |
|||
WINDOW *win; |
|||
struct panel *below; |
|||
struct panel *above; |
|||
NCURSES_CONST void *user; |
|||
} PANEL; |
|||
|
|||
#if defined(__cplusplus) |
|||
extern "C" { |
|||
#endif |
|||
|
|||
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 NCURSES_SP_FUNCS |
|||
extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); |
|||
extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); |
|||
|
|||
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); |
|||
#endif |
|||
|
|||
#if defined(__cplusplus) |
|||
} |
|||
#endif |
|||
|
|||
#endif /* NCURSES_PANEL_H_incl */ |
|||
|
|||
/* end of panel.h */ |
@ -0,0 +1,834 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2009,2010 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************/ |
|||
/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */ |
|||
/* and: Eric S. Raymond <esr@snark.thyrsus.com> */ |
|||
/* and: Thomas E. Dickey 1995-on */ |
|||
/****************************************************************************/ |
|||
|
|||
/* $Id: MKterm.h.awk.in,v 1.58 2010/01/09 19:53:26 tom Exp $ */ |
|||
|
|||
/*
|
|||
** term.h -- Definition of struct term |
|||
*/ |
|||
|
|||
#ifndef NCURSES_TERM_H_incl |
|||
#define NCURSES_TERM_H_incl 1 |
|||
|
|||
#undef NCURSES_VERSION |
|||
#define NCURSES_VERSION "5.9" |
|||
|
|||
#include <ncurses/ncurses_dll.h> |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
|
|||
* definition (based on the system for which this was configured). |
|||
*/ |
|||
|
|||
#undef NCURSES_CONST |
|||
#define NCURSES_CONST /*nothing*/ |
|||
|
|||
#undef NCURSES_SBOOL |
|||
#define NCURSES_SBOOL char |
|||
|
|||
#undef NCURSES_XNAMES |
|||
#define NCURSES_XNAMES 1 |
|||
|
|||
/* We will use these symbols to hide differences between
|
|||
* termios/termio/sgttyb interfaces. |
|||
*/ |
|||
#undef TTY |
|||
#undef SET_TTY |
|||
#undef GET_TTY |
|||
|
|||
/* Assume POSIX termio if we have the header and function */ |
|||
/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ |
|||
#if 0 && 0
|
|||
|
|||
#undef TERMIOS |
|||
#define TERMIOS 1 |
|||
|
|||
#include <termios.h> |
|||
#define TTY struct termios |
|||
|
|||
#else /* !HAVE_TERMIOS_H */ |
|||
|
|||
/* #if HAVE_TERMIO_H */ |
|||
#if 0 |
|||
|
|||
#undef TERMIOS |
|||
#define TERMIOS 1 |
|||
|
|||
#include <termio.h> |
|||
#define TTY struct termio |
|||
|
|||
/* Add definitions to make termio look like termios.
|
|||
* But ifdef it, since there are some implementations |
|||
* that try to do this for us in a fake <termio.h>. |
|||
*/ |
|||
#ifndef TCSANOW |
|||
#define TCSANOW TCSETA |
|||
#endif |
|||
#ifndef TCSADRAIN |
|||
#define TCSADRAIN TCSETAW |
|||
#endif |
|||
#ifndef TCSAFLUSH |
|||
#define TCSAFLUSH TCSETAF |
|||
#endif |
|||
#ifndef tcsetattr |
|||
#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) |
|||
#endif |
|||
#ifndef tcgetattr |
|||
#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) |
|||
#endif |
|||
#ifndef cfgetospeed |
|||
#define cfgetospeed(t) ((t)->c_cflag & CBAUD) |
|||
#endif |
|||
#ifndef TCIFLUSH |
|||
#define TCIFLUSH 0 |
|||
#endif |
|||
#ifndef TCOFLUSH |
|||
#define TCOFLUSH 1 |
|||
#endif |
|||
#ifndef TCIOFLUSH |
|||
#define TCIOFLUSH 2 |
|||
#endif |
|||
#ifndef tcflush |
|||
#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) |
|||
#endif |
|||
|
|||
#else /* !HAVE_TERMIO_H */ |
|||
|
|||
#if __MINGW32__ |
|||
# include <ncurses_mingw.h> |
|||
# define TTY struct termios |
|||
#else |
|||
#undef TERMIOS |
|||
#include <sgtty.h> |
|||
#include <sys/ioctl.h> |
|||
#define TTY struct sgttyb |
|||
#endif /* MINGW32 */ |
|||
#endif /* HAVE_TERMIO_H */ |
|||
|
|||
#endif /* HAVE_TERMIOS_H */ |
|||
|
|||
#ifdef TERMIOS |
|||
#define GET_TTY(fd, buf) tcgetattr(fd, buf) |
|||
#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) |
|||
#else |
|||
#define GET_TTY(fd, buf) gtty(fd, buf) |
|||
#define SET_TTY(fd, buf) stty(fd, buf) |
|||
#endif |
|||
|
|||
#define NAMESIZE 256 |
|||
|
|||
#define CUR cur_term->type. |
|||
|
|||
#define auto_left_margin CUR Booleans[0] |
|||
#define auto_right_margin CUR Booleans[1] |
|||
#define no_esc_ctlc CUR Booleans[2] |
|||
#define ceol_standout_glitch CUR Booleans[3] |
|||
#define eat_newline_glitch CUR Booleans[4] |
|||
#define erase_overstrike CUR Booleans[5] |
|||
#define generic_type CUR Booleans[6] |
|||
#define hard_copy CUR Booleans[7] |
|||
#define has_meta_key CUR Booleans[8] |
|||
#define has_status_line CUR Booleans[9] |
|||
#define insert_null_glitch CUR Booleans[10] |
|||
#define memory_above CUR Booleans[11] |
|||
#define memory_below CUR Booleans[12] |
|||
#define move_insert_mode CUR Booleans[13] |
|||
#define move_standout_mode CUR Booleans[14] |
|||
#define over_strike CUR Booleans[15] |
|||
#define status_line_esc_ok CUR Booleans[16] |
|||
#define dest_tabs_magic_smso CUR Booleans[17] |
|||
#define tilde_glitch CUR Booleans[18] |
|||
#define transparent_underline CUR Booleans[19] |
|||
#define xon_xoff CUR Booleans[20] |
|||
#define needs_xon_xoff CUR Booleans[21] |
|||
#define prtr_silent CUR Booleans[22] |
|||
#define hard_cursor CUR Booleans[23] |
|||
#define non_rev_rmcup CUR Booleans[24] |
|||
#define no_pad_char CUR Booleans[25] |
|||
#define non_dest_scroll_region CUR Booleans[26] |
|||
#define can_change CUR Booleans[27] |
|||
#define back_color_erase CUR Booleans[28] |
|||
#define hue_lightness_saturation CUR Booleans[29] |
|||
#define col_addr_glitch CUR Booleans[30] |
|||
#define cr_cancels_micro_mode CUR Booleans[31] |
|||
#define has_print_wheel CUR Booleans[32] |
|||
#define row_addr_glitch CUR Booleans[33] |
|||
#define semi_auto_right_margin CUR Booleans[34] |
|||
#define cpi_changes_res CUR Booleans[35] |
|||
#define lpi_changes_res CUR Booleans[36] |
|||
#define columns CUR Numbers[0] |
|||
#define init_tabs CUR Numbers[1] |
|||
#define lines CUR Numbers[2] |
|||
#define lines_of_memory CUR Numbers[3] |
|||
#define magic_cookie_glitch CUR Numbers[4] |
|||
#define padding_baud_rate CUR Numbers[5] |
|||
#define virtual_terminal CUR Numbers[6] |
|||
#define width_status_line CUR Numbers[7] |
|||
#define num_labels CUR Numbers[8] |
|||
#define label_height CUR Numbers[9] |
|||
#define label_width CUR Numbers[10] |
|||
#define max_attributes CUR Numbers[11] |
|||
#define maximum_windows CUR Numbers[12] |
|||
#define max_colors CUR Numbers[13] |
|||
#define max_pairs CUR Numbers[14] |
|||
#define no_color_video CUR Numbers[15] |
|||
#define buffer_capacity CUR Numbers[16] |
|||
#define dot_vert_spacing CUR Numbers[17] |
|||
#define dot_horz_spacing CUR Numbers[18] |
|||
#define max_micro_address CUR Numbers[19] |
|||
#define max_micro_jump CUR Numbers[20] |
|||
#define micro_col_size CUR Numbers[21] |
|||
#define micro_line_size CUR Numbers[22] |
|||
#define number_of_pins CUR Numbers[23] |
|||
#define output_res_char CUR Numbers[24] |
|||
#define output_res_line CUR Numbers[25] |
|||
#define output_res_horz_inch CUR Numbers[26] |
|||
#define output_res_vert_inch CUR Numbers[27] |
|||
#define print_rate CUR Numbers[28] |
|||
#define wide_char_size CUR Numbers[29] |
|||
#define buttons CUR Numbers[30] |
|||
#define bit_image_entwining CUR Numbers[31] |
|||
#define bit_image_type CUR Numbers[32] |
|||
#define back_tab CUR Strings[0] |
|||
#define bell CUR Strings[1] |
|||
#define carriage_return CUR Strings[2] |
|||
#define change_scroll_region CUR Strings[3] |
|||
#define clear_all_tabs CUR Strings[4] |
|||
#define clear_screen CUR Strings[5] |
|||
#define clr_eol CUR Strings[6] |
|||
#define clr_eos CUR Strings[7] |
|||
#define column_address CUR Strings[8] |
|||
#define command_character CUR Strings[9] |
|||
#define cursor_address CUR Strings[10] |
|||
#define cursor_down CUR Strings[11] |
|||
#define cursor_home CUR Strings[12] |
|||
#define cursor_invisible CUR Strings[13] |
|||
#define cursor_left CUR Strings[14] |
|||
#define cursor_mem_address CUR Strings[15] |
|||
#define cursor_normal CUR Strings[16] |
|||
#define cursor_right CUR Strings[17] |
|||
#define cursor_to_ll CUR Strings[18] |
|||
#define cursor_up CUR Strings[19] |
|||
#define cursor_visible CUR Strings[20] |
|||
#define delete_character CUR Strings[21] |
|||
#define delete_line CUR Strings[22] |
|||
#define dis_status_line CUR Strings[23] |
|||
#define down_half_line CUR Strings[24] |
|||
#define enter_alt_charset_mode CUR Strings[25] |
|||
#define enter_blink_mode CUR Strings[26] |
|||
#define enter_bold_mode CUR Strings[27] |
|||
#define enter_ca_mode CUR Strings[28] |
|||
#define enter_delete_mode CUR Strings[29] |
|||
#define enter_dim_mode CUR Strings[30] |
|||
#define enter_insert_mode CUR Strings[31] |
|||
#define enter_secure_mode CUR Strings[32] |
|||
#define enter_protected_mode CUR Strings[33] |
|||
#define enter_reverse_mode CUR Strings[34] |
|||
#define enter_standout_mode CUR Strings[35] |
|||
#define enter_underline_mode CUR Strings[36] |
|||
#define erase_chars CUR Strings[37] |
|||
#define exit_alt_charset_mode CUR Strings[38] |
|||
#define exit_attribute_mode CUR Strings[39] |
|||
#define exit_ca_mode CUR Strings[40] |
|||
#define exit_delete_mode CUR Strings[41] |
|||
#define exit_insert_mode CUR Strings[42] |
|||
#define exit_standout_mode CUR Strings[43] |
|||
#define exit_underline_mode CUR Strings[44] |
|||
#define flash_screen CUR Strings[45] |
|||
#define form_feed CUR Strings[46] |
|||
#define from_status_line CUR Strings[47] |
|||
#define init_1string CUR Strings[48] |
|||
#define init_2string CUR Strings[49] |
|||
#define init_3string CUR Strings[50] |
|||
#define init_file CUR Strings[51] |
|||
#define insert_character CUR Strings[52] |
|||
#define insert_line CUR Strings[53] |
|||
#define insert_padding CUR Strings[54] |
|||
#define key_backspace CUR Strings[55] |
|||
#define key_catab CUR Strings[56] |
|||
#define key_clear CUR Strings[57] |
|||
#define key_ctab CUR Strings[58] |
|||
#define key_dc CUR Strings[59] |
|||
#define key_dl CUR Strings[60] |
|||
#define key_down CUR Strings[61] |
|||
#define key_eic CUR Strings[62] |
|||
#define key_eol CUR Strings[63] |
|||
#define key_eos CUR Strings[64] |
|||
#define key_f0 CUR Strings[65] |
|||
#define key_f1 CUR Strings[66] |
|||
#define key_f10 CUR Strings[67] |
|||
#define key_f2 CUR Strings[68] |
|||
#define key_f3 CUR Strings[69] |
|||
#define key_f4 CUR Strings[70] |
|||
#define key_f5 CUR Strings[71] |
|||
#define key_f6 CUR Strings[72] |
|||
#define key_f7 CUR Strings[73] |
|||
#define key_f8 CUR Strings[74] |
|||
#define key_f9 CUR Strings[75] |
|||
#define key_home CUR Strings[76] |
|||
#define key_ic CUR Strings[77] |
|||
#define key_il CUR Strings[78] |
|||
#define key_left CUR Strings[79] |
|||
#define key_ll CUR Strings[80] |
|||
#define key_npage CUR Strings[81] |
|||
#define key_ppage CUR Strings[82] |
|||
#define key_right CUR Strings[83] |
|||
#define key_sf CUR Strings[84] |
|||
#define key_sr CUR Strings[85] |
|||
#define key_stab CUR Strings[86] |
|||
#define key_up CUR Strings[87] |
|||
#define keypad_local CUR Strings[88] |
|||
#define keypad_xmit CUR Strings[89] |
|||
#define lab_f0 CUR Strings[90] |
|||
#define lab_f1 CUR Strings[91] |
|||
#define lab_f10 CUR Strings[92] |
|||
#define lab_f2 CUR Strings[93] |
|||
#define lab_f3 CUR Strings[94] |
|||
#define lab_f4 CUR Strings[95] |
|||
#define lab_f5 CUR Strings[96] |
|||
#define lab_f6 CUR Strings[97] |
|||
#define lab_f7 CUR Strings[98] |
|||
#define lab_f8 CUR Strings[99] |
|||
#define lab_f9 CUR Strings[100] |
|||
#define meta_off CUR Strings[101] |
|||
#define meta_on CUR Strings[102] |
|||
#define newline CUR Strings[103] |
|||
#define pad_char CUR Strings[104] |
|||
#define parm_dch CUR Strings[105] |
|||
#define parm_delete_line CUR Strings[106] |
|||
#define parm_down_cursor CUR Strings[107] |
|||
#define parm_ich CUR Strings[108] |
|||
#define parm_index CUR Strings[109] |
|||
#define parm_insert_line CUR Strings[110] |
|||
#define parm_left_cursor CUR Strings[111] |
|||
#define parm_right_cursor CUR Strings[112] |
|||
#define parm_rindex CUR Strings[113] |
|||
#define parm_up_cursor CUR Strings[114] |
|||
#define pkey_key CUR Strings[115] |
|||
#define pkey_local CUR Strings[116] |
|||
#define pkey_xmit CUR Strings[117] |
|||
#define print_screen CUR Strings[118] |
|||
#define prtr_off CUR Strings[119] |
|||
#define prtr_on CUR Strings[120] |
|||
#define repeat_char CUR Strings[121] |
|||
#define reset_1string CUR Strings[122] |
|||
#define reset_2string CUR Strings[123] |
|||
#define reset_3string CUR Strings[124] |
|||
#define reset_file CUR Strings[125] |
|||
#define restore_cursor CUR Strings[126] |
|||
#define row_address CUR Strings[127] |
|||
#define save_cursor CUR Strings[128] |
|||
#define scroll_forward CUR Strings[129] |
|||
#define scroll_reverse CUR Strings[130] |
|||
#define set_attributes CUR Strings[131] |
|||
#define set_tab CUR Strings[132] |
|||
#define set_window CUR Strings[133] |
|||
#define tab CUR Strings[134] |
|||
#define to_status_line CUR Strings[135] |
|||
#define underline_char CUR Strings[136] |
|||
#define up_half_line CUR Strings[137] |
|||
#define init_prog CUR Strings[138] |
|||
#define key_a1 CUR Strings[139] |
|||
#define key_a3 CUR Strings[140] |
|||
#define key_b2 CUR Strings[141] |
|||
#define key_c1 CUR Strings[142] |
|||
#define key_c3 CUR Strings[143] |
|||
#define prtr_non CUR Strings[144] |
|||
#define char_padding CUR Strings[145] |
|||
#define acs_chars CUR Strings[146] |
|||
#define plab_norm CUR Strings[147] |
|||
#define key_btab CUR Strings[148] |
|||
#define enter_xon_mode CUR Strings[149] |
|||
#define exit_xon_mode CUR Strings[150] |
|||
#define enter_am_mode CUR Strings[151] |
|||
#define exit_am_mode CUR Strings[152] |
|||
#define xon_character CUR Strings[153] |
|||
#define xoff_character CUR Strings[154] |
|||
#define ena_acs CUR Strings[155] |
|||
#define label_on CUR Strings[156] |
|||
#define label_off CUR Strings[157] |
|||
#define key_beg CUR Strings[158] |
|||
#define key_cancel CUR Strings[159] |
|||
#define key_close CUR Strings[160] |
|||
#define key_command CUR Strings[161] |
|||
#define key_copy CUR Strings[162] |
|||
#define key_create CUR Strings[163] |
|||
#define key_end CUR Strings[164] |
|||
#define key_enter CUR Strings[165] |
|||
#define key_exit CUR Strings[166] |
|||
#define key_find CUR Strings[167] |
|||
#define key_help CUR Strings[168] |
|||
#define key_mark CUR Strings[169] |
|||
#define key_message CUR Strings[170] |
|||
#define key_move CUR Strings[171] |
|||
#define key_next CUR Strings[172] |
|||
#define key_open CUR Strings[173] |
|||
#define key_options CUR Strings[174] |
|||
#define key_previous CUR Strings[175] |
|||
#define key_print CUR Strings[176] |
|||
#define key_redo CUR Strings[177] |
|||
#define key_reference CUR Strings[178] |
|||
#define key_refresh CUR Strings[179] |
|||
#define key_replace CUR Strings[180] |
|||
#define key_restart CUR Strings[181] |
|||
#define key_resume CUR Strings[182] |
|||
#define key_save CUR Strings[183] |
|||
#define key_suspend CUR Strings[184] |
|||
#define key_undo CUR Strings[185] |
|||
#define key_sbeg CUR Strings[186] |
|||
#define key_scancel CUR Strings[187] |
|||
#define key_scommand CUR Strings[188] |
|||
#define key_scopy CUR Strings[189] |
|||
#define key_screate CUR Strings[190] |
|||
#define key_sdc CUR Strings[191] |
|||
#define key_sdl CUR Strings[192] |
|||
#define key_select CUR Strings[193] |
|||
#define key_send CUR Strings[194] |
|||
#define key_seol CUR Strings[195] |
|||
#define key_sexit CUR Strings[196] |
|||
#define key_sfind CUR Strings[197] |
|||
#define key_shelp CUR Strings[198] |
|||
#define key_shome CUR Strings[199] |
|||
#define key_sic CUR Strings[200] |
|||
#define key_sleft CUR Strings[201] |
|||
#define key_smessage CUR Strings[202] |
|||
#define key_smove CUR Strings[203] |
|||
#define key_snext CUR Strings[204] |
|||
#define key_soptions CUR Strings[205] |
|||
#define key_sprevious CUR Strings[206] |
|||
#define key_sprint CUR Strings[207] |
|||
#define key_sredo CUR Strings[208] |
|||
#define key_sreplace CUR Strings[209] |
|||
#define key_sright CUR Strings[210] |
|||
#define key_srsume CUR Strings[211] |
|||
#define key_ssave CUR Strings[212] |
|||
#define key_ssuspend CUR Strings[213] |
|||
#define key_sundo CUR Strings[214] |
|||
#define req_for_input CUR Strings[215] |
|||
#define key_f11 CUR Strings[216] |
|||
#define key_f12 CUR Strings[217] |
|||
#define key_f13 CUR Strings[218] |
|||
#define key_f14 CUR Strings[219] |
|||
#define key_f15 CUR Strings[220] |
|||
#define key_f16 CUR Strings[221] |
|||
#define key_f17 CUR Strings[222] |
|||
#define key_f18 CUR Strings[223] |
|||
#define key_f19 CUR Strings[224] |
|||
#define key_f20 CUR Strings[225] |
|||
#define key_f21 CUR Strings[226] |
|||
#define key_f22 CUR Strings[227] |
|||
#define key_f23 CUR Strings[228] |
|||
#define key_f24 CUR Strings[229] |
|||
#define key_f25 CUR Strings[230] |
|||
#define key_f26 CUR Strings[231] |
|||
#define key_f27 CUR Strings[232] |
|||
#define key_f28 CUR Strings[233] |
|||
#define key_f29 CUR Strings[234] |
|||
#define key_f30 CUR Strings[235] |
|||
#define key_f31 CUR Strings[236] |
|||
#define key_f32 CUR Strings[237] |
|||
#define key_f33 CUR Strings[238] |
|||
#define key_f34 CUR Strings[239] |
|||
#define key_f35 CUR Strings[240] |
|||
#define key_f36 CUR Strings[241] |
|||
#define key_f37 CUR Strings[242] |
|||
#define key_f38 CUR Strings[243] |
|||
#define key_f39 CUR Strings[244] |
|||
#define key_f40 CUR Strings[245] |
|||
#define key_f41 CUR Strings[246] |
|||
#define key_f42 CUR Strings[247] |
|||
#define key_f43 CUR Strings[248] |
|||
#define key_f44 CUR Strings[249] |
|||
#define key_f45 CUR Strings[250] |
|||
#define key_f46 CUR Strings[251] |
|||
#define key_f47 CUR Strings[252] |
|||
#define key_f48 CUR Strings[253] |
|||
#define key_f49 CUR Strings[254] |
|||
#define key_f50 CUR Strings[255] |
|||
#define key_f51 CUR Strings[256] |
|||
#define key_f52 CUR Strings[257] |
|||
#define key_f53 CUR Strings[258] |
|||
#define key_f54 CUR Strings[259] |
|||
#define key_f55 CUR Strings[260] |
|||
#define key_f56 CUR Strings[261] |
|||
#define key_f57 CUR Strings[262] |
|||
#define key_f58 CUR Strings[263] |
|||
#define key_f59 CUR Strings[264] |
|||
#define key_f60 CUR Strings[265] |
|||
#define key_f61 CUR Strings[266] |
|||
#define key_f62 CUR Strings[267] |
|||
#define key_f63 CUR Strings[268] |
|||
#define clr_bol CUR Strings[269] |
|||
#define clear_margins CUR Strings[270] |
|||
#define set_left_margin CUR Strings[271] |
|||
#define set_right_margin CUR Strings[272] |
|||
#define label_format CUR Strings[273] |
|||
#define set_clock CUR Strings[274] |
|||
#define display_clock CUR Strings[275] |
|||
#define remove_clock CUR Strings[276] |
|||
#define create_window CUR Strings[277] |
|||
#define goto_window CUR Strings[278] |
|||
#define hangup CUR Strings[279] |
|||
#define dial_phone CUR Strings[280] |
|||
#define quick_dial CUR Strings[281] |
|||
#define tone CUR Strings[282] |
|||
#define pulse CUR Strings[283] |
|||
#define flash_hook CUR Strings[284] |
|||
#define fixed_pause CUR Strings[285] |
|||
#define wait_tone CUR Strings[286] |
|||
#define user0 CUR Strings[287] |
|||
#define user1 CUR Strings[288] |
|||
#define user2 CUR Strings[289] |
|||
#define user3 CUR Strings[290] |
|||
#define user4 CUR Strings[291] |
|||
#define user5 CUR Strings[292] |
|||
#define user6 CUR Strings[293] |
|||
#define user7 CUR Strings[294] |
|||
#define user8 CUR Strings[295] |
|||
#define user9 CUR Strings[296] |
|||
#define orig_pair CUR Strings[297] |
|||
#define orig_colors CUR Strings[298] |
|||
#define initialize_color CUR Strings[299] |
|||
#define initialize_pair CUR Strings[300] |
|||
#define set_color_pair CUR Strings[301] |
|||
#define set_foreground CUR Strings[302] |
|||
#define set_background CUR Strings[303] |
|||
#define change_char_pitch CUR Strings[304] |
|||
#define change_line_pitch CUR Strings[305] |
|||
#define change_res_horz CUR Strings[306] |
|||
#define change_res_vert CUR Strings[307] |
|||
#define define_char CUR Strings[308] |
|||
#define enter_doublewide_mode CUR Strings[309] |
|||
#define enter_draft_quality CUR Strings[310] |
|||
#define enter_italics_mode CUR Strings[311] |
|||
#define enter_leftward_mode CUR Strings[312] |
|||
#define enter_micro_mode CUR Strings[313] |
|||
#define enter_near_letter_quality CUR Strings[314] |
|||
#define enter_normal_quality CUR Strings[315] |
|||
#define enter_shadow_mode CUR Strings[316] |
|||
#define enter_subscript_mode CUR Strings[317] |
|||
#define enter_superscript_mode CUR Strings[318] |
|||
#define enter_upward_mode CUR Strings[319] |
|||
#define exit_doublewide_mode CUR Strings[320] |
|||
#define exit_italics_mode CUR Strings[321] |
|||
#define exit_leftward_mode CUR Strings[322] |
|||
#define exit_micro_mode CUR Strings[323] |
|||
#define exit_shadow_mode CUR Strings[324] |
|||
#define exit_subscript_mode CUR Strings[325] |
|||
#define exit_superscript_mode CUR Strings[326] |
|||
#define exit_upward_mode CUR Strings[327] |
|||
#define micro_column_address CUR Strings[328] |
|||
#define micro_down CUR Strings[329] |
|||
#define micro_left CUR Strings[330] |
|||
#define micro_right CUR Strings[331] |
|||
#define micro_row_address CUR Strings[332] |
|||
#define micro_up CUR Strings[333] |
|||
#define order_of_pins CUR Strings[334] |
|||
#define parm_down_micro CUR Strings[335] |
|||
#define parm_left_micro CUR Strings[336] |
|||
#define parm_right_micro CUR Strings[337] |
|||
#define parm_up_micro CUR Strings[338] |
|||
#define select_char_set CUR Strings[339] |
|||
#define set_bottom_margin CUR Strings[340] |
|||
#define set_bottom_margin_parm CUR Strings[341] |
|||
#define set_left_margin_parm CUR Strings[342] |
|||
#define set_right_margin_parm CUR Strings[343] |
|||
#define set_top_margin CUR Strings[344] |
|||
#define set_top_margin_parm CUR Strings[345] |
|||
#define start_bit_image CUR Strings[346] |
|||
#define start_char_set_def CUR Strings[347] |
|||
#define stop_bit_image CUR Strings[348] |
|||
#define stop_char_set_def CUR Strings[349] |
|||
#define subscript_characters CUR Strings[350] |
|||
#define superscript_characters CUR Strings[351] |
|||
#define these_cause_cr CUR Strings[352] |
|||
#define zero_motion CUR Strings[353] |
|||
#define char_set_names CUR Strings[354] |
|||
#define key_mouse CUR Strings[355] |
|||
#define mouse_info CUR Strings[356] |
|||
#define req_mouse_pos CUR Strings[357] |
|||
#define get_mouse CUR Strings[358] |
|||
#define set_a_foreground CUR Strings[359] |
|||
#define set_a_background CUR Strings[360] |
|||
#define pkey_plab CUR Strings[361] |
|||
#define device_type CUR Strings[362] |
|||
#define code_set_init CUR Strings[363] |
|||
#define set0_des_seq CUR Strings[364] |
|||
#define set1_des_seq CUR Strings[365] |
|||
#define set2_des_seq CUR Strings[366] |
|||
#define set3_des_seq CUR Strings[367] |
|||
#define set_lr_margin CUR Strings[368] |
|||
#define set_tb_margin CUR Strings[369] |
|||
#define bit_image_repeat CUR Strings[370] |
|||
#define bit_image_newline CUR Strings[371] |
|||
#define bit_image_carriage_return CUR Strings[372] |
|||
#define color_names CUR Strings[373] |
|||
#define define_bit_image_region CUR Strings[374] |
|||
#define end_bit_image_region CUR Strings[375] |
|||
#define set_color_band CUR Strings[376] |
|||
#define set_page_length CUR Strings[377] |
|||
#define display_pc_char CUR Strings[378] |
|||
#define enter_pc_charset_mode CUR Strings[379] |
|||
#define exit_pc_charset_mode CUR Strings[380] |
|||
#define enter_scancode_mode CUR Strings[381] |
|||
#define exit_scancode_mode CUR Strings[382] |
|||
#define pc_term_options CUR Strings[383] |
|||
#define scancode_escape CUR Strings[384] |
|||
#define alt_scancode_esc CUR Strings[385] |
|||
#define enter_horizontal_hl_mode CUR Strings[386] |
|||
#define enter_left_hl_mode CUR Strings[387] |
|||
#define enter_low_hl_mode CUR Strings[388] |
|||
#define enter_right_hl_mode CUR Strings[389] |
|||
#define enter_top_hl_mode CUR Strings[390] |
|||
#define enter_vertical_hl_mode CUR Strings[391] |
|||
#define set_a_attributes CUR Strings[392] |
|||
#define set_pglen_inch CUR Strings[393] |
|||
|
|||
#define BOOLWRITE 37 |
|||
#define NUMWRITE 33 |
|||
#define STRWRITE 394 |
|||
|
|||
/* older synonyms for some capabilities */ |
|||
#define beehive_glitch no_esc_ctlc |
|||
#define teleray_glitch dest_tabs_magic_smso |
|||
#define micro_char_size micro_col_size |
|||
|
|||
#ifdef __INTERNAL_CAPS_VISIBLE |
|||
#define termcap_init2 CUR Strings[394] |
|||
#define termcap_reset CUR Strings[395] |
|||
#define magic_cookie_glitch_ul CUR Numbers[33] |
|||
#define backspaces_with_bs CUR Booleans[37] |
|||
#define crt_no_scrolling CUR Booleans[38] |
|||
#define no_correctly_working_cr CUR Booleans[39] |
|||
#define carriage_return_delay CUR Numbers[34] |
|||
#define new_line_delay CUR Numbers[35] |
|||
#define linefeed_if_not_lf CUR Strings[396] |
|||
#define backspace_if_not_bs CUR Strings[397] |
|||
#define gnu_has_meta_key CUR Booleans[40] |
|||
#define linefeed_is_newline CUR Booleans[41] |
|||
#define backspace_delay CUR Numbers[36] |
|||
#define horizontal_tab_delay CUR Numbers[37] |
|||
#define number_of_function_keys CUR Numbers[38] |
|||
#define other_non_function_keys CUR Strings[398] |
|||
#define arrow_key_map CUR Strings[399] |
|||
#define has_hardware_tabs CUR Booleans[42] |
|||
#define return_does_clr_eol CUR Booleans[43] |
|||
#define acs_ulcorner CUR Strings[400] |
|||
#define acs_llcorner CUR Strings[401] |
|||
#define acs_urcorner CUR Strings[402] |
|||
#define acs_lrcorner CUR Strings[403] |
|||
#define acs_ltee CUR Strings[404] |
|||
#define acs_rtee CUR Strings[405] |
|||
#define acs_btee CUR Strings[406] |
|||
#define acs_ttee CUR Strings[407] |
|||
#define acs_hline CUR Strings[408] |
|||
#define acs_vline CUR Strings[409] |
|||
#define acs_plus CUR Strings[410] |
|||
#define memory_lock CUR Strings[411] |
|||
#define memory_unlock CUR Strings[412] |
|||
#define box_chars_1 CUR Strings[413] |
|||
#endif /* __INTERNAL_CAPS_VISIBLE */ |
|||
|
|||
|
|||
/*
|
|||
* Predefined terminfo array sizes |
|||
*/ |
|||
#define BOOLCOUNT 44 |
|||
#define NUMCOUNT 39 |
|||
#define STRCOUNT 414 |
|||
|
|||
/* used by code for comparing entries */ |
|||
#define acs_chars_index 146 |
|||
|
|||
typedef struct termtype { /* in-core form of terminfo data */ |
|||
char *term_names; /* str_table offset of term names */ |
|||
char *str_table; /* pointer to string table */ |
|||
NCURSES_SBOOL *Booleans; /* array of boolean values */ |
|||
short *Numbers; /* array of integer values */ |
|||
char **Strings; /* array of string offsets */ |
|||
|
|||
#if NCURSES_XNAMES |
|||
char *ext_str_table; /* pointer to extended string table */ |
|||
char **ext_Names; /* corresponding names */ |
|||
|
|||
unsigned short num_Booleans;/* count total Booleans */ |
|||
unsigned short num_Numbers; /* count total Numbers */ |
|||
unsigned short num_Strings; /* count total Strings */ |
|||
|
|||
unsigned short ext_Booleans;/* count extensions to Booleans */ |
|||
unsigned short ext_Numbers; /* count extensions to Numbers */ |
|||
unsigned short ext_Strings; /* count extensions to Strings */ |
|||
#endif /* NCURSES_XNAMES */ |
|||
|
|||
} TERMTYPE; |
|||
|
|||
typedef struct term { /* describe an actual terminal */ |
|||
TERMTYPE type; /* terminal type description */ |
|||
short Filedes; /* file description being written to */ |
|||
TTY Ottyb, /* original state of the terminal */ |
|||
Nttyb; /* current state of the terminal */ |
|||
int _baudrate; /* used to compute padding */ |
|||
char * _termname; /* used for termname() */ |
|||
} TERMINAL; |
|||
|
|||
#if 0 && !0
|
|||
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; |
|||
#elif 0 |
|||
NCURSES_WRAPPED_VAR(TERMINAL *, cur_term); |
|||
#define cur_term NCURSES_PUBLIC_VAR(cur_term()) |
|||
#else |
|||
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; |
|||
#endif |
|||
|
|||
#if 0 || 0
|
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); |
|||
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); |
|||
|
|||
#define boolnames NCURSES_PUBLIC_VAR(boolnames()) |
|||
#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) |
|||
#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) |
|||
#define numnames NCURSES_PUBLIC_VAR(numnames()) |
|||
#define numcodes NCURSES_PUBLIC_VAR(numcodes()) |
|||
#define numfnames NCURSES_PUBLIC_VAR(numfnames()) |
|||
#define strnames NCURSES_PUBLIC_VAR(strnames()) |
|||
#define strcodes NCURSES_PUBLIC_VAR(strcodes()) |
|||
#define strfnames NCURSES_PUBLIC_VAR(strfnames()) |
|||
|
|||
#else |
|||
|
|||
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 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(int) _nc_read_termtype (TERMTYPE *, char *, int); |
|||
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(const TERMTYPE *) _nc_fallback (const char *); |
|||
|
|||
/* entry points */ |
|||
extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); |
|||
extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); |
|||
|
|||
/* miscellaneous entry points */ |
|||
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 NCURSES_EXPORT(char *) tigetstr (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 *); |
|||
|
|||
#if 1 /* NCURSES_TPARM_VARARGS */ |
|||
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ |
|||
#else |
|||
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ |
|||
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ |
|||
#endif |
|||
|
|||
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ |
|||
|
|||
#endif /* __NCURSES_H */ |
|||
|
|||
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ |
|||
#if !defined(NCURSES_TERMCAP_H_incl) |
|||
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 /* NCURSES_TERMCAP_H_incl */ |
|||
|
|||
/*
|
|||
* Include curses.h before term.h to enable these extensions. |
|||
*/ |
|||
#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) |
|||
|
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *); |
|||
|
|||
#if 1 /* NCURSES_TPARM_VARARGS */ |
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */ |
|||
#else |
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ |
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */ |
|||
#endif |
|||
|
|||
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ |
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **); |
|||
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC); |
|||
|
|||
extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *); |
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *); |
|||
|
|||
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *); |
|||
#endif /* NCURSES_SP_FUNCS */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* NCURSES_TERM_H_incl */ |
@ -0,0 +1,174 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2008,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * |
|||
* and: Eric S. Raymond <esr@snark.thyrsus.com> * |
|||
* and: Thomas E. Dickey 1998-on * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: term_entry.h,v 1.37 2009/07/11 16:52:29 tom Exp $ */ |
|||
|
|||
/*
|
|||
* term_entry.h -- interface to entry-manipulation code |
|||
*/ |
|||
|
|||
#ifndef NCURSES_TERM_ENTRY_H_incl |
|||
#define NCURSES_TERM_ENTRY_H_incl 1 |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#include <ncurses/term.h> |
|||
|
|||
#define MAX_USES 32 |
|||
#define MAX_CROSSLINKS 16 |
|||
|
|||
typedef struct entry { |
|||
TERMTYPE tterm; |
|||
unsigned nuses; |
|||
struct |
|||
{ |
|||
char *name; |
|||
struct entry *link; |
|||
long line; |
|||
} |
|||
uses[MAX_USES]; |
|||
int ncrosslinks; |
|||
struct entry *crosslinks[MAX_CROSSLINKS]; |
|||
long cstart, cend; |
|||
long startline; |
|||
struct entry *next; |
|||
struct entry *last; |
|||
} |
|||
ENTRY; |
|||
|
|||
#if NCURSES_XNAMES |
|||
#define NUM_BOOLEANS(tp) (tp)->num_Booleans |
|||
#define NUM_NUMBERS(tp) (tp)->num_Numbers |
|||
#define NUM_STRINGS(tp) (tp)->num_Strings |
|||
#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] |
|||
#else |
|||
#define NUM_BOOLEANS(tp) BOOLCOUNT |
|||
#define NUM_NUMBERS(tp) NUMCOUNT |
|||
#define NUM_STRINGS(tp) STRCOUNT |
|||
#define EXT_NAMES(tp,i,limit,index,table) table[i] |
|||
#endif |
|||
|
|||
#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) |
|||
|
|||
#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) |
|||
#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) |
|||
#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) |
|||
|
|||
#if NCURSES_XNAMES |
|||
#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; n < NUM_BOOLEANS(tp); n++) |
|||
#define for_each_ext_number(n,tp) for(n = NUMCOUNT; n < NUM_NUMBERS(tp); n++) |
|||
#define for_each_ext_string(n,tp) for(n = STRCOUNT; n < NUM_STRINGS(tp); n++) |
|||
#endif |
|||
|
|||
#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) |
|||
#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 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 |
|||
|
|||
#define NULLHOOK (bool(*)(ENTRY *))0 |
|||
|
|||
/*
|
|||
* Note that WANTED and PRESENT are not simple inverses! If a capability |
|||
* has been explicitly cancelled, it's not considered WANTED. |
|||
*/ |
|||
#define WANTED(s) ((s) == ABSENT_STRING) |
|||
#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) |
|||
|
|||
#define ANDMISSING(p,q) \ |
|||
{if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);} |
|||
|
|||
#define PAIRED(p,q) \ |
|||
{ \ |
|||
if (PRESENT(q) && !PRESENT(p)) \ |
|||
_nc_warning(#q " but no " #p); \ |
|||
if (PRESENT(p) && !PRESENT(q)) \ |
|||
_nc_warning(#p " but no " #q); \ |
|||
} |
|||
|
|||
/* alloc_entry.c: elementary allocation code */ |
|||
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 NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); |
|||
extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *); |
|||
|
|||
/* free_ttype.c: elementary allocation code */ |
|||
extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); |
|||
|
|||
/* lib_acs.c */ |
|||
extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ |
|||
|
|||
/* lib_termcap.c: trim sgr0 string for termcap users */ |
|||
extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE *); |
|||
|
|||
/* parse_entry.c: entry-parsing code */ |
|||
#if NCURSES_XNAMES |
|||
extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; |
|||
extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; |
|||
#endif |
|||
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 NCURSES_EXPORT(void) _nc_set_writedir (char *); |
|||
extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); |
|||
|
|||
/* comp_parse.c: entry list handling */ |
|||
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); /* obs 20040705 */ |
|||
extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); |
|||
extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); |
|||
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ |
|||
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool); |
|||
|
|||
/* trace_xnames.c */ |
|||
extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* NCURSES_TERM_ENTRY_H_incl */ |
@ -0,0 +1,75 @@ |
|||
/****************************************************************************
|
|||
* 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * |
|||
* and: Eric S. Raymond <esr@snark.thyrsus.com> * |
|||
****************************************************************************/ |
|||
|
|||
/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */ |
|||
|
|||
#ifndef NCURSES_TERMCAP_H_incl |
|||
#define NCURSES_TERMCAP_H_incl 1 |
|||
|
|||
#undef NCURSES_VERSION |
|||
#define NCURSES_VERSION "5.9" |
|||
|
|||
#include <ncurses/ncurses_dll.h> |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" |
|||
{ |
|||
#endif /* __cplusplus */ |
|||
|
|||
#include <sys/types.h> |
|||
|
|||
#undef NCURSES_CONST |
|||
#define NCURSES_CONST /*nothing*/ |
|||
|
|||
#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(NCURSES_TERM_H_incl) |
|||
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 |
|||
} |
|||
#endif |
|||
|
|||
#endif /* NCURSES_TERMCAP_H_incl */ |
@ -0,0 +1,346 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2007,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * |
|||
* and: Eric S. Raymond <esr@snark.thyrsus.com> * |
|||
* and: Thomas E. Dickey 1996 on * |
|||
****************************************************************************/ |
|||
|
|||
/*
|
|||
* $Id: tic.h,v 1.65 2009/08/08 17:52:46 tom Exp $ |
|||
* tic.h - Global variables and structures for the terminfo |
|||
* compiler. |
|||
*/ |
|||
|
|||
#ifndef __TIC_H |
|||
#define __TIC_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#include <ncurses/curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */ |
|||
|
|||
/*
|
|||
** The format of compiled terminfo files is as follows: |
|||
** |
|||
** Header (12 bytes), containing information given below |
|||
** Names Section, containing the names of the terminal |
|||
** Boolean Section, containing the values of all of the |
|||
** boolean capabilities |
|||
** A null byte may be inserted here to make |
|||
** sure that the Number Section begins on an |
|||
** even word boundary. |
|||
** Number Section, containing the values of all of the numeric |
|||
** capabilities, each as a short integer |
|||
** String Section, containing short integer offsets into the |
|||
** String Table, one per string capability |
|||
** String Table, containing the actual characters of the string |
|||
** capabilities. |
|||
** |
|||
** NOTE that all short integers in the file are stored using VAX/PDP-style |
|||
** byte-order, i.e., least-significant byte first. |
|||
** |
|||
** There is no structure definition here because it would only confuse |
|||
** matters. Terminfo format is a raw byte layout, not a structure |
|||
** dump. If you happen to be on a little-endian machine with 16-bit |
|||
** shorts that requires no padding between short members in a struct, |
|||
** then there is a natural C structure that captures the header, but |
|||
** not very helpfully. |
|||
*/ |
|||
|
|||
#define MAGIC 0432 /* first two bytes of a compiled entry */ |
|||
|
|||
#undef BYTE |
|||
#define BYTE(p,n) (unsigned char)((p)[n]) |
|||
|
|||
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377)) |
|||
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377)) |
|||
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1)) |
|||
|
|||
#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC) |
|||
|
|||
/*
|
|||
* The "maximum" here is misleading; XSI guarantees minimum values, which a |
|||
* given implementation may exceed. |
|||
*/ |
|||
#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ |
|||
#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ |
|||
|
|||
/*
|
|||
* The maximum size of individual name or alias is guaranteed in XSI to be at |
|||
* least 14, since that corresponds to the older filename lengths. Newer |
|||
* systems allow longer aliases, though not many terminal descriptions are |
|||
* written to use them. The MAX_ALIAS symbol is used for warnings. |
|||
*/ |
|||
#if HAVE_LONG_FILE_NAMES |
|||
#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ |
|||
#else |
|||
#define MAX_ALIAS 14 /* SVr3 filename length */ |
|||
#endif |
|||
|
|||
/* location of user's personal info directory */ |
|||
#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ |
|||
|
|||
/*
|
|||
* Some traces are designed to be used via tic's verbose option (and similar in |
|||
* infocmp and toe) rather than the 'trace()' function. So we use the bits |
|||
* above the normal trace() parameter as a debug-level. |
|||
*/ |
|||
|
|||
#define MAX_DEBUG_LEVEL 15 |
|||
#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) |
|||
|
|||
#define set_trace_level(n) \ |
|||
_nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ |
|||
_nc_tracing |= DEBUG_LEVEL(n) |
|||
|
|||
#ifdef TRACE |
|||
#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a |
|||
#else |
|||
#define DEBUG(n, a) /*nothing*/ |
|||
#endif |
|||
|
|||
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 *); |
|||
extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); |
|||
|
|||
/*
|
|||
* These are the types of tokens returned by the scanner. The first |
|||
* three are also used in the hash table of capability names. The scanner |
|||
* returns one of these values after loading the specifics into the global |
|||
* structure curr_token. |
|||
*/ |
|||
|
|||
#define BOOLEAN 0 /* Boolean capability */ |
|||
#define NUMBER 1 /* Numeric capability */ |
|||
#define STRING 2 /* String-valued capability */ |
|||
#define CANCEL 3 /* Capability to be cancelled in following tc's */ |
|||
#define NAMES 4 /* The names for a terminal type */ |
|||
#define UNDEF 5 /* Undefined */ |
|||
|
|||
#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ |
|||
|
|||
/*
|
|||
* The global structure in which the specific parts of a |
|||
* scanned token are returned. |
|||
* |
|||
*/ |
|||
|
|||
struct token |
|||
{ |
|||
char *tk_name; /* name of capability */ |
|||
int tk_valnumber; /* value of capability (if a number) */ |
|||
char *tk_valstring; /* value of capability (if a string) */ |
|||
}; |
|||
|
|||
extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; |
|||
|
|||
/*
|
|||
* Offsets to string capabilities, with the corresponding functionkey |
|||
* codes. |
|||
*/ |
|||
struct tinfo_fkeys { |
|||
unsigned offset; |
|||
chtype code; |
|||
}; |
|||
|
|||
#if BROKEN_LINKER |
|||
|
|||
#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() |
|||
extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); |
|||
|
|||
#else |
|||
|
|||
extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; |
|||
|
|||
#endif |
|||
|
|||
typedef short HashValue; |
|||
|
|||
/*
|
|||
* The file comp_captab.c contains an array of these structures, one |
|||
* per possible capability. These are indexed by a hash table array of |
|||
* pointers to the same structures for use by the parser. |
|||
*/ |
|||
|
|||
struct name_table_entry |
|||
{ |
|||
const char *nte_name; /* name to hash on */ |
|||
int nte_type; /* BOOLEAN, NUMBER or STRING */ |
|||
HashValue nte_index; /* index of associated variable in its array */ |
|||
HashValue nte_link; /* index in table of next hash, or -1 */ |
|||
}; |
|||
|
|||
/*
|
|||
* Use this structure to hide differences between terminfo and termcap |
|||
* tables. |
|||
*/ |
|||
typedef struct { |
|||
unsigned table_size; |
|||
const HashValue *table_data; |
|||
HashValue (*hash_of)(const char *); |
|||
int (*compare_names)(const char *, const char *); |
|||
} HashData; |
|||
|
|||
struct alias |
|||
{ |
|||
const char *from; |
|||
const char *to; |
|||
const char *source; |
|||
}; |
|||
|
|||
extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); |
|||
extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool); |
|||
extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool); |
|||
extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool); |
|||
|
|||
#define NOTFOUND ((struct name_table_entry *) 0) |
|||
|
|||
/* out-of-band values for representing absent capabilities */ |
|||
#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ |
|||
#define ABSENT_NUMERIC (-1) |
|||
#define ABSENT_STRING (char *)0 |
|||
|
|||
/* out-of-band values for representing cancels */ |
|||
#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ |
|||
#define CANCELLED_NUMERIC (-2) |
|||
#define CANCELLED_STRING (char *)(-1) |
|||
|
|||
#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ |
|||
#define VALID_NUMERIC(s) ((s) >= 0) |
|||
#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) |
|||
|
|||
/* termcap entries longer than this may break old binaries */ |
|||
#define MAX_TERMCAP_LENGTH 1023 |
|||
|
|||
/* this is a documented limitation of terminfo */ |
|||
#define MAX_TERMINFO_LENGTH 4096 |
|||
|
|||
#ifndef TERMINFO |
|||
#define TERMINFO "/usr/share/terminfo" |
|||
#endif |
|||
|
|||
/* access.c */ |
|||
extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); |
|||
extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); |
|||
extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *); |
|||
extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *); |
|||
extern NCURSES_EXPORT(char *) _nc_basename (char *); |
|||
extern NCURSES_EXPORT(char *) _nc_rootname (char *); |
|||
|
|||
/* comp_hash.c: name lookup */ |
|||
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry |
|||
(const char *, const HashValue *); |
|||
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry |
|||
(const char *, int, bool); |
|||
|
|||
/* comp_scan.c: lexical analysis */ |
|||
extern NCURSES_EXPORT(int) _nc_get_token (bool); |
|||
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 NCURSES_EXPORT(const char *) _nc_get_source (void); |
|||
extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; |
|||
extern NCURSES_EXPORT(void) _nc_get_type (char *name); |
|||
extern NCURSES_EXPORT(void) _nc_set_source (const char *const); |
|||
extern NCURSES_EXPORT(void) _nc_set_type (const char *const); |
|||
extern NCURSES_EXPORT(void) _nc_syserr_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 NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); |
|||
|
|||
/* comp_scan.c: decode string from readable form */ |
|||
extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *); |
|||
|
|||
/* captoinfo.c: capability conversion */ |
|||
extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); |
|||
extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); |
|||
|
|||
/* home_terminfo.c */ |
|||
extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); |
|||
|
|||
/* lib_tparm.c */ |
|||
#define NUM_PARM 9 |
|||
|
|||
extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; |
|||
|
|||
extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *); |
|||
|
|||
/* lib_tputs.c */ |
|||
extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ |
|||
|
|||
/* comp_main.c: compiler main */ |
|||
extern const char * _nc_progname; |
|||
|
|||
/* db_iterator.c */ |
|||
typedef enum { |
|||
dbdTIC = 0, |
|||
#if USE_DATABASE |
|||
dbdEnvOnce, |
|||
dbdHome, |
|||
dbdEnvList, |
|||
dbdCfgList, |
|||
dbdCfgOnce, |
|||
#endif |
|||
#if USE_TERMCAP |
|||
dbdEnvOnce2, |
|||
dbdEnvList2, |
|||
dbdCfgList2, |
|||
#endif |
|||
dbdLAST |
|||
} DBDIRS; |
|||
|
|||
extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); |
|||
extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); |
|||
extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); |
|||
extern NCURSES_EXPORT(void) _nc_last_db(void); |
|||
|
|||
/* write_entry.c */ |
|||
extern NCURSES_EXPORT(int) _nc_tic_written (void); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __TIC_H */ |
@ -0,0 +1,67 @@ |
|||
/****************************************************************************
|
|||
* Copyright (c) 1998-2008,2009 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"), to deal in the Software without restriction, including * |
|||
* without limitation the rights to use, copy, modify, merge, publish, * |
|||
* distribute, distribute with modifications, sublicense, and/or sell * |
|||
* copies of the Software, and to permit persons to whom the Software is * |
|||
* furnished to do so, subject to the following conditions: * |
|||
* * |
|||
* The above copyright notice and this permission notice shall be included * |
|||
* in all copies or substantial portions of the Software. * |
|||
* * |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
|||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
|||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
|||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
|||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
|||
* * |
|||
* Except as contained in this notice, the name(s) of the above copyright * |
|||
* holders shall not be used in advertising or otherwise to promote the * |
|||
* sale, use or other dealings in this Software without prior written * |
|||
* authorization. * |
|||
****************************************************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * |
|||
* and: Eric S. Raymond <esr@snark.thyrsus.com> * |
|||
****************************************************************************/ |
|||
|
|||
/*
|
|||
* unctrl.h |
|||
* |
|||
* Display a printable version of a control character. |
|||
* Control characters are displayed in caret notation (^x), DELETE is displayed |
|||
* as ^?. Printable characters are displayed as is. |
|||
*/ |
|||
|
|||
/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ |
|||
|
|||
#ifndef NCURSES_UNCTRL_H_incl |
|||
#define NCURSES_UNCTRL_H_incl 1 |
|||
|
|||
#undef NCURSES_VERSION |
|||
#define NCURSES_VERSION "5.9" |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#include <ncurses/curses.h> |
|||
|
|||
#undef unctrl |
|||
NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); |
|||
|
|||
#if 1 |
|||
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); |
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* NCURSES_UNCTRL_H_incl */ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue