Merged remainder of pdcwin.c into window.c.

This commit is contained in:
William McBrine
2006-08-21 18:38:19 +00:00
parent 1c388f5a2b
commit bfb56a7499
16 changed files with 99 additions and 179 deletions

View File

@@ -5,5 +5,4 @@
+outopts.obj +overlay.obj +pad.obj +printw.obj +refresh.obj +scanw.obj &
+scr_dump.obj +scroll.obj +slk.obj +termattr.obj +terminfo.obj &
+touch.obj +util.obj +window.obj +pdcdebug.obj +pdcclip.obj +pdcdisp.obj &
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj &
+pdcwin.obj ,lib.map
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj ,lib.map

View File

@@ -44,5 +44,4 @@
-+pdcscrn.obj &
-+pdcsetsc.obj &
-+pdcutil.obj &
-+pdcwin.obj &
,lib.map;

View File

@@ -211,9 +211,6 @@ pdcsetsc.obj: $(osdir)\pdcsetsc.c $(PDCURSES_HEADERS) $(PDCURSES_DOS_H)
pdcutil.obj: $(osdir)\pdcutil.c $(PDCURSES_HEADERS) $(PDCURSES_DOS_H)
$(CC) $(CCFLAGS) $(osdir)\pdcutil.c
pdcwin.obj: $(srcdir)\pdcwin.c $(PDCURSES_HEADERS)
$(CC) $(CCFLAGS) $(srcdir)\pdcwin.c
#------------------------------------------------------------------------
panel.obj: $(pandir)\panel.c $(PDCURSES_HEADERS) $(PANEL_HEADER)

View File

@@ -5,4 +5,4 @@
+outopts.obj +overlay.obj +pad.obj +printw.obj +refresh.obj +scanw.obj
+scr_dump.obj +scroll.obj +slk.obj +termattr.obj +terminfo.obj
+touch.obj +util.obj +window.obj +pdcclip.obj +pdcdebug.obj +pdcdisp.obj
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj +pdcwin.obj
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj

View File

@@ -17,7 +17,7 @@ getch.$(O) getstr.$(O) getyx.$(O) inch.$(O) inchstr.$(O) initscr.$(O) \
inopts.$(O) insch.$(O) insstr.$(O) instr.$(O) kernel.$(O) mouse.$(O) \
move.$(O) outopts.$(O) overlay.$(O) pad.$(O) printw.$(O) refresh.$(O) \
scanw.$(O) scr_dump.$(O) scroll.$(O) slk.$(O) termattr.$(O) \
terminfo.$(O) touch.$(O) util.$(O) window.$(O) pdcdebug.$(O) pdcwin.$(O)
terminfo.$(O) touch.$(O) util.$(O) window.$(O) pdcdebug.$(O)
PDCOBJS = pdcclip.$(O) pdcdisp.$(O) pdcgetsc.$(O) pdckbd.$(O) pdcscrn.$(O) \
pdcsetsc.$(O) pdcutil.$(O)

View File

@@ -68,8 +68,7 @@ $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
+outopts.obj +overlay.obj +pad.obj +printw.obj +refresh.obj +scanw.obj \
+scr_dump.obj +scroll.obj +slk.obj +termattr.obj +terminfo.obj \
+touch.obj +util.obj +window.obj +pdcdebug.obj +pdcclip.obj +pdcdisp.obj \
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj \
+pdcwin.obj ,lib.map
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj ,lib.map
$(LIBPANEL) : $(PANOBJS)
-del $@

View File

@@ -97,7 +97,7 @@ getstr.dlo getyx.dlo inch.dlo inchstr.dlo initscr.dlo inopts.dlo \
insch.dlo insstr.dlo instr.dlo kernel.dlo mouse.dlo move.dlo outopts.dlo \
overlay.dlo pad.dlo printw.dlo refresh.dlo scanw.dlo scr_dump.dlo \
scroll.dlo slk.dlo termattr.dlo terminfo.dlo touch.dlo util.dlo \
window.dlo pdcdebug.dlo pdcwin.dlo
window.dlo pdcdebug.dlo
PDCDLOS = pdcclip.dlo pdcdisp.dlo pdcgetsc.dlo pdckbd.dlo pdcscrn.dlo \
pdcsetsc.dlo pdcutil.dlo

View File

@@ -44,5 +44,4 @@
-+pdcscrn.obj &
-+pdcsetsc.obj &
-+pdcutil.obj &
-+pdcwin.obj &
,lib.map;

View File

