mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-23 15:25:01 +00:00
Standardized the prototyping for the demos, plus some minor changes to
ensure they all compile under ncurses. (Everything works there, except some of the borders.)
This commit is contained in:
@@ -31,11 +31,15 @@
|
||||
#define DELAYSIZE 200
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_firework = "$Id: firework.c,v 1.9 2005/12/06 00:20:31 wmcbrine Exp $";
|
||||
char *rcsid_firework = "$Id: firework.c,v 1.10 2005/12/07 01:37:42 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef Args
|
||||
# ifdef HAVE_PROTO
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
@@ -46,7 +50,7 @@ void myrefresh Args((void));
|
||||
void get_colour Args((void));
|
||||
void explode Args((int,int));
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int main(int argc, char **argv)
|
||||
#else
|
||||
int main(argc, argv)
|
||||
@@ -108,7 +112,7 @@ char **argv;
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void explode(int row,int col)
|
||||
#else
|
||||
void explode(row,col)
|
||||
@@ -158,22 +162,14 @@ int row,col;
|
||||
myrefresh();
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
void myrefresh(void)
|
||||
#else
|
||||
void myrefresh()
|
||||
#endif
|
||||
void myrefresh Args((void))
|
||||
{
|
||||
napms(DELAYSIZE);
|
||||
move(LINES-1,COLS-1);
|
||||
refresh();
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
void get_colour(void)
|
||||
#else
|
||||
void get_colour()
|
||||
#endif
|
||||
void get_colour Args((void))
|
||||
{
|
||||
static short tbl[] =
|
||||
{
|
||||
|
||||
@@ -39,11 +39,15 @@
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_newdemo = "$Id: newdemo.c,v 1.11 2005/12/06 00:20:31 wmcbrine Exp $";
|
||||
char *rcsid_newdemo = "$Id: newdemo.c,v 1.12 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef Args
|
||||
# ifdef HAVE_PROTO
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
@@ -93,11 +97,7 @@ char *messages[] =
|
||||
/*
|
||||
* Wait for user
|
||||
*/
|
||||
#ifdef HAVE_PROTO
|
||||
int WaitForUser(void)
|
||||
#else
|
||||
int WaitForUser()
|
||||
#endif
|
||||
int WaitForUser Args((void))
|
||||
{
|
||||
chtype ch;
|
||||
|
||||
@@ -116,7 +116,7 @@ int WaitForUser()
|
||||
/*
|
||||
* Test sub windows
|
||||
*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int SubWinTest(WINDOW *win)
|
||||
#else
|
||||
int SubWinTest(win)
|
||||
@@ -168,7 +168,7 @@ WINDOW *win;
|
||||
/*
|
||||
* Bouncing balls
|
||||
*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int BouncingBalls(WINDOW *win)
|
||||
#else
|
||||
int BouncingBalls(win)
|
||||
@@ -253,7 +253,7 @@ WINDOW *win;
|
||||
/*
|
||||
* Trap interrupt
|
||||
*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void trap(int sig)
|
||||
#else
|
||||
void trap(sig)
|
||||
@@ -273,7 +273,7 @@ int sig;
|
||||
/*
|
||||
* Main driver
|
||||
*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int main(int argc, char **argv)
|
||||
#else
|
||||
int main(argc, argv)
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_ptest = "$Id: ptest.c,v 1.7 2005/12/06 00:20:31 wmcbrine Exp $";
|
||||
char *rcsid_ptest = "$Id: ptest.c,v 1.8 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#include <curses.h>
|
||||
#include "panel.h"
|
||||
#include <panel.h>
|
||||
|
||||
PANEL *p1;
|
||||
PANEL *p2;
|
||||
@@ -43,8 +43,6 @@ WINDOW *w3;
|
||||
WINDOW *w4;
|
||||
WINDOW *w5;
|
||||
|
||||
#define getmaxx(w) (w)->_maxx
|
||||
#define getmaxy(w) (w)->_maxy
|
||||
#define nap(x) usleep(1000*x)
|
||||
|
||||
long nap_msec = 1;
|
||||
@@ -59,19 +57,29 @@ char *mod[] =
|
||||
"LAST "
|
||||
};
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
PANEL *mkpanel(int, int, int, int);
|
||||
void fill_panel(PANEL *);
|
||||
void pflush(void);
|
||||
void wait_a_while(long);
|
||||
void saywhat(const char *);
|
||||
void rmpanel(PANEL *);
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef Args
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
PANEL *mkpanel Args((int, int, int, int));
|
||||
void fill_panel Args((PANEL *));
|
||||
void pflush Args((void));
|
||||
void wait_a_while Args((long));
|
||||
void saywhat Args((const char *));
|
||||
void rmpanel Args((PANEL *));
|
||||
|
||||
/*+-------------------------------------------------------------------------
|
||||
wait_a_while(msec)
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void wait_a_while(long msec)
|
||||
#else
|
||||
void
|
||||
@@ -86,7 +94,7 @@ long msec;
|
||||
/*+-------------------------------------------------------------------------
|
||||
saywhat(text)
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void saywhat(const char *text)
|
||||
#else
|
||||
void
|
||||
@@ -103,7 +111,7 @@ const char *text;
|
||||
/*+-------------------------------------------------------------------------
|
||||
mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
PANEL *mkpanel(int rows, int cols, int tly, int tlx)
|
||||
#else
|
||||
PANEL *
|
||||
@@ -128,7 +136,7 @@ PANEL *pan = (PANEL *)0;
|
||||
/*+-------------------------------------------------------------------------
|
||||
rmpanel(pan)
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void rmpanel(PANEL *pan)
|
||||
#else
|
||||
void
|
||||
@@ -144,12 +152,7 @@ WINDOW *win = pan->win;
|
||||
/*+-------------------------------------------------------------------------
|
||||
pflush()
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
void pflush(void)
|
||||
#else
|
||||
void
|
||||
pflush()
|
||||
#endif
|
||||
void pflush Args((void))
|
||||
{
|
||||
update_panels();
|
||||
doupdate();
|
||||
@@ -158,7 +161,7 @@ pflush()
|
||||
/*+-------------------------------------------------------------------------
|
||||
fill_panel(win)
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
void fill_panel(PANEL *pan)
|
||||
#else
|
||||
void
|
||||
@@ -167,7 +170,7 @@ PANEL *pan;
|
||||
#endif
|
||||
{
|
||||
WINDOW *win = pan->win;
|
||||
char num = *(pan->user + 1);
|
||||
char num = *((char *)pan->user + 1);
|
||||
int y,x;
|
||||
|
||||
box(win, 0, 0);
|
||||
@@ -186,7 +189,7 @@ int y,x;
|
||||
/*+-------------------------------------------------------------------------
|
||||
main(argc,argv)
|
||||
--------------------------------------------------------------------------*/
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int main(int argc, char **argv)
|
||||
#else
|
||||
int
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
# define CURSES_LIBRARY /* needed for the prototype of PDC_debug */
|
||||
char *rcsid_testcurs = "$Id: testcurs.c,v 1.18 2005/12/06 23:36:33 wmcbrine Exp $";
|
||||
char *rcsid_testcurs = "$Id: testcurs.c,v 1.19 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -43,37 +43,29 @@ char *rcsid_testcurs = "$Id: testcurs.c,v 1.18 2005/12/06 23:36:33 wmcbrine Exp
|
||||
#include <curses.h>
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
void inputTest (WINDOW *);
|
||||
void scrollTest (WINDOW *);
|
||||
void introTest (WINDOW *);
|
||||
int initTest (WINDOW **, int, char **);
|
||||
void outputTest (WINDOW *);
|
||||
void padTest (WINDOW *);
|
||||
void display_menu(int,int);
|
||||
# if defined(PDCURSES) && !defined(XCURSES)
|
||||
void resizeTest (WINDOW *);
|
||||
# endif
|
||||
# ifdef PDCURSES
|
||||
void clipboardTest(WINDOW *);
|
||||
# endif
|
||||
#else
|
||||
void inputTest ();
|
||||
void scrollTest ();
|
||||
void introTest ();
|
||||
int initTest ();
|
||||
void outputTest ();
|
||||
void padTest ();
|
||||
void display_menu();
|
||||
# if defined(PDCURSES) && !defined(XCURSES)
|
||||
void resizeTest ();
|
||||
# endif
|
||||
# ifdef PDCURSES
|
||||
void clipboardTest();
|
||||
# endif
|
||||
#ifndef Args
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void inputTest Args((WINDOW *));
|
||||
void scrollTest Args((WINDOW *));
|
||||
void introTest Args((WINDOW *));
|
||||
int initTest Args((WINDOW **, int, char **));
|
||||
void outputTest Args((WINDOW *));
|
||||
void padTest Args((WINDOW *));
|
||||
void display_menu Args((int,int));
|
||||
#ifdef PDCURSES
|
||||
# ifdef XCURSES
|
||||
void resizeTest Args((WINDOW *));
|
||||
# endif
|
||||
void clipboardTest Args((WINDOW *));
|
||||
#endif
|
||||
|
||||
struct commands
|
||||
@@ -85,25 +77,32 @@ struct commands
|
||||
void (*function)();
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct commands COMMAND;
|
||||
#if defined(PDCURSES) && !defined(XCURSES)
|
||||
# define MAX_OPTIONS 7
|
||||
|
||||
#ifdef PDCURSES
|
||||
# ifndef XCURSES
|
||||
# define MAX_OPTIONS 7
|
||||
# else
|
||||
# define MAX_OPTIONS 6
|
||||
# endif
|
||||
#else
|
||||
# define MAX_OPTIONS 6
|
||||
# define MAX_OPTIONS 5
|
||||
#endif
|
||||
|
||||
COMMAND command[MAX_OPTIONS] =
|
||||
{
|
||||
{"Intro Test",introTest},
|
||||
{"Pad Test",padTest},
|
||||
# if defined(PDCURSES) && !defined(XCURSES)
|
||||
#if defined(PDCURSES) && !defined(XCURSES)
|
||||
{"Resize Test",resizeTest},
|
||||
#endif
|
||||
{"Scroll Test",scrollTest},
|
||||
{"Input Test",inputTest},
|
||||
{"Output Test",outputTest},
|
||||
# if defined(PDCURSES)
|
||||
#if defined(PDCURSES)
|
||||
{"Clipboard Test",clipboardTest},
|
||||
# endif
|
||||
#endif
|
||||
};
|
||||
|
||||
int width, height;
|
||||
@@ -531,6 +530,7 @@ WINDOW *win;
|
||||
mvwprintw(win, 4, 2, "String: %s", buffer);
|
||||
Continue(win);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void outputTest (WINDOW *win)
|
||||
#else
|
||||
@@ -793,12 +793,12 @@ WINDOW *pad,*spad;
|
||||
}
|
||||
|
||||
#ifdef PDCURSES
|
||||
#ifdef __STDC__
|
||||
# ifdef __STDC__
|
||||
void clipboardTest (WINDOW *win)
|
||||
#else
|
||||
# else
|
||||
void clipboardTest (win)
|
||||
WINDOW *win;
|
||||
#endif
|
||||
# endif
|
||||
{
|
||||
long i,length=0;
|
||||
char *Message1 = "This test will display the contents of the system clipboard";
|
||||
|
||||
152
demos/tui.c
152
demos/tui.c
@@ -40,14 +40,12 @@
|
||||
#include <time.h>
|
||||
#include "tui.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
void statusmsg (char *);
|
||||
int waitforkey (void);
|
||||
void rmerror (void);
|
||||
#endif
|
||||
void statusmsg Args((char *));
|
||||
int waitforkey Args((void));
|
||||
void rmerror Args((void));
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_tui = "$Id: tui.c,v 1.7 2005/11/23 01:16:55 wmcbrine Exp $";
|
||||
char *rcsid_tui = "$Id: tui.c,v 1.8 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(__unix) && !defined(__DJGPP__)
|
||||
@@ -93,10 +91,10 @@ static bool quit = FALSE;
|
||||
static bool incurses = FALSE;
|
||||
|
||||
#ifndef PDCURSES
|
||||
static char wordchar (void) { return 0x17; } /* ^W */
|
||||
static char wordchar Args((void)) { return 0x17; } /* ^W */
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static char *padstr (char *s,int length)
|
||||
#else
|
||||
static char *padstr (s,length)
|
||||
@@ -112,7 +110,7 @@ int length;
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static char *prepad (char *s, int length)
|
||||
#else
|
||||
static char *prepad (s,length)
|
||||
@@ -131,7 +129,7 @@ int length;
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void rmline (WINDOW *win, int nr) /* keeps box lines intact */
|
||||
#else
|
||||
static void rmline (win, nr) /* keeps box lines intact */
|
||||
@@ -143,11 +141,7 @@ int nr;
|
||||
wrefresh (win);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void initcolor (void)
|
||||
#else
|
||||
static void initcolor ()
|
||||
#endif
|
||||
static void initcolor Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors()) start_color(); /* foreground, background */
|
||||
@@ -163,7 +157,7 @@ static void initcolor ()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void setcolor (WINDOW *win, chtype color)
|
||||
#else
|
||||
static void setcolor (win, color)
|
||||
@@ -182,7 +176,7 @@ chtype color;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void colorbox (WINDOW *win, chtype color, int hasbox)
|
||||
#else
|
||||
static void colorbox (win, color, hasbox)
|
||||
@@ -207,11 +201,7 @@ int hasbox;
|
||||
touchwin (win); wrefresh (win);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void idle (void)
|
||||
#else
|
||||
static void idle ()
|
||||
#endif
|
||||
static void idle Args((void))
|
||||
{
|
||||
char buf[MAXSTRLEN];
|
||||
time_t t;
|
||||
@@ -226,7 +216,7 @@ static void idle ()
|
||||
wrefresh (wtitl);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void menudim (menu *mp, int *lines, int *columns)
|
||||
#else
|
||||
static void menudim (mp, lines, columns)
|
||||
@@ -243,7 +233,7 @@ int *columns;
|
||||
*columns = mmax + 2;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void setmenupos (int y, int x)
|
||||
#else
|
||||
static void setmenupos (y, x)
|
||||
@@ -253,7 +243,7 @@ int y, x;
|
||||
nexty = y; nextx = x;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void getmenupos (int *y, int *x)
|
||||
#else
|
||||
static void getmenupos (y, x)
|
||||
@@ -263,7 +253,7 @@ int *y, *x;
|
||||
*y = nexty; *x = nextx;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static int hotkey (char *s)
|
||||
#else
|
||||
static int hotkey (s)
|
||||
@@ -276,7 +266,7 @@ char *s;
|
||||
return *s ? *s : c0;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void repaintmenu (WINDOW *wmenu, menu *mp)
|
||||
#else
|
||||
static void repaintmenu (wmenu, mp)
|
||||
@@ -292,7 +282,7 @@ menu *mp;
|
||||
touchwin (wmenu); wrefresh (wmenu);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void repaintmainmenu (int width, menu *mp)
|
||||
#else
|
||||
static void repaintmainmenu (width, mp)
|
||||
@@ -308,11 +298,7 @@ menu *mp;
|
||||
touchwin (wmain); wrefresh (wmain);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void mainhelp (void)
|
||||
#else
|
||||
static void mainhelp ()
|
||||
#endif
|
||||
static void mainhelp Args((void))
|
||||
{
|
||||
#ifdef ALT_X
|
||||
statusmsg ("Use arrow keys and Enter to select (Alt-X to quit)");
|
||||
@@ -321,40 +307,28 @@ static void mainhelp ()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void hidecursor (void)
|
||||
#else
|
||||
static void hidecursor ()
|
||||
#endif
|
||||
static void hidecursor Args((void))
|
||||
{
|
||||
#if defined(PDCURSES) || defined(SYSV)
|
||||
curs_set (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void normalcursor (void)
|
||||
#else
|
||||
static void normalcursor ()
|
||||
#endif
|
||||
static void normalcursor Args((void))
|
||||
{
|
||||
#if defined(PDCURSES) || defined(SYSV)
|
||||
curs_set (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void insertcursor (void)
|
||||
#else
|
||||
static void insertcursor ()
|
||||
#endif
|
||||
static void insertcursor Args((void))
|
||||
{
|
||||
#if defined(PDCURSES) || defined(SYSV)
|
||||
curs_set (2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void mainmenu (menu *mp)
|
||||
#else
|
||||
static void mainmenu (mp)
|
||||
@@ -438,11 +412,7 @@ menu *mp;
|
||||
touchwin (wbody); wrefresh (wbody);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static void cleanup (void) /* cleanup curses settings */
|
||||
#else
|
||||
static void cleanup ()
|
||||
#endif
|
||||
static void cleanup Args((void)) /* cleanup curses settings */
|
||||
{
|
||||
if (incurses)
|
||||
{
|
||||
@@ -462,52 +432,32 @@ static void cleanup ()
|
||||
|
||||
/******************************* EXTERNAL **********************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void clsbody (void)
|
||||
#else
|
||||
void clsbody ()
|
||||
#endif
|
||||
void clsbody Args((void))
|
||||
{
|
||||
werase (wbody); wmove (wbody, 0, 0);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
int bodylen (void)
|
||||
#else
|
||||
int bodylen ()
|
||||
#endif
|
||||
int bodylen Args((void))
|
||||
{
|
||||
return wbody->_maxy;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
WINDOW *bodywin (void)
|
||||
#else
|
||||
WINDOW *bodywin ()
|
||||
#endif
|
||||
WINDOW *bodywin Args((void))
|
||||
{
|
||||
return wbody;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void rmerror (void)
|
||||
#else
|
||||
void rmerror ()
|
||||
#endif
|
||||
void rmerror Args((void))
|
||||
{
|
||||
rmline (wstat, 0);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void rmstatus (void)
|
||||
#else
|
||||
void rmstatus ()
|
||||
#endif
|
||||
void rmstatus Args((void))
|
||||
{
|
||||
rmline (wstat, 1);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void titlemsg (char *msg)
|
||||
#else
|
||||
void titlemsg (msg)
|
||||
@@ -518,7 +468,7 @@ char *msg;
|
||||
wrefresh (wtitl);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void bodymsg (char *msg)
|
||||
#else
|
||||
void bodymsg (msg)
|
||||
@@ -529,7 +479,7 @@ char *msg;
|
||||
wrefresh (wbody);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void errormsg (char *msg)
|
||||
#else
|
||||
void errormsg (msg)
|
||||
@@ -541,7 +491,7 @@ char *msg;
|
||||
wrefresh (wstat);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void statusmsg (char *msg)
|
||||
#else
|
||||
void statusmsg (msg)
|
||||
@@ -552,22 +502,14 @@ char *msg;
|
||||
wrefresh (wstat);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
bool keypressed (void)
|
||||
#else
|
||||
bool keypressed ()
|
||||
#endif
|
||||
bool keypressed Args((void))
|
||||
{
|
||||
ch = wgetch(wbody);
|
||||
|
||||
return ch != ERR;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
int getkey (void)
|
||||
#else
|
||||
int getkey ()
|
||||
#endif
|
||||
int getkey Args((void))
|
||||
{
|
||||
int c = ch;
|
||||
|
||||
@@ -578,26 +520,18 @@ int getkey ()
|
||||
return c;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
int waitforkey (void)
|
||||
#else
|
||||
int waitforkey ()
|
||||
#endif
|
||||
int waitforkey Args((void))
|
||||
{
|
||||
do idle (); while (!keypressed());
|
||||
return getkey ();
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void DoExit (void) /* terminate program */
|
||||
#else
|
||||
void DoExit () /* terminate program */
|
||||
#endif
|
||||
void DoExit Args((void)) /* terminate program */
|
||||
{
|
||||
quit = TRUE;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void domenu (menu *mp)
|
||||
#else
|
||||
void domenu (mp)
|
||||
@@ -674,7 +608,7 @@ menu *mp;
|
||||
touchwin (wbody); wrefresh (wbody);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void startmenu (menu *mp, char *mtitle)
|
||||
#else
|
||||
void startmenu (mp, mtitle)
|
||||
@@ -748,7 +682,7 @@ char *mtitle;
|
||||
**man-end**********************************************************************/
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
static void repainteditbox (WINDOW *win, int x, char *buf)
|
||||
#else
|
||||
static void repainteditbox (win, x, buf)
|
||||
@@ -761,7 +695,7 @@ char *buf;
|
||||
wmove (win, 0, x); wrefresh (win);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
int weditstr (WINDOW *win, char *buf, int field)
|
||||
#else
|
||||
int weditstr (win, buf, field)
|
||||
@@ -866,7 +800,7 @@ int field;
|
||||
return c;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
WINDOW *winputbox (WINDOW *win, int nlines, int ncols)
|
||||
#else
|
||||
WINDOW *winputbox (win, nlines, ncols)
|
||||
@@ -883,7 +817,7 @@ int nlines, ncols;
|
||||
return winp;
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
int getstrings (char *desc[], char *buf[], int field)
|
||||
#else
|
||||
int getstrings (desc, buf, field)
|
||||
|
||||
74
demos/tui.h
74
demos/tui.h
@@ -30,7 +30,15 @@
|
||||
#include <curses.h>
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef Args
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef getbegyx
|
||||
@@ -50,7 +58,7 @@
|
||||
#define MAXSTRLEN 256
|
||||
#define KEY_ESC 0x1b /* Escape */
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
typedef void (*FUNC)(void);
|
||||
#else
|
||||
typedef void (*FUNC)();
|
||||
@@ -65,55 +73,29 @@ typedef struct
|
||||
|
||||
/* ANSI C function prototypes: */
|
||||
|
||||
#ifdef __STDC__
|
||||
void clsbody (void);
|
||||
int bodylen (void);
|
||||
WINDOW *bodywin (void);
|
||||
void clsbody Args((void));
|
||||
int bodylen Args((void));
|
||||
WINDOW *bodywin Args((void));
|
||||
|
||||
void rmerror (void);
|
||||
void rmstatus (void);
|
||||
void rmerror Args((void));
|
||||
void rmstatus Args((void));
|
||||
|
||||
void titlemsg (char *msg);
|
||||
void bodymsg (char *msg);
|
||||
void errormsg (char *msg);
|
||||
void statusmsg (char *msg);
|
||||
void titlemsg Args((char *msg));
|
||||
void bodymsg Args((char *msg));
|
||||
void errormsg Args((char *msg));
|
||||
void statusmsg Args((char *msg));
|
||||
|
||||
bool keypressed (void);
|
||||
int getkey (void);
|
||||
int waitforkey (void);
|
||||
bool keypressed Args((void));
|
||||
int getkey Args((void));
|
||||
int waitforkey Args((void));
|
||||
|
||||
void DoExit (void);
|
||||
void startmenu (menu *mp, char *title);
|
||||
void domenu (menu *mp);
|
||||
void DoExit Args((void));
|
||||
void startmenu Args((menu *mp, char *title));
|
||||
void domenu Args((menu *mp));
|
||||
|
||||
int weditstr (WINDOW *win, char *buf, int field);
|
||||
WINDOW *winputbox (WINDOW *win, int nlines, int ncols);
|
||||
int getstrings (char *desc[], char *buf[], int field);
|
||||
#else
|
||||
void clsbody ();
|
||||
int bodylen ();
|
||||
WINDOW *bodywin ();
|
||||
|
||||
void rmerror ();
|
||||
void rmstatus ();
|
||||
|
||||
void titlemsg ();
|
||||
void bodymsg ();
|
||||
void errormsg ();
|
||||
void statusmsg ();
|
||||
|
||||
bool keypressed ();
|
||||
int getkey ();
|
||||
int waitforkey ();
|
||||
|
||||
void DoExit ();
|
||||
void startmenu ();
|
||||
void domenu ();
|
||||
|
||||
int weditstr ();
|
||||
WINDOW *winputbox ();
|
||||
int getstrings ();
|
||||
#endif
|
||||
int weditstr Args((WINDOW *win, char *buf, int field));
|
||||
WINDOW *winputbox Args((WINDOW *win, int nlines, int ncols));
|
||||
int getstrings Args((char *desc[], char *buf[], int field));
|
||||
|
||||
#define editstr(s,f) (weditstr(stdscr,s,f))
|
||||
#define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f))
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "tui.h"
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_tuidemo = "$Id: tuidemo.c,v 1.4 2005/12/06 00:20:31 wmcbrine Exp $";
|
||||
char *rcsid_tuidemo = "$Id: tuidemo.c,v 1.5 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#if defined(XCURSES)
|
||||
@@ -53,17 +53,9 @@ char *rcsid_tuidemo = "$Id: tuidemo.c,v 1.4 2005/12/06 00:20:31 wmcbrine Exp $"
|
||||
# define FNAME "demos\\tui.c" /* change this if source at other location */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__
|
||||
#endif
|
||||
|
||||
/**************************** strings entry box ***************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void address (void)
|
||||
#else
|
||||
void address ()
|
||||
#endif
|
||||
void address Args((void))
|
||||
{
|
||||
#ifdef __STDC__
|
||||
char *fieldname[6] = {"Name","Street","City","State","Country",(char*)0};
|
||||
@@ -94,7 +86,7 @@ void address ()
|
||||
|
||||
/**************************** string entry box ****************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
char *getfname (char *desc, char *fname, int field)
|
||||
#else
|
||||
char *getfname (desc, fname, field)
|
||||
@@ -112,7 +104,7 @@ int field;
|
||||
|
||||
/**************************** a very simple file browser ******************/
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__
|
||||
void showfile (char *fname)
|
||||
#else
|
||||
void showfile (fname)
|
||||
@@ -160,17 +152,10 @@ char *fname;
|
||||
|
||||
/***************************** forward declarations ***********************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void sub0(void), sub1(void), sub2(void), sub3(void);
|
||||
void func1(void), func2(void);
|
||||
void subfunc1(void), subfunc2(void);
|
||||
void subsub(void);
|
||||
#else
|
||||
void sub0(), sub1(), sub2(), sub3();
|
||||
void func1(), func2();
|
||||
void subfunc1(), subfunc2();
|
||||
void subsub();
|
||||
#endif
|
||||
void sub0 Args((void)), sub1 Args((void)), sub2 Args((void)), sub3 Args((void));
|
||||
void func1 Args((void)), func2 Args((void));
|
||||
void subfunc1 Args((void)), subfunc2 Args((void));
|
||||
void subsub Args((void));
|
||||
|
||||
/***************************** menus initialization ***********************/
|
||||
|
||||
@@ -212,59 +197,35 @@ menu SubMenu3[] =
|
||||
|
||||
/***************************** main menu functions ************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void sub0 (void)
|
||||
#else
|
||||
void sub0 ()
|
||||
#endif
|
||||
void sub0 Args((void))
|
||||
{
|
||||
domenu (SubMenu0);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void sub1 (void)
|
||||
#else
|
||||
void sub1 ()
|
||||
#endif
|
||||
void sub1 Args((void))
|
||||
{
|
||||
domenu (SubMenu1);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void sub2 (void)
|
||||
#else
|
||||
void sub2 ()
|
||||
#endif
|
||||
void sub2 Args((void))
|
||||
{
|
||||
domenu (SubMenu2);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void sub3 (void)
|
||||
#else
|
||||
void sub3 ()
|
||||
#endif
|
||||
void sub3 Args((void))
|
||||
{
|
||||
domenu (SubMenu3);
|
||||
}
|
||||
|
||||
/***************************** submenu1 functions *************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void func1 (void)
|
||||
#else
|
||||
void func1 ()
|
||||
#endif
|
||||
void func1 Args((void))
|
||||
{
|
||||
beep ();
|
||||
bodymsg ("One beep! ");
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void func2 (void)
|
||||
#else
|
||||
void func2 ()
|
||||
#endif
|
||||
void func2 Args((void))
|
||||
{
|
||||
beep ();
|
||||
bodymsg ("Two beeps! ");
|
||||
@@ -273,20 +234,12 @@ void func2 ()
|
||||
|
||||
/***************************** submenu2 functions *************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void subfunc1 (void)
|
||||
#else
|
||||
void subfunc1 ()
|
||||
#endif
|
||||
void subfunc1 Args((void))
|
||||
{
|
||||
showfile (FNAME);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
void subfunc2 (void)
|
||||
#else
|
||||
void subfunc2 ()
|
||||
#endif
|
||||
void subfunc2 Args((void))
|
||||
{
|
||||
char fname[MAXSTRLEN];
|
||||
|
||||
@@ -296,22 +249,14 @@ void subfunc2 ()
|
||||
|
||||
/***************************** submenu3 functions *************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
void subsub (void)
|
||||
#else
|
||||
void subsub ()
|
||||
#endif
|
||||
void subsub Args((void))
|
||||
{
|
||||
domenu (SubMenu2);
|
||||
}
|
||||
|
||||
/***************************** start main menu ***************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
int main (void)
|
||||
#else
|
||||
int main ()
|
||||
#endif
|
||||
int main Args((void))
|
||||
{
|
||||
startmenu (MainMenu, "TUI - 'textual user interface' demonstration program");
|
||||
|
||||
|
||||
161
demos/xmas.c
161
demos/xmas.c
@@ -115,48 +115,41 @@
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_xmas = "$Id: xmas.c,v 1.6 2005/12/06 00:20:31 wmcbrine Exp $";
|
||||
char *rcsid_xmas = "$Id: xmas.c,v 1.7 2005/12/07 01:37:43 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#include <curses.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int boxit(void);
|
||||
int seas(void);
|
||||
int greet(void);
|
||||
int fromwho(void);
|
||||
int del_msg(void);
|
||||
int tree(void);
|
||||
int balls(void);
|
||||
int star(void);
|
||||
int strng1(void);
|
||||
int strng2(void);
|
||||
int strng3(void);
|
||||
int strng4(void);
|
||||
int strng5(void);
|
||||
int blinkit(void);
|
||||
int reindeer(void);
|
||||
void done(void);
|
||||
#else
|
||||
int boxit();
|
||||
int seas();
|
||||
int greet();
|
||||
int fromwho();
|
||||
int del_msg();
|
||||
int tree();
|
||||
int balls();
|
||||
int star();
|
||||
int strng1();
|
||||
int strng2();
|
||||
int strng3();
|
||||
int strng4();
|
||||
int strng5();
|
||||
int blinkit();
|
||||
int reindeer();
|
||||
void done();
|
||||
#if defined(HAVE_PROTO) && !defined(__STDC__)
|
||||
# define __STDC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef Args
|
||||
# if __STDC__
|
||||
# define Args(x) x
|
||||
# else
|
||||
# define Args(x) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int boxit Args((void));
|
||||
int seas Args((void));
|
||||
int greet Args((void));
|
||||
int fromwho Args((void));
|
||||
int del_msg Args((void));
|
||||
int tree Args((void));
|
||||
int balls Args((void));
|
||||
int star Args((void));
|
||||
int strng1 Args((void));
|
||||
int strng2 Args((void));
|
||||
int strng3 Args((void));
|
||||
int strng4 Args((void));
|
||||
int strng5 Args((void));
|
||||
int blinkit Args((void));
|
||||
int reindeer Args((void));
|
||||
void done Args((void));
|
||||
|
||||
#define FROMWHO "Mark Hessling - (M.Hessling@qut.edu.au)"
|
||||
|
||||
int y_pos, x_pos;
|
||||
@@ -173,7 +166,7 @@ WINDOW
|
||||
*w_holiday,
|
||||
*w_del_msg;
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
#if __STDC__
|
||||
int main(int argc, char **argv)
|
||||
#else
|
||||
int main(argc, argv)
|
||||
@@ -698,11 +691,7 @@ char **argv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int boxit(void)
|
||||
#else
|
||||
int boxit()
|
||||
#endif
|
||||
int boxit Args((void))
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
@@ -731,11 +720,7 @@ int boxit()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int seas(void)
|
||||
#else
|
||||
int seas()
|
||||
#endif
|
||||
int seas Args((void))
|
||||
{
|
||||
mvaddch(4, 1, 'S');
|
||||
mvaddch(6, 1, 'E');
|
||||
@@ -749,11 +734,7 @@ int seas()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int greet(void)
|
||||
#else
|
||||
int greet()
|
||||
#endif
|
||||
int greet Args((void))
|
||||
{
|
||||
mvaddch(3, 5, 'G');
|
||||
mvaddch(5, 5, 'R');
|
||||
@@ -768,21 +749,13 @@ int greet()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int fromwho(void)
|
||||
#else
|
||||
int fromwho()
|
||||
#endif
|
||||
int fromwho Args((void))
|
||||
{
|
||||
mvaddstr(21, 13, FROMWHO);
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int del_msg(void)
|
||||
#else
|
||||
int del_msg()
|
||||
#endif
|
||||
int del_msg Args((void))
|
||||
{
|
||||
#if 0
|
||||
mvaddstr(23, 60, "Hit any key to quit");
|
||||
@@ -793,11 +766,7 @@ int del_msg()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int tree(void)
|
||||
#else
|
||||
int tree()
|
||||
#endif
|
||||
int tree Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -855,11 +824,7 @@ int tree()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int balls(void)
|
||||
#else
|
||||
int balls()
|
||||
#endif
|
||||
int balls Args((void))
|
||||
{
|
||||
chtype ball1,ball2,ball3,ball4,ball5,ball6;
|
||||
overlay(treescrn, treescrn2);
|
||||
@@ -908,11 +873,7 @@ int balls()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int star(void)
|
||||
#else
|
||||
int star()
|
||||
#endif
|
||||
int star Args((void))
|
||||
{
|
||||
mvwaddch(treescrn2, 0, 12, (chtype)'*' | A_STANDOUT );
|
||||
|
||||
@@ -921,11 +882,7 @@ int star()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int strng1(void)
|
||||
#else
|
||||
int strng1()
|
||||
#endif
|
||||
int strng1 Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -943,11 +900,7 @@ int strng1()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int strng2(void)
|
||||
#else
|
||||
int strng2()
|
||||
#endif
|
||||
int strng2 Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -968,11 +921,7 @@ int strng2()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int strng3(void)
|
||||
#else
|
||||
int strng3()
|
||||
#endif
|
||||
int strng3 Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -995,11 +944,7 @@ int strng3()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int strng4(void)
|
||||
#else
|
||||
int strng4()
|
||||
#endif
|
||||
int strng4 Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -1027,11 +972,7 @@ int strng4()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int strng5(void)
|
||||
#else
|
||||
int strng5()
|
||||
#endif
|
||||
int strng5 Args((void))
|
||||
{
|
||||
#ifdef A_COLOR
|
||||
if (has_colors() )
|
||||
@@ -1057,11 +998,7 @@ int strng5()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int blinkit(void)
|
||||
#else
|
||||
int blinkit()
|
||||
#endif
|
||||
int blinkit Args((void))
|
||||
{
|
||||
static int cycle;
|
||||
|
||||
@@ -1125,11 +1062,7 @@ int blinkit()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
int reindeer(void)
|
||||
#else
|
||||
int reindeer()
|
||||
#endif
|
||||
int reindeer Args((void))
|
||||
{
|
||||
int looper;
|
||||
|
||||
@@ -1424,11 +1357,7 @@ int reindeer()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTO
|
||||
void done(void)
|
||||
#else
|
||||
void done()
|
||||
#endif
|
||||
void done Args((void))
|
||||
{
|
||||
/* signal(SIGINT,done);
|
||||
signal(SIGTERM,done);
|
||||
|
||||
Reference in New Issue
Block a user