@@ -205,9 +205,6 @@ pdcsetsc.obj: $(osdir)\pdcsetsc.c $(PDCURSES_HEADERS)
pdcutil.obj: $(osdir)\pdcutil.c $(PDCURSES_HEADERS)
$(CC) $(CCFLAGS) $(osdir)\pdcutil.c
pdcwin.obj: $(srcdir)\pdcwin.c $(PDCURSES_HEADERS)
$(CC) $(CCFLAGS) $(srcdir)\pdcwin.c
#------------------------------------------------------------------------
panel.obj: $(pandir)\panel.c $(PDCURSES_HEADERS) $(PANEL_HEADER)

View File

@@ -1,141 +0,0 @@
/************************************************************************
* This file is part of PDCurses. PDCurses is public domain software; *
* you may use it for any purpose. This software is provided AS IS with *
* NO WARRANTY whatsoever. *
* *
* If you use PDCurses in an application, an acknowledgement would be *
* appreciated, but is not mandatory. If you make corrections or *
* enhancements to PDCurses, please forward them to the current *
* maintainer for the benefit of other users. *
* *
* No distribution of modified PDCurses code may be made under the name *
* "PDCurses", except by the current maintainer. (Although PDCurses is *
* public domain, the name is a trademark.) *
* *
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
#define CURSES_LIBRARY 1
#include <curses.h>
#include <stdlib.h>
RCSID("$Id: pdcwin.c,v 1.53 2006/08/21 18:19:46 wmcbrine Exp $");
/*man-start**************************************************************
PDC_makenew() - Create a WINDOW* (sans line allocation)
PDCurses Description:
This is a private PDCurses routine.
Allocates all data for a new WINDOW* except the actual lines
themselves.
PDCurses Return Value:
This function returns a valid WINDOW* on success and NULL on
error.
PDCurses Errors:
If PDC_makenew() is unable to allocate memory for the window
structure, it will free all allocated memory and return
a NULL pointer.
Portability:
PDCurses WINDOW *PDC_makenew(int num_lines, int num_columns,
int begy, int begx);
**man-end****************************************************************/
WINDOW *PDC_makenew(int num_lines, int num_columns, int begy, int begx)
{
int i;
WINDOW *win;
PDC_LOG(("PDC_makenew() - called: lines %d cols %d begy %d begx %d\n",
num_lines, num_columns, begy, begx));
/* allocate the window structure itself */
if ((win = calloc(1, sizeof(WINDOW))) == (WINDOW *)NULL)
return win;
/* allocate the line pointer array */
if ((win->_y = calloc(num_lines, sizeof(chtype *))) == NULL)
{
free(win);
return (WINDOW *)NULL;
}
/* allocate the minchng and maxchng arrays */
if ((win->_firstch = calloc(num_lines, sizeof(int))) == NULL)
{
free(win->_y);
free(win);
return (WINDOW *)NULL;
}
if ((win->_lastch = calloc(num_lines, sizeof(int))) == NULL)
{
free(win->_firstch);
free(win->_y);
free(win);
return (WINDOW *)NULL;
}
/* initialize window variables */
win->_maxy = num_lines; /* real max screen size */
win->_maxx = num_columns; /* real max screen size */
win->_pmaxy = num_lines; /* real max window size */
win->_pmaxx = num_columns; /* real max window size */
win->_begy = begy;
win->_begx = begx;
win->_lastsy2 = LINES - 1;
win->_lastsx2 = COLS - 1;
win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */
win->_clear = (bool) ((num_lines == LINES) && (num_columns == COLS));
win->_bmarg = num_lines - 1;
win->_parx = win->_pary = -1;
/* init to say window all changed */
for (i = 0; i < num_lines; i++)
{
win->_firstch[i] = 0;
win->_lastch[i] = num_columns - 1;
}
return win;
}
/*man-start**************************************************************
PDC_sync() - Cause window synchronisation to occur
PDCurses Description:
This is a private PDCurses routine, NOT to be called by an
application.
Handles wrefresh() and wsyncup() calls when a window is changed.
PDCurses Return Value:
This function returns void.
PDCurses Errors:
Portability:
PDCurses WINDOW *PDC_sync(WINDOW *win);
**man-end****************************************************************/
void PDC_sync(WINDOW *win)
{
PDC_LOG(("PDC_sync() - called:\n"));
if (win->_immed)
wrefresh(win);
if (win->_sync)
wsyncup(win);
}

View File

@@ -22,7 +22,7 @@
/* undefine any macros for functions defined in this module */
#undef derwin
RCSID("$Id: window.c,v 1.37 2006/08/20 22:39:03 wmcbrine Exp $");
RCSID("$Id: window.c,v 1.38 2006/08/21 18:38:19 wmcbrine Exp $");
/*man-start**************************************************************
@@ -44,6 +44,9 @@ RCSID("$Id: window.c,v 1.37 2006/08/20 22:39:03 wmcbrine Exp $");
void wsyncdown(WINDOW *win);
WINDOW *resize_window(WINDOW *w, int lins, int cols);
WINDOW *PDC_makenew(int num_lines, int num_columns,
int begy, int begx);
void PDC_sync(WINDOW *win);
X/Open Description:
newwin() creates a new window with the given number of lines,
@@ -98,6 +101,14 @@ RCSID("$Id: window.c,v 1.37 2006/08/20 22:39:03 wmcbrine Exp $");
PDCurses Description:
resize_window() allows the usrer to resize an existing window.
PDC_makenew() allocates all data for a new WINDOW* except the
actual lines themselves. If it's unable to allocate memory for
the window structure, it will free all allocated memory and
return a NULL pointer.
PDC_sync() handles wrefresh() and wsyncup() calls when a window
is changed.
X/Open Return Value:
All functions return OK on success and ERR on error.
@@ -125,9 +136,85 @@ RCSID("$Id: window.c,v 1.37 2006/08/20 22:39:03 wmcbrine Exp $");
wcursyncup - - 4.0
wsyncdown - - 4.0
resize_window - - -
PDC_makenew - - -
PDC_sync - - -
**man-end****************************************************************/
WINDOW *PDC_makenew(int num_lines, int num_columns, int begy, int begx)
{
int i;
WINDOW *win;
PDC_LOG(("PDC_makenew() - called: lines %d cols %d begy %d begx %d\n",
num_lines, num_columns, begy, begx));
/* allocate the window structure itself */
if ((win = calloc(1, sizeof(WINDOW))) == (WINDOW *)NULL)
return win;
/* allocate the line pointer array */
if ((win->_y = calloc(num_lines, sizeof(chtype *))) == NULL)
{
free(win);
return (WINDOW *)NULL;
}
/* allocate the minchng and maxchng arrays */
if ((win->_firstch = calloc(num_lines, sizeof(int))) == NULL)
{
free(win->_y);
free(win);
return (WINDOW *)NULL;
}
if ((win->_lastch = calloc(num_lines, sizeof(int))) == NULL)
{
free(win->_firstch);
free(win->_y);
free(win);
return (WINDOW *)NULL;
}
/* initialize window variables */
win->_maxy = num_lines; /* real max screen size */
win->_maxx = num_columns; /* real max screen size */
win->_pmaxy = num_lines; /* real max window size */
win->_pmaxx = num_columns; /* real max window size */
win->_begy = begy;
win->_begx = begx;
win->_lastsy2 = LINES - 1;
win->_lastsx2 = COLS - 1;
win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */
win->_clear = (bool) ((num_lines == LINES) && (num_columns == COLS));
win->_bmarg = num_lines - 1;
win->_parx = win->_pary = -1;
/* init to say window all changed */
for (i = 0; i < num_lines; i++)
{
win->_firstch[i] = 0;
win->_lastch[i] = num_columns - 1;
}
return win;
}
void PDC_sync(WINDOW *win)
{
PDC_LOG(("PDC_sync() - called:\n"));
if (win->_immed)
wrefresh(win);
if (win->_sync)
wsyncup(win);
}
WINDOW *newwin(int nlines, int ncols, int begy, int begx)
{
WINDOW *win;

View File

@@ -10,7 +10,7 @@ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj &
insch.obj insstr.obj instr.obj kernel.obj mouse.obj move.obj outopts.obj &
overlay.obj pad.obj printw.obj refresh.obj scanw.obj scr_dump.obj &
scroll.obj slk.obj termattr.obj terminfo.obj touch.obj util.obj &
window.obj pdcdebug.obj pdcwin.obj
window.obj pdcdebug.obj
PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj &
pdcsetsc.obj pdcutil.obj

View File

@@ -68,8 +68,7 @@ $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
+outopts.obj +overlay.obj +pad.obj +printw.obj +refresh.obj +scanw.obj \
+scr_dump.obj +scroll.obj +slk.obj +termattr.obj +terminfo.obj \
+touch.obj +util.obj +window.obj +pdcdebug.obj +pdcclip.obj +pdcdisp.obj \
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj \
+pdcwin.obj ,lib.map
+pdcgetsc.obj +pdckbd.obj +pdcscrn.obj +pdcsetsc.obj +pdcutil.obj ,lib.map
$(LIBPANEL) : $(PANOBJS)
-del $@

View File

@@ -78,7 +78,7 @@ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \
insch.obj insstr.obj instr.obj kernel.obj mouse.obj move.obj outopts.obj \
overlay.obj pad.obj printw.obj refresh.obj scanw.obj scr_dump.obj \
scroll.obj slk.obj termattr.obj terminfo.obj touch.obj util.obj \
window.obj pdcdebug.obj pdcwin.obj
window.obj pdcdebug.obj
PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \
pdcsetsc.obj pdcutil.obj
@@ -221,9 +221,6 @@ window.obj: $(srcdir)\window.c
pdcdebug.obj: $(srcdir)\pdcdebug.c
$(CC) $(CCFLAGS) $(srcdir)\pdcdebug.c
pdcwin.obj: $(srcdir)\pdcwin.c
$(CC) $(CCFLAGS) $(srcdir)\pdcwin.c
pdcclip.obj: $(osdir)\pdcclip.c
$(CC) $(CCFLAGS) $(osdir)\pdcclip.c

View File

@@ -81,7 +81,7 @@ move.o outopts.o overlay.o pad.o printw.o refresh.o scanw.o scr_dump.o \
scroll.o slk.o termattr.o terminfo.o touch.o util.o window.o
PDCOBJS = pdcclip.o pdcdebug.o pdcdisp.o pdcgetsc.o pdckbd.o \
pdcscrn.o pdcsetsc.o pdcutil.o pdcwin.o
pdcscrn.o pdcsetsc.o pdcutil.o
X11OBJS = pdcx11.o x11.o sb.o ScrollBox.o
@@ -240,9 +240,6 @@ pdcsetsc.o: $(osdir)/pdcsetsc.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
pdcutil.o: $(osdir)/pdcutil.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
$(CC) $(CCFLAGS) -o $@ $(osdir)/pdcutil.c
pdcwin.o: $(srcdir)/pdcwin.c $(PDCURSES_HEADERS)
$(CC) $(CCFLAGS) -o $@ $(srcdir)/pdcwin.c
pdcx11.o: $(osdir)/pdcx11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
$(CC) $(CCFLAGS) -o $@ $(osdir)/pdcx11.c

View File

@@ -93,7 +93,7 @@ move.o outopts.o overlay.o pad.o printw.o refresh.o scanw.o scr_dump.o \
scroll.o slk.o termattr.o terminfo.o touch.o util.o window.o
PDCOBJS = pdcclip.o pdcdebug.o pdcdisp.o pdcgetsc.o pdckbd.o \
pdcscrn.o pdcsetsc.o pdcutil.o pdcwin.o
pdcscrn.o pdcsetsc.o pdcutil.o
X11OBJS = pdcx11.o x11.o sb.o ScrollBox.o
@@ -108,7 +108,7 @@ scroll.sho slk.sho termattr.sho terminfo.sho touch.sho util.sho \
window.sho
PDCSHOBJS = pdcclip.sho pdcdebug.sho pdcdisp.sho pdcgetsc.sho pdckbd.sho \
pdcscrn.sho pdcsetsc.sho pdcutil.sho pdcwin.sho
pdcscrn.sho pdcsetsc.sho pdcutil.sho
X11SHOBJS = pdcx11.sho x11.sho sb.sho ScrollBox.sho
@@ -266,9 +266,6 @@ pdcsetsc.o: $(osdir)/pdcsetsc.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
pdcutil.o: $(osdir)/pdcutil.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
$(CC) $(CCFLAGS) -o $@ $(osdir)/pdcutil.c
pdcwin.o: $(srcdir)/pdcwin.c $(PDCURSES_HEADERS)
$(CC) $(CCFLAGS) -o $@ $(srcdir)/pdcwin.c
pdcx11.o: $(osdir)/pdcx11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
$(CC) $(CCFLAGS) -o $@ $(osdir)/pdcx11.c
@@ -565,12 +562,6 @@ pdcutil.sho: $(osdir)/pdcutil.c $(PDCURSES_HEADERS)
$(O2SHO)
$(SAVE2O)
pdcwin.sho: $(srcdir)/pdcwin.c $(PDCURSES_HEADERS)
$(O2SAVE)
$(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(srcdir)/pdcwin.c
$(O2SHO)
$(SAVE2O)
pdcx11.sho: $(osdir)/pdcx11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H)
$(O2SAVE)
$(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(osdir)/pdcx11.c