diff options
| author | cgd <cgd@NetBSD.org> | 1993-11-09 03:36:33 +0000 |
|---|---|---|
| committer | cgd <cgd@NetBSD.org> | 1993-11-09 03:36:33 +0000 |
| commit | b4beac8f5fe8499fcd44ff0de7ab2f4ae0861845 (patch) | |
| tree | 6c7b450a1b08a91b479730612c11d0975976de18 /lib/libcurses | |
| parent | c70688046bed3b7a3b85cc1320b1c0026edac386 (diff) | |
update to new version from berkeley. doesn't compile yet, nor
does it have rcsid's. this is for diffs. new doc layout thang.
Diffstat (limited to 'lib/libcurses')
27 files changed, 5889 insertions, 0 deletions
diff --git a/lib/libcurses/PSD.doc/Makefile b/lib/libcurses/PSD.doc/Makefile new file mode 100644 index 00000000000..f93ee64ae97 --- /dev/null +++ b/lib/libcurses/PSD.doc/Makefile @@ -0,0 +1,35 @@ +# @(#)Makefile 8.1 (Berkeley) 8/14/93 + +DIR= psd/19.curses +SRCS= Master +MACROS= -me + +CLEANFILES+=win_st.gr twinkle1.gr twinkle2.gr life.gr intro.2.tbl appen.A.tbl \ + ex1.gr ex2.gr + +.SUFFIXES: +.SUFFIXES: .c .gr + +# +# this section formats C input source into nice troffable (or nroffable) +# versions. It uses the capabilites of "vgrind", which sets keywords in +# bold font, and comments in italics. +# + +# Don't re-run vgrind unless you want to patch the output files. +VFONT= /usr/libexec/vfontedpr +.c.gr: + ${VFONT} $*.c | grep -v "^'wh" > $*.gr + +paper.ps: ${SRCS} + ${ROFF} ${SRCS} > ${.TARGET} + +Master: twinkle1.gr ex1.gr ex2.gr fns.doc intro.5 intro.2.tbl intro.0 intro.1 \ + intro.3 intro.4 intro.6 macros c_macros + +intro.2.tbl: intro.2 + ${TBL} intro.2 > intro.2.tbl + +.include <bsd.doc.mk> + + diff --git a/lib/libcurses/PSD.doc/Master b/lib/libcurses/PSD.doc/Master new file mode 100644 index 00000000000..d9e717106c3 --- /dev/null +++ b/lib/libcurses/PSD.doc/Master @@ -0,0 +1,54 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)Master 8.1 (Berkeley) 6/8/93 +.\" +.ds Ln Screen Package +.so macros +.so c_macros +.so intro.0 +.pn 3 +.bp +.so intro.1 +.so intro.2.tbl +.so intro.3 +.so intro.4 +.so intro.5 +.so intro.6 +.bp +.so appen.A +.pn 2 +.oh '\*(Ln''PS1:19-%' +.eh 'PS1:19-%''\*(Ln' +.bp +.bi Contents +.sp +.xp diff --git a/lib/libcurses/PSD.doc/appen.A b/lib/libcurses/PSD.doc/appen.A new file mode 100644 index 00000000000..a40c95d7891 --- /dev/null +++ b/lib/libcurses/PSD.doc/appen.A @@ -0,0 +1,77 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.A 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix A''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix A' +.el .he ''\fIAppendix A\fR'' +.bp +.(x +.ti 0 +.b "Appendix A" +.)x +.sh 1 "Examples" 1 +.pp +Here we present a few examples +of how to use the package. +They attempt to be representative, +though not comprehensive. Further examples can be found in the games section +of the source tree and in various utilities that use the screen such as +.i systat(1) . +.pp +The following examples are intended to demonstrate +the basic structure of a program +using the package. An additional, more comprehensive, program can be found in +the source code in the +\fIexamples\fP subdirectory. +.sh 2 "Simple Character Output" +.pp +This program demonstrates how to set up a window and output characters to it. +Also, it demonstrates how one might control the output to the window. If +you run this program, you will get a demonstration of the character output +chracteristics discussed in the above Character Output section. +.(l I +.so ex1.gr +.)l +.sh 2 "Twinkle" +.pp +This is a moderately simple program which prints +patterns on the screen. +It switches between patterns of asterisks, +putting them on one by one in random order, +and then taking them off in the same fashion. +It is more efficient to write this +using only the motion optimization, +as is demonstrated below. +.(l I +.so twinkle1.gr +.)l diff --git a/lib/libcurses/PSD.doc/appen.B b/lib/libcurses/PSD.doc/appen.B new file mode 100644 index 00000000000..0f89fa551bb --- /dev/null +++ b/lib/libcurses/PSD.doc/appen.B @@ -0,0 +1,201 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.B 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix B''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix B' +.el .he ''\fIAppendix B\fR'' +.bp +.(x +.ti 0 +.b "Appendix B" +.)x +.nr $1 0 +.sh 1 "The WINDOW structure" +.pp +The WINDOW structure is defined as follows: +.(l I +.so win_st.gr +.)l +.pp +.Vn \*_cury \\* +.(f +\** +All variables not normally accessed directly by the user +are named with an initial +.Bq \*_ +to avoid conflicts with the user's variables. +.)f +and +.Vn \*_curx +are the current \*y for the window. +New characters added to the screen +are added at this point. +.Vn \*_maxy +and +.Vn \*_maxx +are the maximum values allowed for +.Vn \*_cury\*,\*_curx ). ( +.Vn \*_begy +and +.Vn \*_begx +are the starting \*y on the terminal for the window, +.i i.e. , +the window's home. +.Vn \*_cury , +.Vn \*_curx , +.Vn \*_maxy , +and +.Vn \*_maxx +are measured relative to +.Vn \*_begy\*,\*_begx ), ( +not the terminal's home. +.pp +.Vn \*_clear +tells if a clear-screen sequence is to be generated +on the next +.Fn refresh +call. +This is only meaningful for screens. +The initial clear-screen for the first +.Fn refresh +call is generated by initially setting clear to be TRUE for +.Vn curscr , +which always generates a clear-screen if set, +irrelevant of the dimensions of the window involved. +.Vn \*_leave +is TRUE if the current \*y and the cursor +are to be left after the last character changed on the terminal, +or not moved if there is no change. +.Vn \*_scroll +is TRUE +if scrolling is allowed. +.pp +.Vn \*_y +is a pointer to an array of lines which describe the terminal. +Thus: +.(l +\*_y[i] +.)l +.lp +is a pointer to the +.Vn i th +line, and +.(l +\*_y[i][j] +.)l +.lp +is the +.Vn j th +character on the +.Vn i th +line. +.Vn \*_flags +can have one or more values +or'd into it. +.pp +For windows that are not subwindows, +.Vn \*_orig +is +NULL . +For subwindows, +it points to the main window +to which the window is subsidiary. +.Vn \*_nextp +is a pointer in a circularly linked list +of all the windows which are subwindows of the same main window, +plus the main window itself. +.pp +.Vn \*_firstch +and +.Vn \*_lastch +are +.Fn malloc ed +arrays which contain the index of the +first and last changed characters +on the line. +.Vn \*_ch\*_off +is the x offset for the window +in the +.Vn \*_firstch +and +.Vn \*_lastch +arrays for this window. +For main windows, +this is always 0; +for subwindows +it is the difference between the starting point of the main window +and that of the subindow, +so that change markers can be set relative to the main window. +This makes these markers global in scope. +.pp +All subwindows share the appropriate portions of +.Vn _y , +.Vn _firstch , +.Vn _lastch , +and +.Vn _insdel +with their main window. +.pp +.b \*_ENDLINE +says that the end of the line for this window +is also the end of a screen. +.b \*_FULLWIN +says that this window is a screen. +.b \*_SCROLLWIN +indicates that the last character of this screen +is at the lower right-hand corner of the terminal; +.i i.e. , +if a character was put there, +the terminal would scroll. +.b \*_FULLLINE +says that the width of a line is the same as the width of the terminal. +If +.b \*_FLUSH +is set, +it says that +.Fn fflush "" "" stdout +should be called at the end of each +.Fn refresh +.b \*_STANDOUT +says that all characters added to the screen +are in standout mode. +.b \*_INSDEL +is reserved for future use, +and is set by +.Fn idlok . +.Vn \*_firstch +is set to +.b \*_NOCHANGE +for lines on which there has been no change +since the last +.Fn refresh . diff --git a/lib/libcurses/PSD.doc/appen.C b/lib/libcurses/PSD.doc/appen.C new file mode 100644 index 00000000000..65bef2bcb98 --- /dev/null +++ b/lib/libcurses/PSD.doc/appen.C @@ -0,0 +1,127 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.C 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix A''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix A' +.el .he ''\fIAppendix A\fR'' +.bp +.(x +.ti 0 +.b "Appendix A" +.)x +.sh 1 "Examples" 1 +.pp +Here we present a few examples +of how to use the package. +They attempt to be representative, +though not comprehensive. Further examples can be found in the games section +of the source tree and in various utilities that use the screen such as +.i systat(1) . +.sh 2 "Screen Updating" +.pp +The following examples are intended to demonstrate +the basic structure of a program +using the screen updating sections of the package. +Several of the programs require calculational sections +which are irrelevant of to the example, +and are therefore usually not included. +It is hoped that the data structure definitions +give enough of an idea to allow understanding +of what the relevant portions do. +.sh 3 "Simple Character Output" +.pp +This program demonstrates how to set up a window and output characters to it. +Also, it demonstrates how one might control the output to the window. If +you run this program, you will get a demonstration of the character output +chracteristics discussed in the above Character Output section. +.(l I +.so t2.gr +.)l +.sh 3 "A Small Screen Manipulator" +.pp +The next example follows the lines of the previous one but extends then to +demonstrate the various othe uses of the package. Make sure you understand +how this program works as it encompasses most of anything you will +need to do with the package. +.(l I +.so t3.gr +.)l +.sh 3 "Twinkle" +.pp +This is a moderately simple program which prints +patterns on the screen. +It switches between patterns of asterisks, +putting them on one by one in random order, +and then taking them off in the same fashion. +It is more efficient to write this +using only the motion optimization, +as is demonstrated below. +.(l I +.so twinkle1.gr +.)l +.sh 3 "Life" +.pp +This program fragment models the famous computer pattern game of life +(Scientific American, May, 1974). +The calculational routines create a linked list of structures +defining where each piece is. +Nothing here claims to be optimal, +merely demonstrative. +This code, however, +is a very good place to use the screen updating routines, +as it allows them to worry about what the last position looked like, +so you don't have to. +It also demonstrates some of the input routines. +.(l I +.so life.gr +.)l +.sh 2 "Motion optimization" +.pp +The following example shows how motion optimization +is written on its own. +Programs which flit from one place to another without +regard for what is already there +usually do not need the overhead of both space and time +associated with screen updating. +They should instead use motion optimization. +.sh 3 "Twinkle" +.pp +The +.b twinkle +program +is a good candidate for simple motion optimization. +Here is how it could be written +(only the routines that have been changed are shown): +.(l +.so twinkle2.gr +.)l diff --git a/lib/libcurses/PSD.doc/appenA b/lib/libcurses/PSD.doc/appenA new file mode 100644 index 00000000000..a40c95d7891 --- /dev/null +++ b/lib/libcurses/PSD.doc/appenA @@ -0,0 +1,77 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.A 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix A''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix A' +.el .he ''\fIAppendix A\fR'' +.bp +.(x +.ti 0 +.b "Appendix A" +.)x +.sh 1 "Examples" 1 +.pp +Here we present a few examples +of how to use the package. +They attempt to be representative, +though not comprehensive. Further examples can be found in the games section +of the source tree and in various utilities that use the screen such as +.i systat(1) . +.pp +The following examples are intended to demonstrate +the basic structure of a program +using the package. An additional, more comprehensive, program can be found in +the source code in the +\fIexamples\fP subdirectory. +.sh 2 "Simple Character Output" +.pp +This program demonstrates how to set up a window and output characters to it. +Also, it demonstrates how one might control the output to the window. If +you run this program, you will get a demonstration of the character output +chracteristics discussed in the above Character Output section. +.(l I +.so ex1.gr +.)l +.sh 2 "Twinkle" +.pp +This is a moderately simple program which prints +patterns on the screen. +It switches between patterns of asterisks, +putting them on one by one in random order, +and then taking them off in the same fashion. +It is more efficient to write this +using only the motion optimization, +as is demonstrated below. +.(l I +.so twinkle1.gr +.)l diff --git a/lib/libcurses/PSD.doc/c_macros b/lib/libcurses/PSD.doc/c_macros new file mode 100644 index 00000000000..ba6ebbc1922 --- /dev/null +++ b/lib/libcurses/PSD.doc/c_macros @@ -0,0 +1,70 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)c_macros 8.1 (Berkeley) 6/4/93 +.\" +'ie t 'ds _ \d\(mi\u +'el 'ds _ _ +'tr *\(** +'ps 9p +'vs 10p +'ds - \(mi +'ds /* \\h'\\w' 'u-\\w'/'u'/* +'bd B 3 +'bd S B 3 +'nr cm 0 +'nf +'de () +'pn 1 +.. +'de +C +'nr cm 1 +'ft 2 +'ds +K +'ds -K +.. +'de -C +'nr cm 0 +'ft 1 +.ie t 'ds +K \f3 +.el 'ds +K \fI +'ds -K \fP +.. +'+C +'-C +'am +C +'ne 3 +.. +'de -F +'rm =f +.. +'ft 1 +'lg 0 diff --git a/lib/libcurses/PSD.doc/doc.I b/lib/libcurses/PSD.doc/doc.I new file mode 100644 index 00000000000..2345aba9b1c --- /dev/null +++ b/lib/libcurses/PSD.doc/doc.I @@ -0,0 +1,349 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.I 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd addch ch \*m +char ch; +.Fd waddch win\*,ch +WINDOW *win; +char ch; +.De +Add the character +.Vn ch +on the window +at the current \*y. +If the character is a newline +(\'\en\') +the line will be cleared to the end, +and the current \*y will be changed to the +beginning off the next line +if newline mapping is on, +or to the next line at the same x co-ordinate +if it is off. +A return +(\'\er\') +will move to the beginning of the line on the window. +Tabs +(\'\et\') +will be expanded into spaces +in the normal tabstop positions of +every eight characters. +\*(Es +.Ds +.Fd addstr str \*m +char *str; +.Fd waddstr win\*,str +WINDOW *win; +char *str; +.De +Add the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fd box win\*,vert\*,hor +WINDOW *win; +char vert\*,hor; +.De +.Pp +Draws a box around the window using +.Vn vert +as the character for drawing the vertical sides, and +.Vn hor +for drawing the horizontal lines. +If scrolling is not allowed, +and the window encompasses the lower right-hand corner of the terminal, +the corners are left blank to avoid a scroll. +.Ds +.Fd clear "" \*m +.Fd wclear win +WINDOW *win; +.De +Resets the entire window to blanks. +If +.Vn win +is a screen, +this sets the clear flag, +which will cause a clear-screen sequence to be sent +on the next +.Fn refresh +call. +This also moves the current \*y +to (0\*,0). +.Ds +.Fd clearok scr\*,boolf \*m +WINDOW *scr; +bool boolf; +.De +Sets the clear flag for the screen +.Vn scr . +If +.Vn boolf +is TRUE, +this will force a clear-screen to be printed on the next +.Fn refresh , +or stop it from doing so if +.Vn boolf +is FALSE. +This only works on screens, +and, +unlike +.Fn clear , +does not alter the contents of the screen. +If +.Vn scr +is +.Vn curscr , +the next +.Fn refresh +call will cause a clear-screen, +even if the window passed to +.Fn refresh +is not a screen. +.Ds +.Fd clrtobot "" \*m +.Fd wclrtobot win +WINDOW *win; +.De +Wipes the window clear from the current \*y to the bottom. +This does not force a clear-screen sequence on the next refresh +under any circumstances. +\*(Nm +.Ds +.Fd clrtoeol "" \*m +.Fd wclrtoeol win +WINDOW *win; +.De +Wipes the window clear from the current \*y to the end of the line. +\*(Nm +.Ds +.Fd delch +.Fd wdelch win +WINDOW *win; +.De +Delete the character at the current \*y. +Each character after it on the line shifts to the left, +and the last character becomes blank. +.Ds +.Fd deleteln +.Fd wdeleteln win +WINDOW *win; +.De +Delete the current line. +Every line below the current one will move up, +and the bottom line will become blank. +The current \*y will remain unchanged. +.Ds +.Fd erase "" \*m +.Fd werase win +WINDOW *win; +.De +Erases the window to blanks without setting the clear flag. +This is analagous to +.Fn clear , +except that it never causes a clear-screen sequence to be generated +on a +.Fn refresh . +\*(Nm +.Ds +.Fd flushok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Normally, +.Fn refresh +.Fn fflush 's +.Vn stdout +when it is finished. +.Fn flushok +allows you to control this. +if +.Vn boolf +is TRUE +(\c +.i i.e. , +non-zero) +it will do the +.Fn fflush ; +if it is FALSE. +it will not. +.Ds +.Fd idlok win\*,boolf +WINDOW *win; +bool boolf; +.De +Reserved for future use. +This will eventually signal to +.Fn refresh +that it is all right to use the insert and delete line sequences +when updating the window. +.Ds +.Fd insch c +char c; +.Fd winsch win\*,c +WINDOW *win; +char c; +.De +Insert +.Vn c +at the current \*y +Each character after it shifts to the right, +and the last character disappears. +\*(Es +.Ds +.Fd insertln +.Fd winsertln win +WINDOW *win; +.De +Insert a line above the current one. +Every line below the current line +will be shifted down, +and the bottom line will disappear. +The current line will become blank, +and the current \*y will remain unchanged. +.Ds +.Fd move y\*,x \*m +int y\*,x; +.Fd wmove win\*,y\*,x +WINDOW *win; +int y\*,x; +.De +Change the current \*y of the window to +.Vn y\*,x ). ( +\*(Es +.Ds +.Fd overlay win1\*,win2 +WINDOW *win1\*,*win2; +.De +Overlay +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done non-destructively, +i.e., blanks on +.Vn win1 +leave the contents of the space on +.Vn win2 +untouched. +.Ds +.Fd overwrite win1\*,win2 +WINDOW *win1\*,*win2; +.De +Overwrite +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done destructively, +.i i.e. , +blanks on +.Vn win1 +become blank on +.Vn win2 . +.Ds +.Fd printw fmt\*,arg1\*,arg2\*,... +char *fmt; +.Fd wprintw win\*,fmt\*,arg1\*,arg2\*,... +WINDOW *win; +char *fmt; +.De +Performs a +.Fn printf +on the window starting at the current \*y. +It uses +.Fn addstr +to add the string on the window. +It is often advisable to use the field width options of +.Fn printf +to avoid leaving things on the window from earlier calls. +\*(Es +.Ds +.Fd refresh "" \*m +.Fd wrefresh win +WINDOW *win; +.De +Synchronize the terminal screen with the desired window. +If the window is not a screen, +only that part covered by it is updated. +\*(Es +In this case, it will update whatever it can +without causing the scroll. +.sp +As a special case, +if +.Fn wrefresh +is called with the window +.Vn curscr +the screen is cleared +and repainted as it is currently. +This is very useful for allowing the redrawing of the screen +when the user has garbage dumped on his terminal. +.Ds +.Fd standout "" \*m +.Fd wstandout win +WINDOW *win; +.Fd standend "" \*m +.Fd wstandend win +WINDOW *win; +.De +Start and stop putting characters onto +.i win +in standout mode. +.Fn standout +causes any characters added to the window +to be put in standout mode on the terminal +(if it has that capability). +.Fn standend +stops this. +The sequences +.Vn SO +and +.Vn SE +(or +.Vn US +and +.Vn UE +if they are not defined) +are used (see Appendix A). diff --git a/lib/libcurses/PSD.doc/doc.II b/lib/libcurses/PSD.doc/doc.II new file mode 100644 index 00000000000..1f6880247bc --- /dev/null +++ b/lib/libcurses/PSD.doc/doc.II @@ -0,0 +1,142 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.II 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd cbreak "" \*m +.Fd nocbreak "" \*m +.Fd crmode "" \*m +.Fd nocrmode "" \*m +.De +Set or unset the terminal to/from cbreak mode. +The misnamed macros +.Fn crmode +and +.Fn nocrmode +are retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fd echo "" \*m +.Fd noecho "" \*m +.De +Sets the terminal to echo or not echo characters. +.Ds +.Fd getch "" \*m +.Fd wgetch win +WINDOW *win; +.De +Gets a character from the terminal and (if necessary) +echos it on the window. +\*(Es +Otherwise, the character gotten is returned. +If +.i noecho +has been set, then the window is left unaltered. +In order to retain control of the terminal, +it is necessary to have one of +.i noecho , +.i cbreak , +or +.i rawmode +set. +If you do not set one, +whatever routine you call to read characters will set +.i cbreak +for you, +and then reset to the original mode when finished. +.Ds +.Fd getstr str \*m +char *str; +.Fd wgetstr win\*,str +WINDOW *win; +char *str; +.De +Get a string through the window +and put it in the location pointed to by +.Vn str , +which is assumed to be large enough to handle it. +It sets tty modes if necessary, +and then calls +.Fn getch +(or +.Fn wgetch ) "" win +to get the characters needed to fill in the string +until a newline or EOF is encountered. +The newline stripped off the string. +\*(Es +.Ds +.Fd \*_putchar c +char c; +.De +Put out a character using the +.Fn putchar +macro. +This function is used to output every character +that +.b curses +generates. +Thus, +it can be redefined by the user who wants to do non-standard things +with the output. +It is named with an initial \*(lq\*_\*(rq +because it usually should be invisible to the programmer. +.Ds +.Fd raw "" \*m +.Fd noraw "" \*m +.De +Set or unset the terminal to/from raw mode. +On version 7 +.Un \** +.(f +\** +.Un +is a trademark of Bell Laboratories. +.)f +this also turns of newline mapping +(see +.Fn nl ). +.Ds +.Fd scanw fmt\*,arg1\*,arg2\*,... +char *fmt; +.Fd wscanw win\*,fmt\*,arg1\*,arg2\*,... +WINDOW *win; +char *fmt; +.De +Perform a +.Fn scanf +through the window using +.Vn fmt . +It does this using consecutive +.Fn getch 's +(or +.Fn wgetch 's). "" win +\*(Es diff --git a/lib/libcurses/PSD.doc/doc.III b/lib/libcurses/PSD.doc/doc.III new file mode 100644 index 00000000000..7d710d49dbc --- /dev/null +++ b/lib/libcurses/PSD.doc/doc.III @@ -0,0 +1,343 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.III 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd baudrate "" \*m +.De +Returns the output baud rate of the terminal. +This is a system dependent constant +(defined in +.b <sys/tty.h> +on BSD systems, +which is included by +.b <curses.h> ). +.Ds +.Fd delwin win +WINDOW *win; +.De +Deletes the window from existence. +All resources are freed for future use by +.b calloc (3). +If a window has a +.Fn subwin +allocated window inside of it, +deleting the outer window +the subwindow is not affected, +even though this does invalidate it. +Therefore, +subwindows should be deleted before their +outer windows are. +.Ds +.Fd endwin +.De +Finish up window routines before exit. +This restores the terminal to the state it was before +.Fn initscr +(or +.Fn gettmode +and +.Fn setterm ) +was called. +It should always be called before exiting. +It does not exit. +This is especially useful for resetting tty stats +when trapping rubouts via +.b signal (2). +.Ds +.Fd erasechar "" \*m +.De +Returns the erase character +for the terminal, +.i i.e. , +the character used by the user to erase a single character from the input. +.Ds +.Fd getcap str "" "char *" +char *str; +.De +Return a pointer to the +.b termcap +capability described by +.Vn str +(see +.b termcap (5) +for details). +.Ds +.Fd getyx win\*,y\*,x \*m +WINDOW *win; +int y\*,x; +.De +Puts the current \*y of +.Vn win +in the variables +.Vn y +and +.Vn x . +Since it is a macro, +not a function, +you do not pass the address +of +.Vn y +and +.Vn x . +.Ds +.Fd inch "" \*m +.Fd winch win \*m +WINDOW *win; +.De +Returns the character at the current \*(y +on the given window. +This does not make any changes to the window. +.Ds +.Fd initscr +.De +Initialize the screen routines. +This must be called before any of the screen routines are used. +It initializes the terminal-type data and such, +and without it none of the routines can operate. +If standard input is not a tty, +it sets the specifications to the terminal +whose name is pointed to by +.Vn Def\*_term +(initialy "dumb"). +If the boolean +.Vn My\*_term +is true, +.Vn Def\*_term +is always used. +If the system supports the +.b TIOCGWINSZ +.Fn ioctl "" "" 2 +call, +it is used to get the number of lines and columns for the terminal, +otherwise it is taken from the +.b termcap +description. +.Ds +.Fd killchar "" \*m +.De +Returns the line kill character +for the terminal, +.i i.e. , +the character used by the user to erase an entire line from the input. +.Ds +.Fd leaveok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Sets the boolean flag for leaving the cursor after the last change. +If +.Vn boolf +is TRUE, +the cursor will be left after the last update on the terminal, +and the current \*y for +.Vn win +will be changed accordingly. +If it is FALSE, +it will be moved to the current \*y. +This flag +(initialy FALSE) +retains its value until changed by the user. +.Ds +.Fd longname termbuf\*,name +char *termbuf\*,*name; +.Fd fullname termbuf\*,name +char *termbuf\*,*name; +.De +.Fn longname +fills in +.Vn name +with the long name of the terminal described by the +.b termcap +entry in +.Vn termbuf . +It is generally of little use, +but is nice for telling the user in a readable format what terminal +we think he has. +This is available in the global variable +.Vn ttytype . +.Vn termbuf +is usually set via the termlib routine +.Fn tgetent . +.Fn fullname +is the same as +.Fn longname , +except that it gives the fullest name given in the entry, +which can be quite verbose. +.Ds +.Fd mvwin win\*,y\*,x +WINDOW *win; +int y, x; +.De +Move the home position of the window +.Vn win +from its current starting coordinates +to +.Vn y\*,x ). ( +If that would put part or all of the window +off the edge of the terminal screen, +.Fn mvwin +returns ERR and does not change anything. +For subwindows, +.Fn mvwin +also returns ERR if you attempt to move it off its main window. +If you move a main window, +all subwindows are moved along with it. +.Ds +.Fd newwin lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" +int lines\*,cols\*,begin\*_y\*,begin\*_x; +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ). ( +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +Thus, to get a new window of dimensions +.Vn LINES +\(mu +.Vn COLS , +use +.Fn newwin . "" 0\*,0\*,0\*,0 +.Ds +.Fd nl "" \*m +.Fd nonl "" \*m +.De +Set or unset the terminal to/from nl mode, +.i i.e. , +start/stop the system from mapping +.b <RETURN> +to +.b <LINE-FEED> . +If the mapping is not done, +.Fn refresh +can do more optimization, +so it is recommended, but not required, to turn it off. +.Ds +.Fd scrollok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Set the scroll flag for the given window. +If +.Vn boolf +is FALSE, scrolling is not allowed. +This is its default setting. +.Ds +.Fd touchline win\*,y\*,startx\*,endx +WINDOW *win; +int y\*,startx\*,endx; +.De +This function performs a function similar to +.Fn touchwin +on a single line. +It marks the first change for the given line +to be +.Vn startx , +if it is before the current first change mark, +and +the last change mark is set to be +.Vn endx +if it is currently less than +.Vn endx . +.Ds +.Fd touchoverlap win1\*,win2 +WINDOW *win1, *win2; +.De +Touch the window +.Vn win2 +in the area which overlaps with +.Vn win1 . +If they do not overlap, +no changes are made. +.Ds +.Fd touchwin win +WINDOW *win; +.De +Make it appear that the every location on the window +has been changed. +This is usually only needed for refreshes with overlapping windows. +.Ds +.Fd subwin win\*,lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" +WINDOW *win; +int lines\*,cols\*,begin\*_y\*,begin\*_x; +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ) ( +inside the window +.i win . +This means that any change made to either window +in the area covered +by the subwindow will be made on both windows. +.Vn begin\*_y\*,begin\*_x +are specified relative to the overall screen, +not the relative (0\*,0) of +.Vn win . +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +.Ds +.Fd unctrl ch \*m +char ch; +.De +This is actually a debug function for the library, +but it is of general usefulness. +It returns a string which is a representation of +.Vn ch . +Control characters become their upper-case equivalents preceded by a "^". +Other letters stay just as they are. +To use +.Fn unctrl , +you may have to have +.b #include\ <unctrl.h> +in your file. diff --git a/lib/libcurses/PSD.doc/doc.IV b/lib/libcurses/PSD.doc/doc.IV new file mode 100644 index 00000000000..717a9863abb --- /dev/null +++ b/lib/libcurses/PSD.doc/doc.IV @@ -0,0 +1,110 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.IV 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd gettmode +.De +Get the tty stats. +This is normally called by +.Fn initscr . +.Ds +.Fd mvcur lasty\*,lastx\*,newy\*,newx +int lasty\*,lastx\*,newy\*,newx; +.De +Moves the terminal's cursor from +.Vn lasty\*,lastx ) ( +to +.Vn newy\*,newx ) ( +in an approximation of optimal fashion. +This routine uses the functions borrowed from +.i ex +version 2.6. +It is possible to use this optimization +without the benefit of the screen routines. +With the screen routines, this should not be called by the user. +.Fn move +and +.Fn refresh +should be used to move the cursor position, +so that the routines know what's going on. +.Ds +.Fd scroll win +WINDOW *win; +.De +Scroll the window upward one line. +This is normally not used by the user. +.Ds +.Fd savetty "" \*m +.Fd resetty "" \*m +.De +.Fn savetty +saves the current tty characteristic flags. +.Fn resetty +restores them to what +.Fn savetty +stored. +These functions are performed automatically by +.Fn initscr +and +.Fn endwin . +.Ds +.Fd setterm name +char *name; +.De +Set the terminal characteristics to be those of the terminal named +.Vn name , +getting the terminal size from the +.b TIOCGWINSZ +.Fn ioctl "" "" 2 +if it exists, +otherwise from the environment. +This is normally called by +.Fn initscr . +.Ds +.Fd tstp +.De +If the new +.b tty (4) +driver is in use, +this function +will save the current tty state +and then put the process to sleep. +When the process gets restarted, +it restores the tty state +and then calls +.Fn wrefresh "" "" curscr +to redraw the screen. +.Fn initscr +sets the signal +SIGTSTP +to trap to this routine. diff --git a/lib/libcurses/PSD.doc/ex1.c b/lib/libcurses/PSD.doc/ex1.c new file mode 100644 index 00000000000..02ed9b936bd --- /dev/null +++ b/lib/libcurses/PSD.doc/ex1.c @@ -0,0 +1,102 @@ +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ex1.c 8.1 (Berkeley) 6/8/93 +.\" +#include <sys/types.h> +#include <curses.h> +#include <stdio.h> +#include <signal.h> + + +#define YSIZE 10 +#define XSIZE 20 + +int quit(); + +main() +{ + int i, j, c; + size_t len; + char id[100]; + FILE *fp; + char *s; + + initscr(); /* Always call initscr() first */ + signal(SIGINT, quit); /* Make sure wou have a 'cleanup' fn */ + crmode(); /* We want cbreak mode */ + noecho(); /* We want to have control of chars */ + delwin(stdscr); /* Create our own stdscr */ + stdscr = newwin(YSIZE, XSIZE, 10, 35); + flushok(stdscr, TRUE); /* Enable flushing of stdout */ + scrollok(stdscr, TRUE); /* Enable scrolling */ + erase(); /* Initially, clear the screen */ + + standout(); + move(0,0); + while (1) { + c = getchar(); + switch(c) { + case 'q': /* Quit on 'q' */ + quit(); + break; + case 's': /* Go into standout mode on 's' */ + standout(); + break; + case 'e': /* Exit standout mode on 'e' */ + standend(); + break; + case 'r': /* Force a refresh on 'r' */ + wrefresh(curscr); + break; + default: /* By default output the character */ + addch(c); + refresh(); + } + } +} + + +int +quit() +{ + erase(); /* Terminate by erasing the screen */ + refresh(); + endwin(); /* Always end with endwin() */ + delwin(curscr); /* Return storage */ + delwin(stdscr); + putchar('\n'); + exit(0); +} + + + + diff --git a/lib/libcurses/PSD.doc/ex2.c b/lib/libcurses/PSD.doc/ex2.c new file mode 100644 index 00000000000..13e8f2990b9 --- /dev/null +++ b/lib/libcurses/PSD.doc/ex2.c @@ -0,0 +1,210 @@ +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ex2.c 8.1 (Berkeley) 6/8/93 +.\" +#include <curses.h> +#include <stdio.h> +#include <signal.h> + +#define YSIZE LINES +#define XSIZE COLS + +static int quit(); + +/* + * This program fills the screen up with characters and the allows the user to + * manipulate the text on the screen using some basic commands. + * Nothing fancy, just a demonstration of the elementary features of the + * curses(3) package. + */ +main() +{ + int i, j, c, n, d = 0; + char id[100]; + int hh = 0; + int curx, cury, base, arg; + + initscr(); + signal(SIGINT, quit); + crmode(); + noecho(); + nonl(); + delwin(stdscr); + stdscr = newwin(YSIZE, XSIZE, 0, 0); + flushok(stdscr, TRUE); + scrollok(stdscr, TRUE); + erase(); + refresh(); + + move(0,0); + refresh(); + for (i = 0; i < YSIZE + 2; i++) { + sprintf(id, "%d: ", i); + addstr(id); + for (j = 0; j < XSIZE - strlen(id); j++) + addch('0' + (i % 10)); + } + c = getchar(); + base = 2; + curx = cury = 0; + move(0, 0); + refresh(); + + /* + * The screen manipulator has the following commands: + * 'D' - clear to the end of the current line. + * 'B' - clear to the bottom of the screen. + * 'E' - erase the screen. + * 's' - enter standout mode. + * 'e' - exit standout mode. + * 'd' n - delete n lines below cursor line. + * 'i' n - insert n lines below cursor line. + * 'q' - quit. + * 'f' - move cursor one position to the right. + * 'b' - move cursor one position to the left. + * 'n' - move cursor one line down. + * 'p' - move cursor one line up. + * 'h' - home cusor. + * 'l' - force refresh. + * 'r' - simulate a carriage return. + * + * All other characters are ignored. + */ + for(;;) { + switch(c = getchar()) { + case 'D': + clrtoeol(); + refresh(); + continue; + case 'B': + clrtobot(); + refresh(); + continue; + case 'E': + erase(); + refresh(); + continue; + case 's': + standout(); + continue; + case 'e': + standend(); + continue; + case 'd': + arg = getchar() - '0'; + for (i = 0; i < arg; i++) + deleteln(); + refresh(); + continue; + case 'i': + arg = getchar() - '0'; + for (i = 0; i < arg; i++) + insertln(); + refresh(); + continue; + case 'q': + quit(); + case 'f': + if (curx < XSIZE - 1) + curx++; + else { + cury++; + curx = 0; + } + break; + case 'b': + if (curx == 0) { + cury--; + curx = XSIZE - 1; + } else + curx--; + break; + case 'n': + cury++; + break; + case 'p': + cury--; + break; + case 'h': + curx = cury = 0; + break; + case 'l': + wrefresh(curscr); + continue; + case 'r': /* return */ + { + int x, y; + getyx(stdscr, y, x); + move(y+1, 0); + insertln(); + move(y, x); + clrtoeol(); + refresh(); + continue; + } + default: + continue; + } + + if (cury < 0) { + base--; + move(0, 0); + insertln(); + sprintf(id, "%d: ", base); + addstr(id); + for (j = 0; j < XSIZE - strlen(id) - 2; j++) + addch('0' + (base % 10)); + cury++; + } else if (cury >= YSIZE) { + move(0, 0); + deleteln(); + move(YSIZE - 1, 0); + sprintf(id, "%d: ", base + YSIZE); + addstr(id); + for (j = 0; j < XSIZE - strlen(id) - 2; j++) + addch('0' + ((base + YSIZE) % 10)); + cury--; + base++; + } + move(cury, curx); + refresh(); + } +} + +int +quit() +{ + erase(); + refresh(); + endwin(); + exit(0); +} diff --git a/lib/libcurses/PSD.doc/fns.doc b/lib/libcurses/PSD.doc/fns.doc new file mode 100644 index 00000000000..30d5c4c971d --- /dev/null +++ b/lib/libcurses/PSD.doc/fns.doc @@ -0,0 +1,795 @@ +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)fns.doc 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fn addch "char ch" \(dg +.De +Add the character +.Vn ch +on the window +at the current \*y. +If the character is a newline +(\'\en\') +the line will be cleared to the end, +and the current \*y will be changed to the +beginning off the next line +if newline mapping is on, +or to the next line at the same x co-ordinate +if it is off. +A return +(\'\er\') +will move to the beginning of the line on the window. +Tabs +(\'\et\') +will be expanded into spaces +in the normal tabstop positions of +every eight characters. +\*(Es +.Ds +.Fn addstr "char *str" \(dg +.De +Add the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fn baudrate "" \(dg +.De +Returns the output baud rate of the terminal. +This is a system dependent constant +(defined in +.b <sys/tty.h> +on BSD systems, +which is included by +.b <curses.h> ). +.Ds +.Fn box "WINDOW win" "char vert" "char hor" +.De +.Pp +Draws a box around the window using +.Vn vert +as the character for drawing the vertical sides, and +.Vn hor +for drawing the horizontal lines. +If scrolling is not allowed, +and the window encompasses the lower right-hand corner of the terminal, +the corners are left blank to avoid a scroll. +.Ds +.Fn cbreak "" \(dg +.De +Set or the terminal to cbreak mode. +.Ds +.Fn clear "" \(dg +.De +Resets the entire window to blanks. +If +.Vn win +is a screen, +this sets the clear flag, +which will cause a clear-screen sequence to be sent +on the next +.Fn refresh +call. +This also moves the current \*y +to (0\*,0). +.Ds +.Fn clearok "WINDOW *scr" "int boolf" \(dg +.De +Sets the clear flag for the screen +.Vn scr . +If +.Vn boolf +is non-zero, +this will force a clear-screen to be printed on the next +.Fn refresh , +or stop it from doing so if +.Vn boolf +is 0. +This only works on screens, +and, +unlike +.Fn clear , +does not alter the contents of the screen. +If +.Vn scr +is +.Vn curscr , +the next +.Fn refresh +call will cause a clear-screen, +even if the window passed to +.Fn refresh +is not a screen. +.Ds +.Fn clrtobot "" \(dg +.De +Wipes the window clear from the current \*y to the bottom. +This does not force a clear-screen sequence on the next refresh +under any circumstances. +\*(Nm +.Ds +.Fn clrtoeol "" \(dg +.De +Wipes the window clear from the current \*y to the end of the line. +\*(Nm +.Ds +.Fn crmode "" \(dg +.De +Identical to +.Fn cbreak . +The misnamed macro +.Fn crmode +and +.Fn nocrmode +is retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fn delch "" +.De +Delete the character at the current \*y. +Each character after it on the line shifts to the left, +and the last character becomes blank. +.Ds +.Fn deleteln "" +.De +Delete the current line. +Every line below the current one will move up, +and the bottom line will become blank. +The current \*y will remain unchanged. +.Ds +.Fn delwin "WINDOW *win" +.De +Deletes the window from existence. +All resources are freed for future use by +.b calloc (3). +If a window has a +.Fn subwin +allocated window inside of it, +deleting the outer window +the subwindow is not affected, +even though this does invalidate it. +Therefore, +subwindows should be deleted before their +outer windows are. +.Ds +.Fn echo "" \(dg +.De +Sets the terminal to echo characters. +.Ds +.Fn endwin "" +.De +Finish up window routines before exit. +This restores the terminal to the state it was before +.Fn initscr +(or +.Fn gettmode +and +.Fn setterm ) +was called. +It should always be called before exiting and before the final calls to +.Fn delwin . +It does not exit. +This is especially useful for resetting tty stats +when trapping rubouts via +.b signal (2). +.Ds +.Fn erase "" \(dg +.De +Erases the window to blanks without setting the clear flag. +This is analagous to +.Fn clear , +except that it never causes a clear-screen sequence to be generated +on a +.Fn refresh . +\*(Nm +.Ds +.Fn erasechar "" \(dg +.De +Returns the erase character +for the terminal, +.i i.e. , +the character used by the user to erase a single character from the input. +.Ds +.Fn flushok "WINDOW *win" "int boolf" +.De +Normally, +.Fn refresh +.Fn fflush 's +.Vn stdout +when it is finished. +.Fn flushok +allows you to control this. +if +.Vn boolf +is non-zero +(\c +.i i.e. , +non-zero) +it will do the +.Fn fflush , +otherwise it will not. +.Ds +.Fn getch "" \(dg +.De +Gets a character from the terminal and (if necessary) +echos it on the window. +\*(Es +Otherwise, the character gotten is returned. +If +.i noecho +has been set, then the window is left unaltered. +In order to retain control of the terminal, +it is necessary to have one of +.i noecho , +.i cbreak , +or +.i rawmode +set. +If you do not set one, +whatever routine you call to read characters will set +.i cbreak +for you, +and then reset to the original mode when finished. +.Ds +.Fn getstr "char *str" \(dg +.De +Get a string through the window +and put it in the location pointed to by +.Vn str , +which is assumed to be large enough to handle it. +It sets tty modes if necessary, +and then calls +.Fn getch +(or +.Fn wgetch ) +to get the characters needed to fill in the string +until a newline or EOF is encountered. +The newline stripped off the string. +\*(Es +.Ds +.Fn gettmode "" +.De +Get the tty stats. +This is normally called by +.Fn initscr . +.Ds +.Fn getyx "WINDOW *win" "int y" "int x" +.De +Puts the current \*y of +.Vn win +in the variables +.Vn y +and +.Vn x . +Since it is a macro, +not a function, +you do not pass the address +of +.Vn y +and +.Vn x . +.Ds +.Fn idlok "WINDOW *win" "int boolf" +.De +Reserved for future use. +This will eventually signal to +.Fn refresh +that it is all right to use the insert and delete line sequences +when updating the window. +.Ds +.Fn inch "" \(dg +.De +Returns the character at the current position on the given window. +This does not make any changes to the window. +.Ds +.Fn initscr "" +.De +Initialize the screen routines. +This must be called before any of the screen routines are used. +It initializes the terminal-type data and such, +and without it none of the routines can operate. +If standard input is not a tty, +it sets the specifications to the terminal +whose name is pointed to by +.Vn Def\*_term +(initially "dumb"). +If the boolean +.Vn My\*_term +is non-zero, +.Vn Def\*_term +is always used. +If the system supports the +.b TIOCGWINSZ +.i ioctl(2) +call, +it is used to get the number of lines and columns for the terminal, +otherwise it is taken from the +.b termcap +description. +.Ds +.Fn insch "char c" +.De +Insert +.Vn c +at the current \*y +Each character after it shifts to the right, +and the last character disappears. +\*(Es +.Ds +.Fn insertln "" +.De +Insert a line above the current one. +Every line below the current line +will be shifted down, +and the bottom line will disappear. +The current line will become blank, +and the current \*y will remain unchanged. +.Ds +.Fn killchar "" \(dg +.De +Returns the line kill character +for the terminal, +.i i.e. , +the character used by the user to erase an entire line from the input. +.Ds +.Fn leaveok "WINDOW *win" "int boolf" \(dg +.De +Sets the boolean flag for leaving the cursor after the last change. +If +.Vn boolf +is non-zero, +the cursor will be left after the last update on the terminal, +and the current \*y for +.Vn win +will be changed accordingly. +If +.Vn boolf + is 0 the cursor will be moved to the current \*y. +This flag +(initially 0) +retains its value until changed by the user. +.Ds +.Fn move "int y" "int x" +.De +Change the current \*y of the window to +.Vn y\*,x ). ( +\*(Es +.Ds +.Fn mvcur "int lasty" "int lastx" "int newy" "int newx" +.De +Moves the terminal's cursor from +.Vn lasty\*,lastx ) ( +to +.Vn newy\*,newx ) ( +in an approximation of optimal fashion. +This routine uses the functions borrowed from +.i ex +version 2.6. +It is possible to use this optimization +without the benefit of the screen routines. +With the screen routines, this should not be called by the user. +.Fn move +and +.Fn refresh +should be used to move the cursor position, +so that the routines know what's going on. +.Ds +.Fn mvprintw "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +move(y, x); +printw(fmt, ...); +.)l +.Ds +.Fn mvscanw "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +move(y, x); +scanw(fmt, ...); +.)l +.Ds +.Fn mvwin "WINDOW *win" "int y" "int x" +.De +Move the home position of the window +.Vn win +from its current starting coordinates +to +.Vn y\*,x ). ( +If that would put part or all of the window +off the edge of the terminal screen, +.Fn mvwin +returns ERR and does not change anything. +For subwindows, +.Fn mvwin +also returns ERR if you attempt to move it off its main window. +If you move a main window, +all subwindows are moved along with it. +.Ds +.Fn mvwprintw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +wmove(win, y, x); +printw(fmt, ...); +.)l +.Ds +.Fn mvwscanw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +wmove(win, y, x); +scanw(fmt, ...); +.)l +.Ds +.Ft "WINDOW *" +.Fn newwin "int lines" "int cols" "int begin_y" "int begin_x" +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ). ( +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +Thus, to get a new window of dimensions +.Vn LINES +\(mu +.Vn COLS , +use +.Fn newwin 0 0 0 0 . +.Ds +.Fn nl "" \(dg +.De +Set the terminal to nl mode, +.i i.e. , +start/stop the system from mapping +.b <RETURN> +to +.b <LINE-FEED> . +If the mapping is not done, +.Fn refresh +can do more optimization, +so it is recommended, but not required, to turn it off. +.Ds +.Fn nocbreak "" \(dg +.De +Unset the terminal from cbreak mode. +.Ds +.Fn nocrmode "" \(dg +.De +Identical to +.Fn nocbreak . +The misnamed macro +.Fn nocrmode +is retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fn noecho "" \(dg +.De +Turn echoing of characters off. +.Ds +.Fn nonl "" \(dg +.De +Unset the terminal to from nl mode. See +.Fn nl . +.Ds +.Fn noraw "" \(dg +.De +Unset the terminal from raw mode. See +.Fn raw . +.Ds +.Fn overlay "WINDOW *win1" "WINDOW *win2" +.De +Overlay +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done non-destructively, +i.e., blanks on +.Vn win1 +leave the contents of the space on +.Vn win2 +untouched. Note that all non-blank characters are overwritten +destructively in the overlay. +.Ds +.Fn overwrite "WINDOW *win1" "WINDOW *win2" +.De +Overwrite +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done destructively, +.i i.e. , +blanks on +.Vn win1 +become blank on +.Vn win2 . +.Ds +.Fn printw "char *fmt" "..." +.De +Performs a +.Fn printf +on the window starting at the current \*y. +It uses +.Fn addstr +to add the string on the window. +It is often advisable to use the field width options of +.Fn printf +to avoid leaving things on the window from earlier calls. +\*(Es +.Ds +.Fn raw "" \(dg +.De +Set the terminal to raw mode. +On version 7 +.Un \** +.(f +\** +.Un +is a trademark of Unix System Laboratories. +.)f +this also turns off newline mapping +(see +.Fn nl ). +.Ds +.Fn refresh "" \(dg +.De +Synchronize the terminal screen with the desired window. +If the window is not a screen, +only that part covered by it is updated. +\*(Es +In this case, it will update whatever it can +without causing the scroll. +.sp +As a special case, +if +.Fn wrefresh +is called with the window +.Vn curscr +the screen is cleared +and repainted as it is currently. +This is very useful for allowing the redrawing of the screen +when the user has garbage dumped on his terminal. +.Ds +.Fn resetty "" \(dg +.De +.Fn resetty +restores them to what +.Fn savetty +stored. +These functions are performed automatically by +.Fn initscr +and +.Fn endwin . +This function should not be used by the user. +.Ds +.Fn savetty "" \(dg +.De +.Fn savetty +saves the current tty characteristic flags. See +.Fn resetty . +This function should not be used by the user. +.Ds +.Fn scanw "char *fmt" "..." +.De +Perform a +.Fn scanf +through the window using +.Vn fmt . +It does this using consecutive calls to +.Fn getch +(or +.Fn wgetch ). +\*(Es +.Ds +.Fn scroll "WINDOW *win" +.De +Scroll the window upward one line. +This is normally not used by the user. +.Ds +.Fn scrollok "WINDOW *win" "int boolf" \(dg +.De +Set the scroll flag for the given window. +If +.Vn boolf +is 0, scrolling is not allowed. +This is its default setting. +.Ds +.Fn standend "" \(dg +.De +End standout mode initiated by +.Fn standout . +.Ds +.Fn standout "" \(dg +.De +Causes any characters added to the window +to be put in standout mode on the terminal +(if it has that capability). +.Ds +.Ft "WINDOW *" +.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x" +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ) ( +inside the window +.i win . +This means that any change made to either window +in the area covered +by the subwindow will be made on both windows. +.Vn begin\*_y\*,begin\*_x +are specified relative to the overall screen, +not the relative (0\*,0) of +.Vn win . +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +.Ds +.Fn touchline "WINDOW *win" "int y" "int startx" "int endx" +.De +This function performs a function similar to +.Fn touchwin +on a single line. +It marks the first change for the given line +to be +.Vn startx , +if it is before the current first change mark, +and +the last change mark is set to be +.Vn endx +if it is currently less than +.Vn endx . +.Ds +.Fn touchoverlap "WINDOW *win1" "WINDOW *win2" +.De +Touch the window +.Vn win2 +in the area which overlaps with +.Vn win1 . +If they do not overlap, +no changes are made. +.Ds +.Fn touchwin "WINDOW *win" +.De +Make it appear that the every location on the window +has been changed. +This is usually only needed for refreshes with overlapping windows. +.Ds +.Fn tstp +.De +This function +will save the current tty state +and then put the process to sleep. +When the process gets restarted, +it restores the saved tty state +and then calls +.Fn wrefresh "curscr" +to redraw the screen. +.Fn Initscr +sets the signal +SIGTSTP +to trap to this routine. +.Ds +.Fn unctrl "char *ch" \(dg +.De +Returns a string which is an ASCII representation of +.Vn ch . +Characters are 8 bits long. +.Ds +.Fn unctrllen "char *ch" \(dg +.De +Returns the length of the ASCII representation of +.Vn ch . +.Ds +.Fn vwprintw "WINDOW *win" "const char *fmt" "va_list ap" +.De +Identical to +.Fn printw +except that it takes both a window specification and a pointer to a variable +length argument list. +.Ds +.Fn vwscanw "WINDOW *win" "const char *fmt" "va_list ap" +.De +Identical to +.Fn scanw +except that it takes both a window specification and a pointer to a variable +length argument list. +.Ds +.Fn waddbytes "WINDOW *win" "char *str" "int len" +.De +This function is the low level character output function. +.Vn Len +characters of the string +.Vn str +are output to the current \*y position of the window specified by +.Vn win. +.sp 2 +.pp +\fIThe following functions differ from the standard functions only in their +specification of a window, rather than the use of the default +.Vn stdscr.\fP +.Ds +.Fn waddch "WINDOW *win" "char ch" +.Fn waddstr "WINDOW *win" "char *str" +.Fn wclear "WINDOW *win" +.Fn wclrtobot "WINDOW *win" +.Fn wclrtoeol "WINDOW *win" +.Fn wdelch "WINDOW *win" +.Fn wdeleteln "WINDOW *win" +.Fn werase "WINDOW *win" +.Fn wgetch "WINDOW *win" +.Fn wgetstr "WINDOW *win" "char *str" +.Fn winch "WINDOW *win" \(dg +.Fn winsch "WINDOW *win" "char c" +.Fn winsertln "WINDOW *win" +.Fn wmove "WINDOW *win" "int y" int x" +.Fn wprintw "WINDOW *win" "char *fmt" "..." +.Fn wrefresh "WINDOW *win" +.Fn wscanw "WINDOW *win" "char *fmt" "..." +.Fn wstandend "WINDOW *win" +.Fn wstandout "WINDOW *win" +.Dg diff --git a/lib/libcurses/PSD.doc/intro.0 b/lib/libcurses/PSD.doc/intro.0 new file mode 100644 index 00000000000..c95b49d4782 --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.0 @@ -0,0 +1,106 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.0 8.1 (Berkeley) 6/4/93 +.\" +.tp +.(l C +.ps 12 +.ft B +Screen Updating and Cursor Movement Optimization: +.fl +A Library Package +.ft +.ps +.sp +.i "Kenneth C. R. C. Arnold" +.i "Elan Amir" +.sp +Computer Science Division +Department of Electrical Engineering and Computer Science +University of California, Berkeley +Berkeley, California 94720 +.sp 3 +.bi ABSTRACT +.sp 2 +.)l +.(q +.pp +This document describes a package of C library functions +which allow the user to: +.ie t .ip \ \ \ \(bu +.el .ip 1) +update a screen with reasonable optimization, +.ie t .ip \ \ \ \(bu +.el .ip 2) +get input from the terminal +in a screen-oriented fashion, +and +.ie t .ip \ \ \ \(bu +.el .ip 3) +independent from the above, move the cursor optimally +from one point to another. +.pp +These routines all use the +\*(tc \*(db to describe the capabilities of the terminal. +.)q +.b Acknowledgements +.pp +This package would not exist +without the work of Bill Joy, +who, +in writing his editor, +created the capability to generally describe terminals, +wrote the routines which read this \*(db, +and, most importantly, +those which implement optimal cursor movement, +which routines I have simply lifted nearly intact. +Doug Merritt and Kurt Shoens also were extremely important, +as were both willing to waste time listening to me rant and rave. +The help and/or support of +Ken Abrams, +Alan Char, +Mark Horton, +and +Joe Kalash, +was, and is, +also greatly appreciated. +.i "Ken Arnold 16 April 1986" +.pp +The help and/or support of Kirk McKusick and Keith Bostic (public vi!) +was invaluable in bringing the package ``into the 90's'', which now +includes completely new data structures and screen refresh optimization +routines. +.i "Elan Amir 29 December 1992" + + + + diff --git a/lib/libcurses/PSD.doc/intro.1 b/lib/libcurses/PSD.doc/intro.1 new file mode 100644 index 00000000000..a86d7571ade --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.1 @@ -0,0 +1,249 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.1 8.1 (Berkeley) 6/4/93 +.\" +.bp +.sh 1 Overview +.pp +In making available the generalized terminal descriptions in \*(tc, +much information was made available to the programmer, +but little work was taken out of one's hands. +The purpose of this package is to allow the C programmer +to do the most common type of terminal dependent functions, +those of movement optimization and optimal screen updating, +without doing any of the dirty work, +and with nearly as much ease as is necessary to simply print +or read things. +.sh 2 "Terminology" +.pp +In this document, the following terminology is used: +.de Ip +.sp +.in 5n +.ti 0n +.b "\\$1" : +.. +.Ip window +An internal representation +containing an image of what a section of the terminal screen may look like +at some point in time. +This subsection can either encompass the entire terminal screen, +or any smaller portion down to a single character within that screen. +.Ip terminal +Sometimes called +.b terminal +.b screen . +The package's idea of what the terminal's screen currently looks like, +.i i.e. , +what the user sees now. +This is a special +.i screen : +.Ip screen +This is a subset of windows which are as large as the terminal screen, +.i i.e. , +they start at the upper left hand corner +and encompass the lower right hand corner. +One of these, +.Vn stdscr , +is automatically provided for the programmer. +.rm Ip +.sh 2 "Compiling Applications" +.pp +In order to use the library, +it is necessary to have certain types and variables defined. +Therefore, the programmer must have a line: +.(l +.b "#include <curses.h>" +.)l +at the top of the program source. +Compilations should have the following form: +.(l +.ie t \fBcc\fR [ \fIflags\fR ] file ... \fB\-lcurses \-ltermcap\fR +.el \fIcc\fR [ flags ] file ... \fI\-lcurses \-ltermcap\fR +.)l +.sh 2 "Screen Updating" +.pp +In order to update the screen optimally, +it is necessary for the routines to know what the screen currently looks like +and what the programmer wants it to look like next. +For this purpose, +a data type +(structure) +named +.Vn WINDOW +is defined +which describes a window image to the routines, +including its starting position on the screen +(the \*y of the upper left hand corner) +and its size. +One of these +(called +.Vn curscr +for +.i "current screen" ) +is a screen image of what the terminal currently looks like. +Another screen +(called +.Vn stdscr , +for +.i "standard screen" ) +is provided +by default +to make changes on. +.pp +A window is a purely internal representation. +It is used to build and store +a potential image of a portion of the terminal. +It doesn't bear any necessary relation +to what is really on the terminal screen. +It is more like an array of characters on which to make changes. +.pp +When one has a window which describes +what some part the terminal should look like, +the routine +.Fn refresh +(or +.Fn wrefresh +if the window is not +.Vn stdscr ) +is called. +.Fn Refresh +makes the terminal, +in the area covered by the window, +look like that window. +Note, therefore, that changing something on a window +.i does +.bi not +.i "change the terminal" . +Actual updates to the terminal screen +are made only by calling +.Fn refresh +or +.Fn wrefresh . +This allows the programmer to maintain several different ideas +of what a portion of the terminal screen should look like. +Also, changes can be made to windows in any order, +without regard to motion efficiency. +Then, at will, +the programmer can effectively say +.q "make it look like this" , +and the package will execute the changes in an optimal way. +.sh 2 "Naming Conventions" +.pp +As hinted above, +the routines can use several windows, +but two are always available: +.Vn curscr , +which is the image of what the terminal looks like at present, +and +.Vn stdscr , +which is the image of what the programmer wants the terminal to look like next. +The user should not access +.Vn curscr +directly. +Changes should be made to +the appropriate screen, +and then the routine +.Fn refresh +(or +.Fn wrefresh ) +should be called. +.pp +Many functions are set up to deal with +.Vn stdscr +as a default screen. +For example, to add a character to +.Vn stdscr , +one calls +.Fn addch +with the desired character. +If a different window is to be used, +the routine +.Fn waddch +(for +.b w indow-specific +.Fn addch ) +is provided\**. +.(f +\** +Actually, +.Fn addch +is really a +.q #define +macro with arguments, +as are most of the "functions" which act upon +.Vn stdscr . +.)f +This convention of prepending function names with a +.Bq w +when they are to be applied to specific windows +is consistent. +The only routines which do +.i not +do this are those +to which a window must always be specified. +.pp +In order to move the current \*y from one point to another, +the routines +.Fn move +and +.Fn wmove +are provided. +However, +it is often desirable to first move and then perform some I/O operation. +In order to avoid clumsiness, +most I/O routines can be preceded by the prefix +.Bq mv +and the desired \*y can then be added to the arguments to the function. +For example, +the calls +.(l +move(y\*,x); +addch(ch); +.)l +can be replaced by +.(l +mvaddch(y\*,x\*,ch); +.)l +and +.(l +wmove(win\*,y\*,x); +waddch(win\*,ch); +.)l +can be replaced by +.(l +mvwaddch(win\*,y\*,x\*,ch); +.)l +Note that the window description pointer +.Vn win ) ( +comes before the added \*y. +If a window pointer is needed, it is always the first parameter passed. diff --git a/lib/libcurses/PSD.doc/intro.2 b/lib/libcurses/PSD.doc/intro.2 new file mode 100644 index 00000000000..d98c0c76198 --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.2 @@ -0,0 +1,77 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.2 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 Variables +.pp +Many variables which are used to describe the terminal environment +are available to the programmer. They are: +.(b +.TS +expand; +lw(6m) lw(8n) lw(50n). +type name description +_ +WINDOW * curscr T{ +.fi +current version of the screen (terminal screen). +T} +WINDOW * stdscr T{ +standard screen. Most updates are usually done here. +T} +char * Def\*_term T{ +default terminal type if type cannot be determined +T} +bool My\*_term T{ +use the terminal specification in \fIDef\*_term\fR as terminal, +irrelevant of real terminal type +T} +char * ttytype T{ +full name of the current terminal. +T} +int LINES T{ +number of lines on the terminal +T} +int COLS T{ +number of columns on the terminal +T} +int ERR T{ +error flag returned by routines on a fail. +T} +int OK T{ +flag returned by routines upon success. +T} +.TE +.fi +.ev +.)b +.lp diff --git a/lib/libcurses/PSD.doc/intro.3 b/lib/libcurses/PSD.doc/intro.3 new file mode 100644 index 00000000000..d0ba9a2ab7b --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.3 @@ -0,0 +1,228 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.3 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 Usage +.pp +This is a description of how to actually use the screen package. +For simplicity, we assume all updating, reading, etc. +is applied to +.Vn stdscr , +although a different window can of course be specified. +.sh 2 "Initialization" +.pp +In order to use the screen package, +the routines must know about terminal characteristics, +and the space for +.Vn curscr +and +.Vn stdscr +must be allocated. +These functions are performed by +.Fn initscr . +Since it must allocate space for the windows, +it can overflow core when attempting to do so. +On this rather rare occasion, +.Fn initscr +returns ERR. +.Fn Initscr +must +.bi always +be called before any of the routines which affect windows are used. +If it is not, +the program will core dump as soon as either +.Vn curscr +or +.Vn stdscr +are referenced. +However, it is usually best to wait to call it +until after you are sure you will need it, +like after checking for startup errors. +Terminal status changing routines +like +.Fn nl +and +.Fn cbreak +should be called after +.Fn initscr . +.pp +After the initial window allocation done by +.Fn initscr , +specific window characteristics can be set. +Scrolling can be enabled by calling +.Fn scrollok . +If you want the cursor to be left after the last change, use +.Fn leaveok . +If this isn't done, +.Fn refresh +will move the cursor to the window's current \*y after updating it. +Additional windows can be created by using the functions +.Fn newwin +and +.Fn subwin . +.Fn Delwin +allows you to delete an exisiting window. +The variables +.Vn LINES +and +.Vn COLS +control the size of the terminal. They are initially implicitly set by +.Fn initscr , +but can be altered explicitly by the user followed by a call to +.Fn initscr . +Note that any call to +.Fn initscr , +will always delete any existing +.Vn stdscr +and/or +.Vn curscr +before creating new ones so this change is best done before the initial call to +.Fn initscr . +.pp +.sh 2 "Output" +.pp +The basic functions +used to change what will go on a window are +.Fn addch +and +.Fn move . +.Fn Addch +adds a character at the current \*y, +returning ERR if it would cause the window to illegally scroll, +.i i.e. , +printing a character in the lower right-hand corner +of a terminal which automatically scrolls +if scrolling is not allowed. +.Fn Move +changes the current \*y to whatever you want them to be. +It returns ERR if you try to move off the window. +As mentioned above, you can combine the two into +.Fn mvaddch +to do both things in one call. +.pp +The other output functions +(such as +.Fn addstr +and +.Fn printw ) +all call +.Fn addch +to add characters to the window. +.pp +After a change has been made to the window, +you must call +.Fn refresh . +when you want the portion of the terminal covered by the window +to reflect the change. +In order to optimize finding changes, +.Fn refresh +assumes that any part of the window not changed +since the last +.Fn refresh +of that window has not been changed on the terminal, +.i i.e. , +that you have not refreshed a portion of the terminal +with an overlapping window. +If this is not the case, +the routines +.Fn touchwin , +.Fn touchline , +and +.Fn touchoverlap +are provided to make it look like a desired part of window has been changed, +thus forcing +.Fn refresh +to check that whole subsection of the terminal for changes. +.pp +If you call +.Fn wrefresh +with +.Vn curscr , +it will make the screen look like the image of +.Vn curscr . +This is useful for implementing a command +which would redraw the screen in case it got messed up. +.sh 2 Input +.pp +Input is essentially a mirror image of output. +The complementary function to +.Fn addch +is +.Fn getch +which, +if echo is set, +will call +.Fn addch +to echo the character. +Since the screen package needs to know what is on the terminal at all times, +if characters are to be echoed, +the tty must be in raw or cbreak mode. +If it is not, +.Fn getch +sets it to be cbreak, +and then reads in the character. +.sh 2 "Termination" +.pp +In order to perform certain optimizations, +and, +on some terminals, +to work at all, +some things must be done +before the screen routines start up. +These functions are performed in +.Fn getttmode +and +.Fn setterm , +which are called by +.Fn initscr . +In order to clean up after the routines, +the routine +.Fn endwin +is provided. +It restores tty modes to what they were +when +.Fn initscr +was first called. +The terminal state module uses the variable +.Vn curses_termios +to save the original terminal state which is then restored upon a call to +.Fn endwin . +Thus, +anytime after the call to initscr, +.Fn endwin +should be called before exiting. Note however, that +.Fn endwin +should always be called +.b before +the final calls to +.Fn delwin , +which free the storage of the windows. diff --git a/lib/libcurses/PSD.doc/intro.4 b/lib/libcurses/PSD.doc/intro.4 new file mode 100644 index 00000000000..9e529822c5d --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.4 @@ -0,0 +1,69 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.4 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "Cursor Movement Optimizations" +.pp +One of the most difficult things to do properly is motion optimization. +After using +.Fn gettmode +and +.Fn setterm +to get the terminal descriptions, +the function +.Fn mvcur +deals with this task. +It usage is simple: +simply tell it where you are now and where you want to go. +For example +.(l +mvcur(0\*,0\*,LINES/2\*,COLS/2); +.)l +.lp +would move the cursor from the home position (0\*,0) +to the middle of the screen. +If you wish to force absolute addressing, +you can use the function +.Fn tgoto +from the +.b termlib (7) +routines, +or you can tell +.Fn mvcur +that you are impossibly far away, +For example, +to absolutely address the lower left hand corner of the screen +from anywhere +just claim that you are in the upper right hand corner: +.(l +mvcur(0\*,COLS\-1\*,LINES\-1\*,0); +.)l diff --git a/lib/libcurses/PSD.doc/intro.5 b/lib/libcurses/PSD.doc/intro.5 new file mode 100644 index 00000000000..d0f96575b4b --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.5 @@ -0,0 +1,87 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.5 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "Character Output and Scrolling" +.pp +The character output policy deals with the following problems. First, +where is the location of the cursor after a character is printed, and +secondly, when does the screen scroll if scrolling is enabled. +.pp +In the normal case the characters are output as expected, with the cursor +occupying the position of the next character to be output. However, when the +cursor is on the last column of the line, the cursor will remain on that +position after the last character on the line is output and will only assume +the position on the next line when the next character (the first on the next +line) is output. +.pp +Likewise, if scrolling is enabled, a scroll will be invoked only when the +first character on he first line past the bottom line of the window is +output. If scrolling is not enabled the chracters will to be output to the +bottom right corner of the window which is the cursor location. +.pp +This policy allows consistent behavior of the cursor at the boundary +conditions. Furthermore, it prevents a scroll from happening before it is +actually needed (the old package used to scroll when the bottom right position +was output a character). As a precendent, it models the +.i xterm +character output conventions. +.sh 1 "Terminal State Handling" +.pp +The variable +.Vn curses_termios +contains the terminal state of the terminal. Certain historical routines +return information: +.Fn baudrate , +.Fn erasechar , +.Fn killchar , +and +.Fn ospeed . +These routines are obsolete and exist only for backward compatibility. If +you wish to use the information in the +.Vn curses_termios +structure, you should use the +\fItsetattr\fP(3) +routines. +.sh 1 "Subwindows" +.pp +Subwindows are windows which do not have an independent text structure, +.i i.e. , +they are windows whose text is a subset of the text of a larger window: the +.i parent +window. One consequence of this is that changes to either the parent or the +child window are destructive to the other, +.i i.e. , +a change to the subwindow is also a change to the parent window and a change +to the parent window in the region defined by the subwindow is implicitly a +change to the subwindow as well. +Apart from this detail, subwindows function like any other window. diff --git a/lib/libcurses/PSD.doc/intro.6 b/lib/libcurses/PSD.doc/intro.6 new file mode 100644 index 00000000000..7c4560dc33a --- /dev/null +++ b/lib/libcurses/PSD.doc/intro.6 @@ -0,0 +1,44 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.6 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "The Functions" +.pp +In the following definitions, +.q \*m +means that the +.q function +is really a +.q #define +macro with arguments. +.ta 11m 17m 25m 33m 41m 49m 57m 65m 73m +.so fns.doc diff --git a/lib/libcurses/PSD.doc/life.c b/lib/libcurses/PSD.doc/life.c new file mode 100644 index 00000000000..72febba29ae --- /dev/null +++ b/lib/libcurses/PSD.doc/life.c @@ -0,0 +1,163 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)life.c 8.1 (Berkeley) 6/8/93 +.\" +# include <curses.h> +# include <signal.h> + +/* + * Run a life game. This is a demonstration program for + * the Screen Updating section of the -lcurses cursor package. + */ + +typedef struct lst_st { /* linked list element */ + int y, x; /* (y, x) position of piece */ + struct lst_st *next, *last; /* doubly linked */ +} LIST; + +LIST *Head; /* head of linked list */ + +int die(); + +main(ac, av) +int ac; +char *av[]; +{ + evalargs(ac, av); /* evaluate arguments */ + + initscr(); /* initialize screen package */ + signal(SIGINT, die); /* set to restore tty stats */ + cbreak(); /* set for char-by-char */ + noecho(); /* input */ + nonl(); /* for optimization */ + + getstart(); /* get starting position */ + for (;;) { + prboard(); /* print out current board */ + update(); /* update board position */ + } +} + +/* + * This is the routine which is called when rubout is hit. + * It resets the tty stats to their original values. This + * is the normal way of leaving the program. + */ +die() +{ + signal(SIGINT, SIG_IGN); /* ignore rubouts */ + mvcur(0, COLS - 1, LINES - 1, 0); /* go to bottom of screen */ + endwin(); /* set terminal to good state */ + exit(0); +} + +/* + * Get the starting position from the user. They keys u, i, o, j, l, + * m, ,, and . are used for moving their relative directions from the + * k key. Thus, u move diagonally up to the left, , moves directly down, + * etc. x places a piece at the current position, " " takes it away. + * The input can also be from a file. The list is built after the + * board setup is ready. + */ +getstart() +{ + reg char c; + reg int x, y; + auto char buf[100]; + + box(stdscr, '|', '_'); /* box in the screen */ + move(1, 1); /* move to upper left corner */ + + for (;;) { + refresh(); /* print current position */ + if ((c = getch()) == 'q') + break; + switch (c) { + case 'u': + case 'i': + case 'o': + case 'j': + case 'l': + case 'm': + case ',': + case '.': + adjustyx(c); + break; + case 'f': + mvaddstr(0, 0, "File name: "); + getstr(buf); + readfile(buf); + break; + case 'x': + addch('X'); + break; + case ' ': + addch(' '); + break; + } + } + + if (Head != NULL) /* start new list */ + dellist(Head); + Head = malloc(sizeof (LIST)); + + /* + * loop through the screen looking for 'x's, and add a list + * element for each one + */ + for (y = 1; y < LINES - 1; y++) + for (x = 1; x < COLS - 1; x++) { + move(y, x); + if (inch() == 'x') + addlist(y, x); + } +} + +/* + * Print out the current board position from the linked list + */ +prboard() { + + reg LIST *hp; + + erase(); /* clear out last position */ + box(stdscr, '|', '_'); /* box in the screen */ + + /* + * go through the list adding each piece to the newly + * blank board + */ + for (hp = Head; hp; hp = hp->next) + mvaddch(hp->y, hp->x, 'X'); + + refresh(); +} diff --git a/lib/libcurses/PSD.doc/macros b/lib/libcurses/PSD.doc/macros new file mode 100644 index 00000000000..b7f3abf793e --- /dev/null +++ b/lib/libcurses/PSD.doc/macros @@ -0,0 +1,144 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)macros 8.1 (Berkeley) 8/14/93 +.\" +.\" this is the uncommented version. The commented one is in "macros.coms" +.ie t .ds _ \d\(mi\u +.el .ds _ _ +.ds , ,\ +.ds y (y\*,x) co-ordinates +.ds db database +.ie n .ds f \fI +.el .ds f \fB +.ds tc \*ftermcap\fP(5) +.ds Es This returns ERR if it would cause the screen to scroll illegally. +.ds Nm This has no associated \*(lq\fBmv\fP\*(rq command. +.ie t .ds m \fB\s-2\(dg\s+2\fP +.el .ds m [*] +.\" .hy WINDOW +.\".he ''\*(Ln'' +.\".fo ''\- % \-'' +.oh '\*(Ln''PS1:19-%' +.eh 'PS1:19-%''\*(Ln' +.de Un +.b +\s-2\\$2UNIX\\$1\s+2 +.ft +.. +.de Ds +.sp +.lp +.ev 1 +.nf +.ft I +.in 0 +.di Df +.. +.de De +.di +.Df +.ne \n(dn+2 +.ev +.ip +.. +.de Dg +.di +.Df +.ne \n(dn+2 +.ev +.. +.de Fd +.br +\&\\$4 +.fi +.b +\&\\$1(\\$2) +.ft +\&\\$3 +.br +.nf +.. +.de Vn +\&\\$3\c +.i "\\$1" \\$2 +.. +.de Bq +.ie t \&\*(lq\fB\\$1\fP\*(rq +.el \&\*(lq\fI\\$1\fP\*(rq +.. +.de $0 +.(x +.in \\n(Xs +\\*($n \\$1 +.)x +.. +.de $1 +.nr Xs 0 +.. +.de $2 +.nr Xs 3 +.. +.de $3 +.nr Xs 6 +.. +.de Fn +.if \\n(.$==0 .tm error +.nr ll 0 +.nr dg 0 +.ft R +.if '\\$\\n(.$'.' .nr ll 1 +.if '\\$\\n(.$',' .nr ll 1 +.if '\\$\\n(.$')' .nr ll 1 +.if '\\$\\n(.$').' .nr ll 1 +.if '\\$\\n(.$';' .nr ll 1 +.if '\\$\\n(.$':' .nr ll 1 +.if '\\$\\n(.$'\'s' .nr ll 1 +.if '\\$\\n(.$'\(dg' .nr ll 1 +.\" .if '\\$\\n(.$'' .nr ll 1 +.nr al \\n(.$-\\n(ll +.ds ot \f(CB\\$1\fP( +.if \\n(al>1 .as ot \fI\\$2\fP +.if \\n(al>2 .as ot ", \fI\\$3\fP +.if \\n(al>3 .as ot ", \fI\\$4\fP +.if \\n(al>4 .as ot ", \fI\\$5\fP +.if \\n(al>5 .as ot ", \fI\\$6\fP +.if \\n(al>6 .as ot ", \fI\\$7\fP +.if \\n(al>7 .as ot ", \fI\\$8\fP +.if \\n(al>8 .as ot ", \fI\\$9\fP +.as ot ) +.if \\n(.$>1 \{\ +. if \\n(ll==0 .as ot ; +. if '\\$\\n(.$'\(dg' .as ot ; +.\} +.if \\n(ll==1 .as ot \\$\\n(.$ +\\*(ot +.. diff --git a/lib/libcurses/PSD.doc/paper.ps b/lib/libcurses/PSD.doc/paper.ps new file mode 100644 index 00000000000..91e76f432e0 --- /dev/null +++ b/lib/libcurses/PSD.doc/paper.ps @@ -0,0 +1,1719 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.08 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Italic +%%+ font Times-Roman +%%+ font Times-BoldItalic +%%+ font Courier-Bold +%%+ font Symbol +%%DocumentSuppliedResources: procset grops 1.08 0 +%%Pages: 19 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.08 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-BoldItalic +%%IncludeResource: font Courier-Bold +%%IncludeResource: font Symbol +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL +792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron +/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space +/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft +/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four +/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C +/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash +/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q +/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase +/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger +/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar +/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus +/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu +/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright +/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde +/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute +/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute +/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve +/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex +/udieresis/yacute/thorn/ydieresis]def/Courier-Bold@0 ENC0/Courier-Bold RE +/Times-BoldItalic@0 ENC0/Times-BoldItalic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 12/Times-Bold@0 SF -6.67(SS)148.024 99 S -5.326(cc)6.67 G 7.436 -5.326 +(rr ee)5.326 H -5.326(ee)5.326 G 13.34 -6.67(nn U)5.326 H(Up)-1.992 E(pd) +194.144 99 Q(da)200.818 99 Q(at)207.492 99 Q(ti)213.494 99 Q(in)217.492 99 Q +(ng)220.83 99 Q 3(ga)227.504 99 S(an)236.506 99 Q(nd)242.508 99 Q 3(dC)249.182 +99 S(Cu)258.856 99 Q(ur)267.522 99 Q(rs)274.196 99 Q(so)279.526 99 Q(or)284.196 +99 Q 3(rM)290.198 99 S(Mo)298.528 99 Q -.12(ov)309.858 99 S -.12(ve)315.74 99 S +(em)321.622 99 Q(me)326.952 99 Q(en)336.95 99 Q(nt)342.28 99 Q 3(tO)348.954 99 +S(Op)355.952 99 Q(pt)365.29 99 Q(ti)371.964 99 Q(im)375.962 99 Q(mi)379.3 99 Q +(iz)389.298 99 Q(za)392.636 99 Q(at)397.966 99 Q(ti)403.968 99 Q(io)407.966 99 +Q(on)411.304 99 Q(n:)417.306 99 Q(:)423.98 99 Q 17.324 -8.662(AA L)239.049 +109.8 T(Li).66 E(ib)258.723 109.8 Q(br)262.061 109.8 Q(ra)268.735 109.8 Q(ar) +274.065 109.8 Q(ry)280.067 109.8 Q 3(yP)285.397 109.8 S -.12(Pa)294.399 109.8 S +(ac)301.613 109.8 Q(ck)307.615 109.8 Q(ka)312.945 109.8 Q(ag)319.619 109.8 Q +(ge)325.621 109.8 Q(e)331.623 109.8 Q/F1 9/Times-Italic@0 SF -.315(Ke)244.03 +131.4 S(nneth C. R. C. Arnold).315 E(Elan Amir)269.374 142.2 Q/F2 9 +/Times-Roman@0 SF(Computer Science Di)238.365 163.8 Q(vision)-.225 E +(Department of Electrical Engineering and Computer Science)178.524 174.6 Q(Uni) +226.552 185.4 Q -.135(ve)-.225 G(rsity of California, Berk).135 E(ele)-.09 E(y) +-.135 E(Berk)238.162 196.2 Q(ele)-.09 E 1.17 -.585(y, C)-.135 H 2.25 +(alifornia 94720).585 F/F3 9/Times-BoldItalic@0 SF(ABSTRA)265.284 239.4 Q(CT) +-.585 E/F4 10/Times-Roman@0 SF +(This document describes a package of C library functions which allo)97 285.6 Q +2.5(wt)-.25 G(he user to:)384.2 285.6 Q 14<8375>79.5 301.8 S +(pdate a screen with reasonable optimization,)102 301.8 Q 14<8367>79.5 318 S +(et input from the terminal in a screen-oriented f)102 318 Q(ashion, and)-.1 E +14<8369>79.5 334.2 S(ndependent from the abo)99.78 334.2 Q -.15(ve)-.15 G 2.5 +(,m).15 G .3 -.15(ove t)221.4 334.2 T +(he cursor optimally from one point to another).15 E(.)-.55 E +(These routines all use the)97 350.4 Q/F5 10/Times-Bold@0 SF -3.328(tt)2.5 G +-4.438(ee)3.328 G -4.438(rr)4.438 G -8.328(mm)4.438 G -4.438(cc)8.328 G -4.998 +(aa)4.438 G -5.558(pp)4.998 G F4 +(\(5\) database to describe the capabilities of the terminal.)5.558 E/F6 9 +/Times-Bold@0 SF -6.496(AA)72 364.6 S -3.994(cc)6.496 G -5.002(kk)3.994 G +-5.002(nn)5.002 G 6.656 -4.498(oo w)5.002 H(wl)-1.998 E(le)103.424 364.6 Q(ed) +105.928 364.6 Q(dg)109.926 364.6 Q(ge)114.932 364.6 Q(em)119.434 364.6 Q(me) +123.432 364.6 Q(en)130.931 364.6 Q(nt)134.929 364.6 Q(ts)139.935 364.6 Q(s) +142.934 364.6 Q F4 1.221(This package w)97 380.8 R 1.221(ould not e)-.1 F 1.221 +(xist without the w)-.15 F 1.221(ork of Bill Jo)-.1 F 2.52 -.65(y, w)-.1 H 1.22 +(ho, in writing his editor).65 F 3.72(,c)-.4 G 1.22(reated the)463.63 380.8 R +1.134(capability to generally describe terminals, wrote the routines which rea\ +d this database, and, most impor)72 392.8 R(-)-.2 E(tantly)72 404.8 Q 3.036(,t) +-.65 G .536(hose which implement optimal cursor mo)102.446 404.8 R -.15(ve)-.15 +G .536(ment, which routines I ha).15 F .835 -.15(ve s)-.2 H .535 +(imply lifted nearly intact.).15 F .413(Doug Merritt and K)72 416.8 R .413 +(urt Shoens also were e)-.15 F .413 +(xtremely important, as were both willing to w)-.15 F .414(aste time listening) +-.1 F .913(to me rant and ra)72 428.8 R -.15(ve)-.2 G 5.912(.T).15 G .912 +(he help and/or support of K)167.024 428.8 R .912(en Abrams, Alan Char)-.25 F +3.412(,M)-.4 G .912(ark Horton, and Joe Kalash,)388.712 428.8 R -.1(wa)72 440.8 +S(s, and is, also greatly appreciated.).1 E/F7 10/Times-Italic@0 SF -.35(Ke)5 G +2.5(nA).35 G 7.5(rnold 16)247.9 440.8 R(April 1986)2.5 E F4 .509 +(The help and/or support of Kirk McK)97 457 R .509(usick and K)-.15 F .509 +(eith Bostic \(public vi!\))-.25 F -.1(wa)5.51 G 3.01(si).1 G -1.95 -.4(nv a) +418.08 457 T .51(luable in bringing).4 F .865(the package `)72 469 R .865 +(`into the 90')-.74 F(s')-.55 E .865(', which no)-.74 F 3.365(wi)-.25 G .865 +(ncludes completely ne)243.515 469 R 3.365(wd)-.25 G .864 +(ata structures and screen refresh opti-)350.01 469 R(mization routines.)72 481 +Q F7(Elan Amir)5 E(29 December 1992)7.5 E EP +%%Page: 3 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 326.978(eP) +134.236 60 S(PS)465.656 60 Q(S1)471.768 60 Q(1:)477.33 60 Q(:1)482.332 60 Q(19) +485.664 60 Q(9-)490.666 60 Q(-3)495.668 60 Q(3)499 60 Q -4.998(11)72 96 S 7.496 +-2.498(.. O)4.998 H(Ov)84.506 96 Q -.1(ve)92.288 96 S(er)97.19 96 Q -.1(rv) +101.632 96 S(vi)105.974 96 Q(ie)110.976 96 Q(ew)113.758 96 Q(w)118.2 96 Q/F1 10 +/Times-Roman@0 SF 2.106(In making a)97 112.2 R -.25(va)-.2 G 2.106 +(ilable the generalized terminal descriptions in).25 F F0 -3.328(tt)4.606 G +-4.438(ee)3.328 G -4.438(rr)4.438 G -8.328(mm)4.438 G -4.438(cc)8.328 G -4.998 +(aa)4.438 G -5.558(pp)4.998 G F1 2.106(\(5\), much information w)5.558 F(as)-.1 +E .391(made a)72 124.2 R -.25(va)-.2 G .391(ilable to the programmer).25 F +2.891(,b)-.4 G .391(ut little w)220.095 124.2 R .391(ork w)-.1 F .391(as tak) +-.1 F .39(en out of one')-.1 F 2.89(sh)-.55 G 2.89(ands. The)374.02 124.2 R .39 +(purpose of this pack-)2.89 F .821(age is to allo)72 136.2 R 3.321(wt)-.25 G +.822(he C programmer to do the most common type of terminal dependent function\ +s, those of)138.364 136.2 R(mo)72 148.2 Q -.15(ve)-.15 G .45 +(ment optimization and optimal screen updating, without doing an).15 F 2.95(yo) +-.15 G 2.95(ft)371.7 148.2 S .45(he dirty w)380.76 148.2 R .45 +(ork, and with nearly)-.1 F +(as much ease as is necessary to simply print or read things.)72 160.2 Q F0 +-4.998(11)72 184.2 S -2.498(..)4.998 G -4.998(11)2.498 G 7.496 -2.498(.. T) +4.998 H -.92(Te)92.01 184.2 S(er)97.762 184.2 Q(rm)102.204 184.2 Q(mi)106.646 +184.2 Q(in)114.978 184.2 Q(no)117.76 184.2 Q(ol)123.322 184.2 Q(lo)128.324 +184.2 Q(og)131.106 184.2 Q(gy)136.108 184.2 Q(y)141.11 184.2 Q F1 +(In this document, the follo)97 200.4 Q(wing terminology is used:)-.25 E F0 +-7.218(ww)72 224.4 S -2.778(ii)7.218 G -5.558(nn)2.778 G -5.558(dd)5.558 G +7.396 -4.998(oo w)5.558 H(w)98.032 224.4 Q F1 2.843(:A)C 2.843(ni)118.095 224.4 +S .343(nternal representation containing an image of what a section of the ter\ +minal screen may look)128.718 224.4 R(lik)97 236.4 Q 3.322(ea)-.1 G 3.322(ts) +119.662 236.4 S .822(ome point in time.)129.654 236.4 R .821 +(This subsection can either encompass the entire terminal screen, or an)5.821 F +(y)-.15 E(smaller portion do)97 248.4 Q +(wn to a single character within that screen.)-.25 E F0 -3.328(tt)72 272.4 S +-4.438(ee)3.328 G -4.438(rr)4.438 G -8.328(mm)4.438 G -2.778(ii)8.328 G -5.558 +(nn)2.778 G -4.998(aa)5.558 G -2.778(ll)4.998 G F1 3.248(:S)2.778 G .748 +(ometimes called)120.264 272.4 R F0 -3.328(tt)3.248 G -4.438(ee)3.328 G -4.438 +(rr)4.438 G -8.328(mm)4.438 G -2.778(ii)8.328 G -5.558(nn)2.778 G -4.998(aa) +5.558 G 6.304 -2.778(ll s)4.998 H(sc)-1.11 E(cr)233.348 272.4 Q -.18(re)237.79 +272.4 S(ee)242.052 272.4 Q(en)246.494 272.4 Q(n)250.936 272.4 Q F1 5.748(.T)C +.748(he package')270.854 272.4 R 3.248(si)-.55 G .748 +(dea of what the terminal')329 272.4 R 3.249(ss)-.55 G .749(creen currently) +443.001 272.4 R(looks lik)97 284.4 Q(e,)-.1 E/F2 10/Times-Italic@0 SF(i.e)2.5 E +(.)-.15 E F1 2.5(,w)C(hat the user sees no)165.36 284.4 Q 3.8 -.65(w. T)-.25 H +(his is a special).65 E F2(scr)2.5 E(een)-.37 E F1(:)A F0 -3.888(ss)72 308.4 S +-4.438(cc)3.888 G 6.196 -4.438(rr ee)4.438 H -4.438(ee)4.438 G -5.558(nn)4.438 +G F1 2.524(:T)5.558 G .024(his is a subset of windo)110.456 308.4 R .023 +(ws which are as lar)-.25 F .023(ge as the terminal screen,)-.18 F F2(i.e)2.523 +E(.)-.15 E F1 2.523(,t)C(he)404.335 308.4 Q 2.523(ys)-.15 G .023 +(tart at the upper left)425.038 308.4 R .729(hand corner and encompass the lo) +97 320.4 R .729(wer right hand corner)-.25 F 5.729(.O)-.55 G .729(ne of these,) +339.641 320.4 R F2(stdscr)3.23 E F1 3.23(,i)C 3.23(sa)422.55 320.4 S .73 +(utomatically pro-)434.11 320.4 R(vided for the programmer)97 332.4 Q(.)-.55 E +F0 -4.998(11)72 356.4 S -2.498(..)4.998 G -4.998(22)2.498 G 7.496 -2.498(.. C) +4.998 H(Co)92.01 356.4 Q(om)99.232 356.4 Q(mp)104.234 356.4 Q(pi)112.566 356.4 +Q(il)118.128 356.4 Q(li)120.91 356.4 Q(in)123.692 356.4 Q(ng)126.474 356.4 Q +2.5(gA)132.036 356.4 S -.25(Ap)139.538 356.4 S(pp)146.51 356.4 Q(pl)152.072 +356.4 Q(li)157.634 356.4 Q(ic)160.416 356.4 Q(ca)163.198 356.4 Q(at)167.64 +356.4 Q(ti)172.642 356.4 Q(io)175.974 356.4 Q(on)178.756 356.4 Q(ns)183.758 +356.4 Q(s)189.32 356.4 Q F1 .487(In order to use the library)97 372.6 R 2.987 +(,i)-.65 G 2.987(ti)208.973 372.6 S 2.987(sn)217.52 372.6 S .487 +(ecessary to ha)229.397 372.6 R .787 -.15(ve c)-.2 H .487(ertain types and v) +.15 F .487(ariables def)-.25 F 2.987(ined. Therefore,)-.2 F(the)2.987 E +(programmer must ha)72 384.6 Q .3 -.15(ve a l)-.2 H(ine:).15 E F0 -4.998(##)112 +400.8 S -2.778(ii)4.998 G -5.558(nn)2.778 G -4.438(cc)5.558 G -2.778(ll)4.438 G +-5.558(uu)2.778 G -5.558(dd)5.558 G 8.876 -4.438(ee <)5.558 H(<c)-1.26 E(cu) +156.34 400.8 Q(ur)160.782 400.8 Q(rs)166.344 400.8 Q(se)170.786 400.8 Q(es) +174.678 400.8 Q(s.)179.12 400.8 Q(.h)183.012 400.8 Q(h>)185.514 400.8 Q(>) +191.076 400.8 Q F1(at the top of the program source.)72 417 Q +(Compilations should ha)5 E .3 -.15(ve t)-.2 H(he follo).15 E(wing form:)-.25 E +F0 -4.438(cc)112 433.2 S -4.438(cc)4.438 G F1([)6.938 E F2(fla)2.5 E(gs)-.1 E +F1 2.5(]f)2.5 G(ile ...)160.024 433.2 Q F0 -5.698<adad>2.5 G -2.778(ll)5.698 G +-4.438(cc)2.778 G -5.558(uu)4.438 G -4.438(rr)5.558 G -3.888(ss)4.438 G -4.438 +(ee)3.888 G 7.776 -3.888(ss \255)4.438 H<ad6c>-1.81 E(lt)225.884 433.2 Q(te) +228.666 433.2 Q(er)231.998 433.2 Q(rm)236.44 433.2 Q(mc)240.882 433.2 Q(ca) +249.214 433.2 Q(ap)253.656 433.2 Q(p)258.658 433.2 Q -4.998(11)72 461.4 S +-2.498(..)4.998 G -4.998(33)2.498 G 7.496 -2.498(.. S)4.998 H(Sc)92.01 461.4 Q +(cr)97.572 461.4 Q -.18(re)102.014 461.4 S(ee)106.276 461.4 Q(en)110.718 461.4 +Q 2.5(nU)115.16 461.4 S(Up)123.222 461.4 Q(pd)130.444 461.4 Q(da)136.006 461.4 +Q(at)141.568 461.4 Q(ti)146.57 461.4 Q(in)149.902 461.4 Q(ng)152.684 461.4 Q(g) +158.246 461.4 Q F1 .562(In order to update the screen optimally)97 477.6 R +3.063(,i)-.65 G 3.063(ti)263.037 477.6 S 3.063(sn)271.66 477.6 S .563 +(ecessary for the routines to kno)283.613 477.6 R 3.063(ww)-.25 G .563 +(hat the screen cur)428.931 477.6 R(-)-.2 E .578(rently looks lik)72 489.6 R +3.078(ea)-.1 G .578(nd what the programmer w)145.574 489.6 R .578 +(ants it to look lik)-.1 F 3.078(en)-.1 G -.15(ex)338.616 489.6 S 3.078(t. F) +.15 F .578(or this purpose, a data type \(struc-)-.15 F 1.163(ture\) named)72 +501.6 R F2(WINDO)3.663 E(W)-.5 E F1 1.163(is def)3.663 F 1.163 +(ined which describes a windo)-.2 F 3.663(wi)-.25 G 1.164 +(mage to the routines, including its starting)328.407 501.6 R 1.449 +(position on the screen \(the \(y)72 513.6 R 2.5(,x)-.65 G 3.949(\)c)204.965 +513.6 S 1.449(o-ordinates of the upper left hand corner\) and its size.)216.684 +513.6 R 1.448(One of these)6.449 F(\(called)72 525.6 Q F2(cur)4.043 E(scr)-.1 E +F1(for)4.043 E F2(curr)4.043 E 1.543(ent scr)-.37 F(een)-.37 E F1 4.044(\)i)C +4.044(sas)217.446 525.6 S 1.544 +(creen image of what the terminal currently looks lik)237.754 525.6 R 4.044 +(e. Another)-.1 F(screen \(called)72 537.6 Q F2(stdscr)2.5 E F1 2.5(,f)C(or) +161.97 537.6 Q F2(standar)2.5 E 2.5(ds)-.37 G(cr)214.38 537.6 Q(een)-.37 E F1 +2.5(\)i)C 2.5(sp)244.83 537.6 S(ro)256.22 537.6 Q(vided by def)-.15 E +(ault to mak)-.1 E 2.5(ec)-.1 G(hanges on.)370.57 537.6 Q 2.775(Aw)97 553.8 S +(indo)114.215 553.8 Q 2.775(wi)-.25 G 2.775(sap)144.52 553.8 S .274 +(urely internal representation.)163.4 553.8 R .274(It is used to b)5.274 F .274 +(uild and store a potential image of a por)-.2 F(-)-.2 E .96 +(tion of the terminal.)72 565.8 R .96(It doesn')5.96 F 3.46(tb)-.18 G .96 +(ear an)207.57 565.8 R 3.46(yn)-.15 G .96 +(ecessary relation to what is really on the terminal screen.)245.99 565.8 R .96 +(It is)5.96 F(more lik)72 577.8 Q 2.5(ea)-.1 G 2.5(na)116.89 577.8 S +(rray of characters on which to mak)128.83 577.8 Q 2.5(ec)-.1 G(hanges.)279.51 +577.8 Q .828(When one has a windo)97 594 R 3.328(ww)-.25 G .827 +(hich describes what some part the terminal should look lik)208.92 594 R .827 +(e, the routine)-.1 F/F3 10/Courier-Bold@0 SF(refresh)72 606 Q F1 .146 +(\(\) \(or)B F3(wrefresh)2.646 E F1 .146(\(\) if the windo)B 2.646(wi)-.25 G +2.646(sn)255.936 606 S(ot)267.472 606 Q F2(stdscr)2.646 E F1 2.646(\)i)C 2.646 +(sc)310.544 606 S(alled.)321.52 606 Q F3(Refresh)5.146 E F1 .146(\(\) mak)B +.147(es the terminal, in the)-.1 F .231(area co)72 618 R -.15(ve)-.15 G .231 +(red by the windo).15 F 1.531 -.65(w, l)-.25 H .231(ook lik).65 F 2.731(et)-.1 +G .231(hat windo)230.617 618 R 4.031 -.65(w. N)-.25 H .23 +(ote, therefore, that changing something on a windo).65 F(w)-.25 E F2(does)72 +630 Q/F4 10/Times-BoldItalic@0 SF(not)2.936 E F2 -.15(ch)2.936 G(ang).15 E +2.936(et)-.1 G .436(he terminal)143.888 630 R F1 5.436(.A)C .436 +(ctual updates to the terminal screen are made only by calling)205.31 630 R F3 +(refresh)2.937 E F1(\(\))A(or)72 642 Q F3(wrefresh)3.228 E F1 3.228(\(\). This) +B(allo)3.228 E .728(ws the programmer to maintain se)-.25 F -.15(ve)-.25 G .727 +(ral dif).15 F .727(ferent ideas of what a portion of the)-.25 F .888 +(terminal screen should look lik)72 654 R 3.389(e. Also,)-.1 F .889 +(changes can be made to windo)3.389 F .889(ws in an)-.25 F 3.389(yo)-.15 G +(rder)411.953 654 Q 3.389(,w)-.4 G .889(ithout re)440.762 654 R -.05(ga)-.15 G +.889(rd to).05 F .214(motion ef)72 666 R -.2(fi)-.25 G(cienc).2 E 4.014 -.65 +(y. T)-.15 H .214(hen, at will, the programmer can ef).65 F(fecti)-.25 E -.15 +(ve)-.25 G .214(ly say \231mak).15 F 2.713(ei)-.1 G 2.713(tl)382.002 666 S .213 +(ook lik)390.275 666 R 2.713(et)-.1 G .213(his\232, and the pack-)428.381 666 R +(age will e)72 678 Q -.15(xe)-.15 G(cute the changes in an optimal w).15 E(ay) +-.1 E(.)-.65 E EP +%%Page: 4 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G 334.474 +-4.998(44 S)3.328 H(Sc)-.56 E(cr)442.888 60 Q -.18(re)447.33 60 S(ee)451.592 60 +Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 60 S(ac)474.55 60 Q(ck) +479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 60 Q(e)499.56 60 Q +-4.998(11)72 96 S -2.498(..)4.998 G -4.998(44)2.498 G 7.496 -2.498(.. N)4.998 H +(Na)92.01 96 Q(am)99.232 96 Q(mi)104.234 96 Q(in)112.566 96 Q(ng)115.348 96 Q +2.5(gC)120.91 96 S(Co)128.412 96 Q(on)135.634 96 Q -.4(nv)140.636 96 S -.1(ve) +145.798 96 S(en)150.7 96 Q(nt)155.142 96 Q(ti)160.704 96 Q(io)164.036 96 Q(on) +166.818 96 Q(ns)171.82 96 Q(s)177.382 96 Q/F1 10/Times-Roman@0 SF .133 +(As hinted abo)97 112.2 R -.15(ve)-.15 G 2.633(,t).15 G .133 +(he routines can use se)169.869 112.2 R -.15(ve)-.25 G .133(ral windo).15 F +.133(ws, b)-.25 F .133(ut tw)-.2 F 2.633(oa)-.1 G .133(re al)358.003 112.2 R +-.1(wa)-.1 G .133(ys a).1 F -.25(va)-.2 G(ilable:).25 E/F2 10/Times-Italic@0 SF +(cur)2.633 E(scr)-.1 E F1 2.634(,w)C .134(hich is)477.476 112.2 R .07 +(the image of what the terminal looks lik)72 124.2 R 2.57(ea)-.1 G 2.57(tp) +243.55 124.2 S .07(resent, and)253.9 124.2 R F2(stdscr)2.57 E F1 2.57(,w)C .07 +(hich is the image of what the programmer)336.04 124.2 R -.1(wa)72 136.2 S .496 +(nts the terminal to look lik).1 F 2.996(en)-.1 G -.15(ex)204.214 136.2 S 2.996 +(t. The).15 F .496(user should not access)2.996 F F2(cur)2.996 E(scr)-.1 E F1 +(directly)2.996 E 5.496(.C)-.65 G .496(hanges should be made)409.472 136.2 R +(to the appropriate screen, and then the routine)72 148.2 Q/F3 10 +/Courier-Bold@0 SF(refresh)2.5 E F1(\(\) \(or)A F3(wrefresh)2.5 E F1 +(\(\)\) should be called.)A(Man)97 164.4 Q 2.903(yf)-.15 G .402 +(unctions are set up to deal with)126.413 164.4 R F2(stdscr)2.902 E F1 .402 +(as a def)2.902 F .402(ault screen.)-.1 F -.15(Fo)5.402 G 2.902(re).15 G .402 +(xample, to add a character to)386.47 164.4 R F2(stdscr)72 176.4 Q F1 2.76(,o)C +.26(ne calls)106.15 176.4 R F3(addch)2.76 E F1 .26 +(\(\) with the desired character)B 5.26(.I)-.55 G 2.761(fad)293.2 176.4 S(if) +311.492 176.4 Q .261(ferent windo)-.25 F 2.761(wi)-.25 G 2.761(st)380.944 176.4 +S 2.761(ob)390.375 176.4 S 2.761(eu)403.136 176.4 S .261(sed, the routine) +415.337 176.4 R F3(wad-)2.761 E(dch)72 190.4 Q F1 .539(\(\) \(for)B F0 -7.218 +(ww)3.039 G F1(indo)7.218 E(w-specif)-.25 E(ic)-.2 E F3(addch)3.039 E F1 .539 +(\(\)\) is pro)B(vided)-.15 E/F4 7/Times-Roman@0 SF(1)275.106 186.4 Q F1 5.538 +(.T)278.606 190.4 S .538(his con)292.754 190.4 R -.15(ve)-.4 G .538 +(ntion of prepending function names with a).15 F<99>72 202.4 Q F0 -7.218(ww)C +F1 2.887<9a77>7.218 G .387(hen the)98.209 202.4 R 2.887(ya)-.15 G .388 +(re to be applied to specif)139.933 202.4 R .388(ic windo)-.2 F .388 +(ws is consistent.)-.25 F .388(The only routines which do)5.388 F F2(not)2.888 +E F1 .388(do this)2.888 F(are those to which a windo)72 214.4 Q 2.5(wm)-.25 G +(ust al)196.73 214.4 Q -.1(wa)-.1 G(ys be specif).1 E(ied.)-.2 E .815 +(In order to mo)97 230.6 R 1.115 -.15(ve t)-.15 H .815(he current \(y).15 F 2.5 +(,x)-.65 G 3.315(\)c)234.24 230.6 S .815(o-ordinates from one point to another) +245.325 230.6 R 3.315(,t)-.4 G .815(he routines)407.295 230.6 R F3(move)3.315 E +F1 .815(\(\) and)B F3(wmove)72 242.6 Q F1 .722(\(\) are pro)B 3.222(vided. Ho) +-.15 F(we)-.25 E -.15(ve)-.25 G 1.522 -.4(r, i).15 H 3.222(ti).4 G 3.222(so) +223.82 242.6 S .722(ften desirable to f)235.932 242.6 R .723(irst mo)-.2 F +1.023 -.15(ve a)-.15 H .723(nd then perform some I/O operation.).15 F .695 +(In order to a)72 254.6 R -.2(vo)-.2 G .695 +(id clumsiness, most I/O routines can be preceded by the pref).2 F .695 +(ix \231)-.2 F F0 -8.328(mm)C -4.998(vv)8.328 G F1 3.194<9a61>4.998 G .694 +(nd the desired \(y)422.308 254.6 R 2.5(,x)-.65 G(\))500.67 254.6 Q +(co-ordinates can then be added to the ar)72 266.6 Q(guments to the function.) +-.18 E -.15(Fo)5 G 2.5(re).15 G(xample, the calls)353.69 266.6 Q(mo)112 282.8 Q +-.15(ve)-.15 G(\(y).15 E 2.5(,x)-.65 G(\);)151.6 282.8 Q(addch\(ch\);)112 294.8 +Q(can be replaced by)72 311 Q(mv)112 327.2 Q(addch\(y)-.25 E 2.5(,x)-.65 G 2.5 +(,c)166.09 327.2 S(h\);)175.53 327.2 Q(and)72 343.4 Q(wmo)112 359.6 Q -.15(ve) +-.15 G(\(win, y).15 E 2.5(,x)-.65 G(\);)178.82 359.6 Q -.1(wa)112 371.6 S +(ddch\(win, ch\);).1 E(can be replaced by)72 387.8 Q(mvw)112 404 Q +(addch\(win, y)-.1 E 2.5(,x)-.65 G 2.5(,c)193.46 404 S(h\);)202.9 404 Q 1.086 +(Note that the windo)72 420.2 R 3.586(wd)-.25 G 1.086(escription pointer \() +169.974 420.2 R F2(win)A F1 3.586(\)c)C 1.086(omes before the added \(y)274.052 +420.2 R 2.5(,x)-.65 G 3.586(\)c)388.826 420.2 S 3.586(o-ordinates. If)400.182 +420.2 R 3.586(aw)3.586 G(indo)479.25 420.2 Q(w)-.25 E +(pointer is needed, it is al)72 432.2 Q -.1(wa)-.1 G(ys the f).1 E +(irst parameter passed.)-.2 E F0 -4.998(22)72 456.2 S 7.496 -2.498(.. V)4.998 H +-.92(Va)84.506 456.2 S(ar)90.808 456.2 Q(ri)95.81 456.2 Q(ia)100.252 456.2 Q +(ab)103.034 456.2 Q(bl)108.036 456.2 Q(le)113.598 456.2 Q(es)116.38 456.2 Q(s) +120.822 456.2 Q F1(Man)97 472.4 Q 2.64(yv)-.15 G .139 +(ariables which are used to describe the terminal en)127.57 472.4 R .139 +(vironment are a)-.4 F -.25(va)-.2 G .139(ilable to the programmer).25 F(.)-.55 +E(The)72 484.4 Q 2.5(ya)-.15 G(re:)99.34 484.4 Q 61.28(type name)112 504.8 R +(description)254 504.8 Q .4 LW 504 509.3 112 509.3 DL(WINDO)112 518.8 Q(W)-.35 +E/F5 10/Symbol SF(*)2.5 E F1(curscr)193 518.8 Q(current v)254 518.8 Q +(ersion of the screen \(terminal screen\).)-.15 E(WINDO)112 530.8 Q(W)-.35 E F5 +(*)2.5 E F1(stdscr)193 530.8 Q(standard screen.)254 530.8 Q +(Most updates are usually done here.)5 E(char)112 542.8 Q F5(*)2.5 E F1(Def)193 +542.8 Q F5(-)207.99 547.8 Q F1(term)213.48 542.8 Q(def)254 542.8 Q +(ault terminal type if type cannot be determined)-.1 E 60.72(bool My)112 554.8 +R F5(-)206.89 559.8 Q F1(term)212.38 554.8 Q .698(use the terminal specif)254 +554.8 R .699(ication in)-.2 F F2(Def)3.199 E F5(-)401.993 559.8 Q F2(term) +407.483 554.8 Q F1 .699(as terminal, irrele-)3.199 F -.25(va)254 566.8 S +(nt of real terminal type).25 E(char)112 578.8 Q F5(*)2.5 E F1(ttytype)193 +578.8 Q(full name of the current terminal.)254 578.8 Q 67.94(int LINES)112 +590.8 R(number of lines on the terminal)254 590.8 Q 67.94(int COLS)112 602.8 R +(number of columns on the terminal)254 602.8 Q 67.94(int ERR)112 614.8 R +(error flag returned by routines on a f)254 614.8 Q(ail.)-.1 E 67.94(int OK)112 +626.8 R(flag returned by routines upon success.)254 626.8 Q F0 -4.998(33)72 +651.4 S 7.496 -2.498(.. U)4.998 H(Us)84.506 651.4 Q(sa)91.728 651.4 Q(ag)95.62 +651.4 Q(ge)100.622 651.4 Q(e)105.624 651.4 Q F1 .314 +(This is a description of ho)97 667.6 R 2.814(wt)-.25 G 2.814(oa)215.294 667.6 +S .314(ctually use the screen package.)227.548 667.6 R -.15(Fo)5.313 G 2.813 +(rs).15 G(implicity)378.128 667.6 Q 2.813(,w)-.65 G 2.813(ea)426.131 667.6 S +.313(ssume all updat-)437.824 667.6 R(ing, reading, etc.)72 679.6 Q +(is applied to)5 E F2(stdscr)2.5 E F1 2.5(,a)C(lthough a dif)228.65 679.6 Q +(ferent windo)-.25 E 2.5(wc)-.25 G(an of course be specif)344.24 679.6 Q(ied.) +-.2 E .32 LW 76 689.2 72 689.2 DL 80 689.2 76 689.2 DL 84 689.2 80 689.2 DL 88 +689.2 84 689.2 DL 92 689.2 88 689.2 DL 96 689.2 92 689.2 DL 100 689.2 96 689.2 +DL 104 689.2 100 689.2 DL 108 689.2 104 689.2 DL 112 689.2 108 689.2 DL 116 +689.2 112 689.2 DL 120 689.2 116 689.2 DL 124 689.2 120 689.2 DL 128 689.2 124 +689.2 DL 132 689.2 128 689.2 DL 136 689.2 132 689.2 DL 140 689.2 136 689.2 DL +144 689.2 140 689.2 DL 148 689.2 144 689.2 DL 152 689.2 148 689.2 DL 156 689.2 +152 689.2 DL 160 689.2 156 689.2 DL 164 689.2 160 689.2 DL 168 689.2 164 689.2 +DL 172 689.2 168 689.2 DL 176 689.2 172 689.2 DL 180 689.2 176 689.2 DL 184 +689.2 180 689.2 DL 188 689.2 184 689.2 DL 192 689.2 188 689.2 DL 196 689.2 192 +689.2 DL 200 689.2 196 689.2 DL 204 689.2 200 689.2 DL 208 689.2 204 689.2 DL +212 689.2 208 689.2 DL 216 689.2 212 689.2 DL/F6 5/Times-Roman@0 SF(1)93.6 +699.6 Q/F7 8/Times-Roman@0 SF(Actually)2 3.2 M(,)-.52 E/F8 8/Courier-Bold@0 SF +(addch)2 E F7(\(\) is really a \231#def)A(ine\232 macro with ar)-.16 E +(guments, as are most of the "functions" which act upon)-.144 E/F9 8 +/Times-Italic@0 SF(stdscr)2 E F7(.)A EP +%%Page: 5 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 326.978(eP) +134.236 60 S(PS)465.656 60 Q(S1)471.768 60 Q(1:)477.33 60 Q(:1)482.332 60 Q(19) +485.664 60 Q(9-)490.666 60 Q(-5)495.668 60 Q(5)499 60 Q -4.998(33)72 96 S +-2.498(..)4.998 G -4.998(11)2.498 G 7.496 -2.498(.. I)4.998 H(In)-1.39 E(ni) +95.902 96 Q(it)101.464 96 Q(ti)104.246 96 Q(ia)107.578 96 Q(al)110.36 96 Q(li) +115.362 96 Q(iz)118.144 96 Q(za)120.926 96 Q(at)125.368 96 Q(ti)130.37 96 Q(io) +133.702 96 Q(on)136.484 96 Q(n)141.486 96 Q/F1 10/Times-Roman@0 SF 1.211 +(In order to use the screen package, the routines must kno)97 112.2 R 3.712(wa) +-.25 G 1.212(bout terminal characteristics, and the)351.682 112.2 R 1.364 +(space for)72 124.2 R/F2 10/Times-Italic@0 SF(cur)3.864 E(scr)-.1 E F1(and) +3.864 E F2(stdscr)3.864 E F1 1.364(must be allocated.)3.864 F 1.364 +(These functions are performed by)6.364 F/F3 10/Courier-Bold@0 SF(initscr)3.864 +E F1 3.864(\(\). Since)B(it)3.864 E 1.009(must allocate space for the windo)72 +136.2 R 1.009(ws, it can o)-.25 F -.15(ve)-.15 G(rflo).15 E 3.509(wc)-.25 G +1.009(ore when attempting to do so.)298.009 136.2 R 1.009(On this rather rare) +6.009 F(occasion,)72 148.2 Q F3(initscr)3.392 E F1 .892(\(\) returns ERR.)B F3 +(Initscr)5.892 E F1 .892(\(\) must)B/F4 10/Times-BoldItalic@0 SF(alw)3.392 E +(ays)-.1 E F1 .891(be called before an)3.391 F 3.391(yo)-.15 G 3.391(ft)421.617 +148.2 S .891(he routines which)431.118 148.2 R(af)72 160.2 Q .34(fect windo) +-.25 F .34(ws are used.)-.25 F .34 +(If it is not, the program will core dump as soon as either)5.34 F F2(cur)2.84 +E(scr)-.1 E F1(or)2.84 E F2(stdscr)2.84 E F1 .34(are ref-)2.84 F 3.65 +(erenced. Ho)72 172.2 R(we)-.25 E -.15(ve)-.25 G 1.95 -.4(r, i).15 H 3.65(ti).4 +G 3.65(su)165.48 172.2 S 1.15(sually best to w)178.02 172.2 R 1.15 +(ait to call it until after you are sure you will need it, lik)-.1 F 3.65(ea) +-.1 G(fter)490.12 172.2 Q 1.102(checking for startup errors.)72 184.2 R -.7(Te) +6.102 G 1.102(rminal status changing routines lik).7 F(e)-.1 E F3(nl)3.602 E F1 +1.102(\(\) and)B F3(cbreak)3.602 E F1 1.103(\(\) should be called)B(after)72 +196.2 Q F3(initscr)2.5 E F1(\(\).)A .68(After the initial windo)97 212.4 R +3.179(wa)-.25 G .679(llocation done by)202.789 212.4 R F3(initscr)3.179 E F1 +.679(\(\), specif)B .679(ic windo)-.2 F 3.179(wc)-.25 G .679 +(haracteristics can be set.)404.773 212.4 R .834 +(Scrolling can be enabled by calling)72 224.4 R F3(scrollok)3.334 E F1 3.334 +(\(\). If)B .834(you w)3.334 F .835 +(ant the cursor to be left after the last change,)-.1 F(use)72 236.4 Q F3 +(leaveok)3.767 E F1 3.767(\(\). If)B 1.267(this isn')3.767 F 3.767(td)-.18 G +(one,)201.535 236.4 Q F3(refresh)3.767 E F1 1.267(\(\) will mo)B 1.567 -.15 +(ve t)-.15 H 1.267(he cursor to the windo).15 F(w')-.25 E 3.767(sc)-.55 G 1.266 +(urrent \(y)438.808 236.4 R 2.5(,x)-.65 G 3.766(\)c)484.134 236.4 S(o-)495.67 +236.4 Q .061(ordinates after updating it.)72 248.4 R .061(Additional windo) +5.061 F .061(ws can be created by using the functions)-.25 F F3(newwin)2.562 E +F1 .062(\(\) and)B F3(sub-)2.562 E(win)72 260.4 Q F1(\(\).)A F3(Delwin)5.806 E +F1 .806(\(\) allo)B .806(ws you to delete an e)-.25 F .806(xisiting windo)-.15 +F 4.606 -.65(w. T)-.25 H .806(he v).65 F(ariables)-.25 E F2(LINES)3.306 E F1 +(and)3.306 E F2(COLS)3.306 E F1 .806(control the)3.306 F 1.012 +(size of the terminal.)72 272.4 R(The)6.012 E 3.512(ya)-.15 G 1.012 +(re initially implicitly set by)188.83 272.4 R F3(initscr)3.512 E F1 1.012 +(\(\), b)B 1.013(ut can be altered e)-.2 F 1.013(xplicitly by the)-.15 F .723 +(user follo)72 284.4 R .723(wed by a call to)-.25 F F3(initscr)3.223 E F1 3.223 +(\(\). Note)B .723(that an)3.223 F 3.223(yc)-.15 G .723(all to)299.68 284.4 R +F3(initscr)3.223 E F1 .723(\(\), will al)B -.1(wa)-.1 G .723(ys delete an).1 F +3.222(ye)-.15 G(xisting)476.77 284.4 Q F2(stdscr)72 296.4 Q F1(and/or)5.142 E +F2(cur)5.142 E(scr)-.1 E F1 2.642(before creating ne)5.142 F 5.142(wo)-.25 G +2.643(nes so this change is best done before the initial call to)256.902 296.4 +R F3(initscr)72 308.4 Q F1(\(\).)A F0 -4.998(33)72 324.6 S -2.498(..)4.998 G +-4.998(22)2.498 G 7.496 -2.498(.. O)4.998 H(Ou)92.01 324.6 Q(ut)99.792 324.6 Q +(tp)105.354 324.6 Q(pu)108.686 324.6 Q(ut)114.248 324.6 Q(t)119.81 324.6 Q F1 +.763(The basic functions used to change what will go on a windo)97 340.8 R +3.263(wa)-.25 G(re)359.758 340.8 Q F3(addch)3.263 E F1 .763(\(\) and)B F3(move) +3.263 E F1(\(\).)A F3(Addch)5.763 E F1(\(\))A .585 +(adds a character at the current \(y)72 352.8 R 2.5(,x)-.65 G 3.085(\)c)215.36 +352.8 S .585(o-ordinates, returning ERR if it w)226.215 352.8 R .586 +(ould cause the windo)-.1 F 3.086(wt)-.25 G 3.086(oi)463.334 352.8 S(lle)474.2 +352.8 Q -.05(ga)-.15 G(lly).05 E(scroll,)72 364.8 Q F2(i.e)3.315 E(.)-.15 E F1 +3.315(,p)C .815(rinting a character in the lo)122.92 364.8 R .815 +(wer right-hand corner of a terminal which automatically scrolls if)-.25 F .575 +(scrolling is not allo)72 376.8 R(wed.)-.25 E F3(Move)5.575 E F1 .575 +(\(\) changes the current \(y)B 2.5(,x)-.65 G 3.075(\)c)308.55 376.8 S .575 +(o-ordinates to whate)319.395 376.8 R -.15(ve)-.25 G 3.075(ry).15 G .575(ou w) +422.64 376.8 R .575(ant them to be.)-.1 F 1.258 +(It returns ERR if you try to mo)72 388.8 R 1.557 -.15(ve o)-.15 H 1.757 -.25 +(ff t).15 H 1.257(he windo).25 F 5.057 -.65(w. A)-.25 H 3.757(sm).65 G 1.257 +(entioned abo)311.181 388.8 R -.15(ve)-.15 G 3.757(,y).15 G 1.257 +(ou can combine the tw)384.215 388.8 R 3.757(oi)-.1 G(nto)491.22 388.8 Q F3 +(mvaddch)72 400.8 Q F1(\(\) to do both things in one call.)A .394 +(The other output functions \(such as)97 417 R F3(addstr)2.894 E F1 .394 +(\(\) and)B F3(printw)2.894 E F1 .394(\(\)\) all call)B F3(addch)2.894 E F1 +.394(\(\) to add characters to)B(the windo)72 429 Q -.65(w.)-.25 G .194 +(After a change has been made to the windo)97 445.2 R 1.494 -.65(w, y)-.25 H +.193(ou must call).65 F F3(refresh)2.693 E F1 2.693(\(\). when)B .193(you w) +2.693 F .193(ant the portion)-.1 F 2.381(of the terminal co)72 457.2 R -.15(ve) +-.15 G 2.382(red by the windo).15 F 4.882(wt)-.25 G 4.882(or)248.372 457.2 S +2.382(eflect the change.)261.584 457.2 R 2.382(In order to optimize f)7.382 F +2.382(inding changes,)-.2 F F3(refresh)72 469.2 Q F1 .006(\(\) assumes that an) +B 2.506(yp)-.15 G .006(art of the windo)198.304 469.2 R 2.506(wn)-.25 G .006 +(ot changed since the last)276.398 469.2 R F3(refresh)2.506 E F1 .006 +(\(\) of that windo)B 2.505(wh)-.25 G(as)495.67 469.2 Q .049 +(not been changed on the terminal,)72 481.2 R F2(i.e)2.549 E(.)-.15 E F1 2.549 +(,t)C .049(hat you ha)230.223 481.2 R .349 -.15(ve n)-.2 H .05 +(ot refreshed a portion of the terminal with an o).15 F -.15(ve)-.15 G(rlap-) +.15 E .025(ping windo)72 493.2 R 3.825 -.65(w. I)-.25 H 2.525(ft).65 G .024 +(his is not the case, the routines)143.115 493.2 R F3(touchwin)2.524 E F1 +(\(\),)A F3(touchline)2.524 E F1 .024(\(\), and)B F3(touchoverlap)2.524 E F1 +.024(\(\) are)B(pro)72 505.2 Q .083(vided to mak)-.15 F 2.584(ei)-.1 G 2.584 +(tl)147.27 505.2 S .084(ook lik)155.414 505.2 R 2.584(ead)-.1 G .084 +(esired part of windo)202.506 505.2 R 2.584(wh)-.25 G .084 +(as been changed, thus forcing)297.572 505.2 R F3(refresh)2.584 E F1 .084 +(\(\) to check)B(that whole subsection of the terminal for changes.)72 517.2 Q +.695(If you call)97 533.4 R F3(wrefresh)3.195 E F1 .695(\(\) with)B F2(cur) +3.195 E(scr)-.1 E F1 3.195(,i)C 3.195(tw)255.44 533.4 S .695(ill mak)268.635 +533.4 R 3.194(et)-.1 G .694(he screen look lik)307.704 533.4 R 3.194(et)-.1 G +.694(he image of)390.92 533.4 R F2(cur)3.194 E(scr)-.1 E F1 5.694(.T)C .694 +(his is)482.466 533.4 R(useful for implementing a command which w)72 545.4 Q +(ould redra)-.1 E 2.5(wt)-.15 G(he screen in case it got messed up.)307.27 +545.4 Q F0 -4.998(33)72 569.4 S -2.498(..)4.998 G -4.998(33)2.498 G 7.496 +-2.498(.. I)4.998 H(In)-1.39 E(np)95.902 569.4 Q(pu)101.464 569.4 Q(ut)107.026 +569.4 Q(t)112.588 569.4 Q F1 .701 +(Input is essentially a mirror image of output.)97 585.6 R .702 +(The complementary function to)5.701 F F3(addch)3.202 E F1 .702(\(\) is)B F3 +(getch)3.202 E F1(\(\))A .051(which, if echo is set, will call)72 597.6 R F3 +(addch)2.551 E F1 .051(\(\) to echo the character)B 5.05(.S)-.55 G .05 +(ince the screen package needs to kno)327.01 597.6 R 2.55(ww)-.25 G(hat)491.78 +597.6 Q .255(is on the terminal at all times, if characters are to be echoed, \ +the tty must be in ra)72 609.6 R 2.755(wo)-.15 G 2.755(rc)414.135 609.6 S .255 +(break mode.)424.66 609.6 R .255(If it is)5.255 F(not,)72 621.6 Q F3(getch)2.5 +E F1(\(\) sets it to be cbreak, and then reads in the character)A(.)-.55 E F0 +-4.998(33)72 645.6 S -2.498(..)4.998 G -4.998(44)2.498 G 7.496 -2.498(.. T) +4.998 H -.92(Te)92.01 645.6 S(er)97.762 645.6 Q(rm)102.204 645.6 Q(mi)106.646 +645.6 Q(in)114.978 645.6 Q(na)117.76 645.6 Q(at)123.322 645.6 Q(ti)128.324 +645.6 Q(io)131.656 645.6 Q(on)134.438 645.6 Q(n)139.44 645.6 Q F1 .044 +(In order to perform certain optimizations, and, on some terminals, to w)97 +661.8 R .044(ork at all, some things must be)-.1 F .058 +(done before the screen routines start up.)72 673.8 R .059 +(These functions are performed in)5.059 F F3(getttmode)2.559 E F1 .059 +(\(\) and)B F3(setterm)2.559 E F1(\(\),)A .233(which are called by)72 685.8 R +F3(initscr)2.733 E F1 2.733(\(\). In)B .233 +(order to clean up after the routines, the routine)2.733 F F3(endwin)2.733 E F1 +.233(\(\) is pro)B(vided.)-.15 E .406(It restores tty modes to what the)72 +697.8 R 2.906(yw)-.15 G .406(ere when)217.732 697.8 R F3(initscr)2.906 E F1 +.407(\(\) w)B .407(as f)-.1 F .407(irst called.)-.2 F .407 +(The terminal state module uses)5.407 F .793(the v)72 709.8 R(ariable)-.25 E F2 +(cur)3.293 E(ses_termios)-.1 E F1 .793(to sa)3.293 F 1.093 -.15(ve t)-.2 H .793 +(he original terminal state which is then restored upon a call to).15 F F3 +(end-)3.292 E(win)72 721.8 Q F1 3.451(\(\). Thus,)B(an)3.451 E .951 +(ytime after the call to initscr)-.15 F(,)-.4 E F3(endwin)3.451 E F1 .952 +(\(\) should be called before e)B 3.452(xiting. Note)-.15 F(ho)3.452 E(we)-.25 +E -.15(ve)-.25 G -.4(r,).15 G EP +%%Page: 6 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G 334.474 +-4.998(66 S)3.328 H(Sc)-.56 E(cr)442.888 60 Q -.18(re)447.33 60 S(ee)451.592 60 +Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 60 S(ac)474.55 60 Q(ck) +479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 60 Q(e)499.56 60 Q/F1 +10/Times-Roman@0 SF(that)72 96 Q/F2 10/Courier-Bold@0 SF(endwin)3.338 E F1 .838 +(\(\) should al)B -.1(wa)-.1 G .838(ys be called).1 F F0 -5.558(bb)3.338 G +-4.438(ee)5.558 G 3.906 -3.328(ff o)4.438 H(or)-1.67 E -.18(re)255.338 96 S(e) +259.6 96 Q F1 .838(the f)3.338 F .838(inal calls to)-.2 F F2(delwin)3.337 E F1 +.837(\(\), which free the storage of the)B(windo)72 108 Q(ws.)-.25 E F0 -4.998 +(44)72 132 S 7.496 -2.498(.. C)4.998 H(Cu)84.506 132 Q(ur)91.728 132 Q(rs)97.29 +132 Q(so)101.732 132 Q(or)105.624 132 Q 2.5(rM)110.626 132 S(Mo)117.568 132 Q +-.1(ov)127.01 132 S -.1(ve)131.912 132 S(em)136.814 132 Q(me)141.256 132 Q(en) +149.588 132 Q(nt)154.03 132 Q 2.5(tO)159.592 132 S(Op)165.424 132 Q(pt)173.206 +132 Q(ti)178.768 132 Q(im)182.1 132 Q(mi)184.882 132 Q(iz)193.214 132 Q(za) +195.996 132 Q(at)200.438 132 Q(ti)205.44 132 Q(io)208.772 132 Q(on)211.554 132 +Q(ns)216.556 132 Q(s)222.118 132 Q F1 .168(One of the most dif)97 148.2 R -.2 +(fi)-.25 G .168(cult things to do properly is motion optimization.).2 F .168 +(After using)5.168 F F2(gettmode)2.668 E F1 .168(\(\) and)B F2(setterm)72 160.2 +Q F1 .367(\(\) to get the terminal descriptions, the function)B F2(mvcur)2.866 +E F1 .366(\(\) deals with this task.)B .366(It usage is simple:)5.366 F +(simply tell it where you are no)72 172.2 Q 2.5(wa)-.25 G(nd where you w)208.12 +172.2 Q(ant to go.)-.1 E -.15(Fo)5 G 2.5(re).15 G(xample)335.2 172.2 Q +(mvcur\(0, 0, LINES/2, COLS/2\);)112 188.4 Q -.1(wo)72 208.8 S .04(uld mo).1 F +.34 -.15(ve t)-.15 H .04(he cursor from the home position \(0,).15 F .04 +(0\) to the middle of the screen.)2.5 F .04(If you wish to force abso-)5.04 F +.684(lute addressing, you can use the function)72 220.8 R F2(tgoto)3.184 E F1 +.684(\(\) from the)B F0 -3.328(tt)3.184 G -4.438(ee)3.328 G -4.438(rr)4.438 G +-8.328(mm)4.438 G -2.778(ll)8.328 G -2.778(ii)2.778 G -5.558(bb)2.778 G F1 .684 +(\(7\) routines, or you can tell)5.558 F F2(mvcur)3.184 E F1(\(\))A 1.602 +(that you are impossibly f)72 232.8 R 1.602(ar a)-.1 F -.1(wa)-.15 G 2.902 -.65 +(y, F).1 H 1.602(or e).5 F 1.602(xample, to absolutely address the lo)-.15 F +1.603(wer left hand corner of the)-.25 F(screen from an)72 244.8 Q +(ywhere just claim that you are in the upper right hand corner:)-.15 E +(mvcur\(0, COLS\2551, LINES\2551, 0\);)112 261 Q F0 -4.998(55)72 289.2 S 7.496 +-2.498(.. C)4.998 H(Ch)84.506 289.2 Q(ha)91.728 289.2 Q(ar)97.29 289.2 Q(ra) +102.292 289.2 Q(ac)106.734 289.2 Q(ct)111.736 289.2 Q(te)116.178 289.2 Q(er) +119.51 289.2 Q 2.5(rO)123.952 289.2 S(Ou)130.894 289.2 Q(ut)138.676 289.2 Q(tp) +144.238 289.2 Q(pu)147.57 289.2 Q(ut)153.132 289.2 Q 2.5(ta)158.694 289.2 S(an) +164.526 289.2 Q(nd)169.528 289.2 Q 2.5(dS)175.09 289.2 S(Sc)183.152 289.2 Q(cr) +188.714 289.2 Q -.18(ro)193.156 289.2 S(ol)197.418 289.2 Q(ll)202.42 289.2 Q +(li)205.202 289.2 Q(in)207.984 289.2 Q(ng)210.766 289.2 Q(g)216.328 289.2 Q F1 +.01(The character output polic)97 305.4 R 2.51(yd)-.15 G .01 +(eals with the follo)214.64 305.4 R .01(wing problems.)-.25 F .01 +(First, where is the location of the cur)5.01 F(-)-.2 E +(sor after a character is printed, and secondly)72 317.4 Q 2.5(,w)-.65 G +(hen does the screen scroll if scrolling is enabled.)260.18 317.4 Q .007 +(In the normal case the characters are output as e)97 333.6 R .007 +(xpected, with the cursor occup)-.15 F .007(ying the position of the)-.1 F(ne) +72 345.6 Q 1.181(xt character to be output.)-.15 F(Ho)6.181 E(we)-.25 E -.15 +(ve)-.25 G 1.981 -.4(r, w).15 H 1.181 +(hen the cursor is on the last column of the line, the cursor will).4 F .129(r\ +emain on that position after the last character on the line is output and will\ + only assume the position on the)72 357.6 R(ne)72 369.6 Q(xt line when the ne) +-.15 E(xt character \(the f)-.15 E(irst on the ne)-.2 E(xt line\) is output.) +-.15 E(Lik)97 385.8 Q -.25(ew)-.1 G .226 +(ise, if scrolling is enabled, a scroll will be in).25 F -.2(vo)-.4 G -.1(ke).2 +G 2.726(do).1 G .226(nly when the f)332.632 385.8 R .226 +(irst character on he f)-.2 F .226(irst line)-.2 F .697 +(past the bottom line of the windo)72 397.8 R 3.197(wi)-.25 G 3.197(so)221.349 +397.8 S 3.197(utput. If)233.436 397.8 R .697 +(scrolling is not enabled the chracters will to be output to)3.197 F +(the bottom right corner of the windo)72 409.8 Q 2.5(ww)-.25 G +(hich is the cursor location.)234.23 409.8 Q .368(This polic)97 426 R 2.868(ya) +-.15 G(llo)149.806 426 Q .368(ws consistent beha)-.25 F .368 +(vior of the cursor at the boundary conditions.)-.2 F .367 +(Furthermore, it pre-)5.368 F -.15(ve)72 438 S .494(nts a scroll from happenin\ +g before it is actually needed \(the old package used to scroll when the botto\ +m).15 F(right position w)72 450 Q(as output a character\).)-.1 E +(As a precendent, it models the)5 E/F3 10/Times-Italic@0 SF(xterm)2.5 E F1 +(character output con)2.5 E -.15(ve)-.4 G(ntions.).15 E F0 -4.998(66)72 474 S +7.496 -2.498(.. T)4.998 H -.92(Te)84.506 474 S(er)90.258 474 Q(rm)94.7 474 Q +(mi)99.142 474 Q(in)107.474 474 Q(na)110.256 474 Q(al)115.818 474 Q 2.5(lS) +120.82 474 S(St)126.102 474 Q(ta)131.664 474 Q(at)134.996 474 Q(te)139.998 474 +Q 2.5(eH)143.33 474 S(Ha)150.272 474 Q(an)158.054 474 Q(nd)163.056 474 Q(dl) +168.618 474 Q(li)174.18 474 Q(in)176.962 474 Q(ng)179.744 474 Q(g)185.306 474 Q +F1 1.173(The v)97 490.2 R(ariable)-.25 E F3(cur)3.673 E(ses_termios)-.1 E F1 +1.173(contains the terminal state of the terminal.)3.673 F 1.172 +(Certain historical routines)6.172 F .301(return information:)72 502.2 R F2 +(baudrate)2.801 E F1(\(\),)A F2(erasechar)2.801 E F1(\(\),)A F2(killchar)2.801 +E F1 .301(\(\), and)B F2(ospeed)2.801 E F1 2.801(\(\). These)B .301 +(routines are obso-)2.801 F 1.059(lete and e)72 514.2 R 1.058 +(xist only for backw)-.15 F 1.058(ard compatibility)-.1 F 6.058(.I)-.65 G 3.558 +(fy)273.758 514.2 S 1.058(ou wish to use the information in the)285.646 514.2 R +F3(cur)3.558 E(ses_termios)-.1 E F1(structure, you should use the)72 526.2 Q F3 +(tsetattr)2.5 E F1(\(3\) routines.)A F0 -4.998(77)72 550.2 S 7.496 -2.498(.. S) +4.998 H(Su)84.506 550.2 Q(ub)90.068 550.2 Q(bw)95.63 550.2 Q(wi)101.192 550.2 Q +(in)108.414 550.2 Q(nd)111.196 550.2 Q(do)116.758 550.2 Q -.1(ow)122.32 550.2 S +(ws)127.222 550.2 Q(s)134.444 550.2 Q F1(Subwindo)97 566.4 Q 1.17(ws are windo) +-.25 F 1.17(ws which do not ha)-.25 F 1.471 -.15(ve a)-.2 H 3.671(ni).15 G +1.171(ndependent te)303.824 566.4 R 1.171(xt structure,)-.15 F F3(i.e)3.671 E +(.)-.15 E F1 3.671(,t)C(he)434.298 566.4 Q 3.671(ya)-.15 G 1.171(re windo) +456.699 566.4 R(ws)-.25 E .648(whose te)72 578.4 R .648 +(xt is a subset of the te)-.15 F .648(xt of a lar)-.15 F .647(ger windo)-.18 F +.647(w: the)-.25 F F3(par)3.147 E(ent)-.37 E F1(windo)3.147 E 4.447 -.65(w. O) +-.25 H .647(ne consequence of this is that).65 F .025 +(changes to either the parent or the child windo)72 590.4 R 2.525(wa)-.25 G +.025(re destructi)271.655 590.4 R .325 -.15(ve t)-.25 H 2.525(ot).15 G .025 +(he other)341.04 590.4 R(,)-.4 E F3(i.e)2.525 E(.)-.15 E F1 2.526(,ac)C .026 +(hange to the subwindo)406.682 590.4 R(w)-.25 E .391 +(is also a change to the parent windo)72 602.4 R 2.891(wa)-.25 G .391 +(nd a change to the parent windo)232.068 602.4 R 2.891(wi)-.25 G 2.891(nt) +374.805 602.4 S .391(he re)385.476 602.4 R .391(gion def)-.15 F .391 +(ined by the sub-)-.2 F(windo)72 614.4 Q 2.87(wi)-.25 G 2.87(si)109.62 614.4 S +.37(mplicitly a change to the subwindo)119.16 614.4 R 2.871(wa)-.25 G 2.871(sw) +275.562 614.4 S 2.871(ell. Apart)289.543 614.4 R .371 +(from this detail, subwindo)2.871 F .371(ws function lik)-.25 F(e)-.1 E(an)72 +626.4 Q 2.5(yo)-.15 G(ther windo)93.79 626.4 Q -.65(w.)-.25 G F0 -4.998(88)72 +650.4 S 7.496 -2.498(.. T)4.998 H(Th)84.506 650.4 Q(he)91.178 650.4 Q 2.5(eF) +96.74 650.4 S(Fu)103.682 650.4 Q(un)109.794 650.4 Q(nc)115.356 650.4 Q(ct) +120.918 650.4 Q(ti)125.36 650.4 Q(io)128.692 650.4 Q(on)131.474 650.4 Q(ns) +136.476 650.4 Q(s)142.038 650.4 Q F1 1.409(In the follo)97 666.6 R 1.409 +(wing def)-.25 F 1.409(initions, \231)-.2 F/F4 8/Times-Bold@0 SF -3.998<8787>C +F1 3.909<9a6d>3.998 G 1.408 +(eans that the \231function\232 is really a \231#def)241.477 666.6 R 1.408 +(ine\232 macro with ar)-.2 F(gu-)-.18 E(ments.)72 678.6 Q F2(addch)72 706.8 Q +F1(\()A F3 -.15(ch)C(ar c).15 E(h)-.15 E F1<293b87>A EP +%%Page: 7 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 326.978(eP) +134.236 60 S(PS)465.656 60 Q(S1)471.768 60 Q(1:)477.33 60 Q(:1)482.332 60 Q(19) +485.664 60 Q(9-)490.666 60 Q(-7)495.668 60 Q(7)499 60 Q/F1 10/Times-Roman@0 SF +.805(Add the character)97 96 R/F2 10/Times-Italic@0 SF -.15(ch)3.306 G F1 .806 +(on the windo)3.456 F 3.306(wa)-.25 G 3.306(tt)254.14 96 S .806(he current \(y) +263.006 96 R 2.5(,x)-.65 G 3.306(\)c)325.058 96 S 3.306(o-ordinates. If)336.134 +96 R .806(the character is a ne)3.306 F(wline)-.25 E 1.063 +(\(\264\\n\264\) the line will be cleared to the end, and the current \(y)97 +108 R 2.5(,x)-.65 G 3.563(\)c)351.546 108 S 1.062 +(o-ordinates will be changed to the)362.879 108 R(be)97 120 Q .221(ginning of) +-.15 F 2.721(ft)-.25 G .222(he ne)156.482 120 R .222(xt line if ne)-.15 F .222 +(wline mapping is on, or to the ne)-.25 F .222 +(xt line at the same x co-ordinate if it)-.15 F 1.682(is of)97 132 R 4.182 +(f. A)-.25 F 1.682(return \(\264\\r\264\) will mo)4.182 F 1.982 -.15(ve t)-.15 +H 4.182(ot).15 G 1.682(he be)252.106 132 R 1.681 +(ginning of the line on the windo)-.15 F 5.481 -.65(w. T)-.25 H 1.681 +(abs \(\264\\t\264\) will be)-.15 F -.15(ex)97 144 S .093 +(panded into spaces in the normal tabstop positions of e).15 F -.15(ve)-.25 G +.093(ry eight characters.).15 F .093(This returns ERR if it)5.093 F -.1(wo)97 +156 S(uld cause the screen to scroll ille).1 E -.05(ga)-.15 G(lly).05 E(.)-.65 +E/F3 10/Courier-Bold@0 SF(addstr)72 184.2 Q F1(\()A F2 -.15(ch)C(ar).15 E/F4 10 +/Symbol SF(*)2.5 E F2(str)A F1<293b87>A .164(Add the string pointed to by)97 +200.4 R F2(str)2.664 E F1 .163(on the windo)2.663 F 2.663(wa)-.25 G 2.663(tt) +292.826 200.4 S .163(he current \(y)301.049 200.4 R 2.5(,x)-.65 G 2.663(\)c) +361.815 200.4 S 2.663(o-ordinates. This)372.248 200.4 R .163(returns ERR if) +2.663 F(it w)97 212.4 Q(ould cause the screen to scroll ille)-.1 E -.05(ga)-.15 +G(lly).05 E 5(.I)-.65 G 2.5(nt)277.69 212.4 S +(his case, it will put on as much as it can.)287.97 212.4 Q F3(baudrate)72 +240.6 Q F1<28293b87>A 2.353(Returns the output baud rate of the terminal.)97 +256.8 R 2.354(This is a system dependent constant \(def)7.353 F 2.354(ined in) +-.2 F F0 -5.698(<<)97 268.8 S -3.888(ss)5.698 G -4.998(yy)3.888 G -3.888(ss) +4.998 G -2.778(//)3.888 G -3.328(tt)2.778 G -3.328(tt)3.328 G 6.796 -4.998 +(yy .)3.328 H(.h)2.5 E(h>)131.74 268.8 Q(>)137.302 268.8 Q F1 +(on BSD systems, which is included by)2.5 E F0 -5.698(<<)2.5 G -4.438(cc)5.698 +G -5.558(uu)4.438 G -4.438(rr)5.558 G -3.888(ss)4.438 G -4.438(ee)3.888 G +-3.888(ss)4.438 G -2.498(..)3.888 G -5.558(hh)2.498 G -5.698(>>)5.558 G F1(\).) +5.698 E F3(box)72 297 Q F1(\()A F2(WINDO)A 2.5(Ww)-.5 G(in)143.1 297 Q F1(,)A +F2 -.15(ch)2.5 G(ar vert).15 E F1(,)A F2 -.15(ch)2.5 G(ar hor).15 E F1(\);)A +(Dra)97 313.2 Q .079(ws a box around the windo)-.15 F 2.579(wu)-.25 G(sing) +234.824 313.2 Q F2(vert)2.578 E F1 .078(as the character for dra)2.578 F .078 +(wing the v)-.15 F .078(ertical sides, and)-.15 F F2(hor)2.578 E F1(for)2.578 E +(dra)97 325.2 Q 1.58(wing the horizontal lines.)-.15 F 1.58 +(If scrolling is not allo)6.58 F 1.58(wed, and the windo)-.25 F 4.08(we)-.25 G +1.58(ncompasses the lo)413.33 325.2 R(wer)-.25 E +(right-hand corner of the terminal, the corners are left blank to a)97 337.2 Q +-.2(vo)-.2 G(id a scroll.).2 E F3(cbreak)72 365.4 Q F1<28293b87>A +(Set or the terminal to cbreak mode.)97 381.6 Q F3(clear)72 409.8 Q F1 +<28293b87>A 1.131(Resets the entire windo)97 426 R 3.631(wt)-.25 G 3.631(ob) +207.374 426 S 3.631(lanks. If)221.005 426 R F2(win)3.631 E F1 1.13 +(is a screen, this sets the clear flag, which will cause a)3.631 F(clear)97 438 +Q .469(-screen sequence to be sent on the ne)-.2 F(xt)-.15 E F3(refresh)2.969 E +F1 .469(\(\) call.)B .47(This also mo)5.469 F -.15(ve)-.15 G 2.97(st).15 G .47 +(he current \(y)423.55 438 R 2.5(,x)-.65 G 2.97(\)c)484.93 438 S(o-)495.67 438 +Q(ordinates to \(0, 0\).)97 450 Q F3(clearok)72 478.2 Q F1(\()A F2(WINDO)A(W) +-.5 E F4(*)2.5 E F2(scr)A F1(,)A F2(int boolf)2.5 E F1<293b87>A .444 +(Sets the clear flag for the screen)97 494.4 R F2(scr)2.943 E F1 5.443(.I)C(f) +254.387 494.4 Q F2(boolf)2.943 E F1 .443(is non-zero, this will force a clear) +2.943 F .443(-screen to be printed)-.2 F 1.33(on the ne)97 506.4 R(xt)-.15 E F3 +(refresh)3.83 E F1 1.33(\(\), or stop it from doing so if)B F2(boolf)3.83 E F1 +1.33(is 0.)3.83 F 1.33(This only w)6.33 F 1.33(orks on screens, and,)-.1 F +(unlik)97 518.4 Q(e)-.1 E F3(clear)3.032 E F1 .531 +(\(\), does not alter the contents of the screen.)B(If)5.531 E F2(scr)3.031 E +F1(is)3.031 E F2(cur)3.031 E(scr)-.1 E F1 3.031(,t)C .531(he ne)405.297 518.4 R +(xt)-.15 E F3(refresh)3.031 E F1 .531(\(\) call)B(will cause a clear)97 530.4 Q +(-screen, e)-.2 E -.15(ve)-.25 G 2.5(ni).15 G 2.5(ft)223.57 530.4 S(he windo) +232.18 530.4 Q 2.5(wp)-.25 G(assed to)283.59 530.4 Q F3(refresh)2.5 E F1 +(\(\) is not a screen.)A F3(clrtobot)72 558.6 Q F1<28293b87>A -.4(Wi)97 574.8 S +1.287(pes the windo).4 F 3.787(wc)-.25 G 1.287(lear from the current \(y) +182.141 574.8 R 2.5(,x)-.65 G 3.787(\)c)289.939 574.8 S 1.288 +(o-ordinates to the bottom.)301.496 574.8 R 1.288(This does not force a)6.288 F +(clear)97 586.8 Q 1.505(-screen sequence on the ne)-.2 F 1.505 +(xt refresh under an)-.15 F 4.005(yc)-.15 G 4.005(ircumstances. This)322.341 +586.8 R 1.505(has no associated \231)4.005 F F0 -8.328(mm)C -4.998(vv)8.328 G +F1<9a>4.998 E(command.)97 598.8 Q F3(clrtoeol)72 627 Q F1<28293b87>A -.4(Wi)97 +643.2 S .342(pes the windo).4 F 2.842(wc)-.25 G .342(lear from the current \(y) +179.306 643.2 R 2.5(,x)-.65 G 2.842(\)c)283.324 643.2 S .342 +(o-ordinates to the end of the line.)293.936 643.2 R .343(This has no asso-) +5.343 F(ciated \231)97 655.2 Q F0 -8.328(mm)C -4.998(vv)8.328 G F1 2.5<9a63> +4.998 G(ommand.)152.534 655.2 Q F3(crmode)72 683.4 Q F1<28293b87>A 1.701 +(Identical to)97 699.6 R F3(cbreak)4.201 E F1 4.201(\(\). The)B 1.701 +(misnamed macro)4.201 F F3(crmode)4.201 E F1 1.701(\(\) and)B F3(nocrmode)4.201 +E F1 1.701(\(\) is retained for back-)B -.1(wa)97 711.6 S +(rds compatibility with ealier v).1 E(ersions of the library)-.15 E(.)-.65 E EP +%%Page: 8 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G 334.474 +-4.998(88 S)3.328 H(Sc)-.56 E(cr)442.888 60 Q -.18(re)447.33 60 S(ee)451.592 60 +Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 60 S(ac)474.55 60 Q(ck) +479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 60 Q(e)499.56 60 Q/F1 +10/Courier-Bold@0 SF(delch)72 96 Q/F2 10/Times-Roman@0 SF(\(\);)A .408 +(Delete the character at the current \(y)97 112.2 R 2.5(,x)-.65 G 2.908(\)c) +254.848 112.2 S 2.908(o-ordinates. Each)265.526 112.2 R .408 +(character after it on the line shifts to the)2.908 F +(left, and the last character becomes blank.)97 124.2 Q F1(deleteln)72 152.4 Q +F2(\(\);)A 1.437(Delete the current line.)97 168.6 R(Ev)6.437 E 1.437 +(ery line belo)-.15 F 3.937(wt)-.25 G 1.436(he current one will mo)276.899 +168.6 R 1.736 -.15(ve u)-.15 H 1.436(p, and the bottom line will).15 F +(become blank.)97 180.6 Q(The current \(y)5 E 2.5(,x)-.65 G 2.5(\)c)226.87 +180.6 S(o-ordinates will remain unchanged.)237.14 180.6 Q F1(delwin)72 208.8 Q +F2(\()A/F3 10/Times-Italic@0 SF(WINDO)A(W)-.5 E/F4 10/Symbol SF(*)2.5 E F3(win) +A F2(\);)A .311(Deletes the windo)97 225 R 2.811(wf)-.25 G .311(rom e)182.943 +225 R 2.811(xistence. All)-.15 F .311(resources are freed for future use by) +2.811 F F0 -4.438(cc)2.811 G -4.998(aa)4.438 G -2.778(ll)4.998 G -2.778(ll) +2.778 G -4.998(oo)2.778 G -4.438(cc)4.998 G F2 2.811(\(3\). If)4.438 F 2.812 +(aw)2.812 G(indo)479.25 225 Q(w)-.25 E 1.749(has a)97 237 R F1(subwin)4.249 E +F2 1.749(\(\) allocated windo)B 4.249(wi)-.25 G 1.749 +(nside of it, deleting the outer windo)249.525 237 R 4.248(wt)-.25 G 1.748 +(he subwindo)416.506 237 R 4.248(wi)-.25 G 4.248(sn)483.082 237 S(ot)496.22 237 +Q(af)97 249 Q .856(fected, e)-.25 F -.15(ve)-.25 G 3.356(nt).15 G .856 +(hough this does in)159.422 249 R -.25(va)-.4 G .856(lidate it.).25 F .856 +(Therefore, subwindo)5.856 F .856(ws should be deleted before their)-.25 F +(outer windo)97 261 Q(ws are.)-.25 E F1(echo)72 289.2 Q F2<28293b87>A +(Sets the terminal to echo characters.)97 305.4 Q F1(endwin)72 333.6 Q F2 +(\(\);)A 3.04(Finish up windo)97 349.8 R 5.54(wr)-.25 G 3.04(outines before e) +183.93 349.8 R 5.54(xit. This)-.15 F 3.04 +(restores the terminal to the state it w)5.54 F 3.04(as before)-.1 F F1 +(initscr)97 361.8 Q F2 .147(\(\) \(or)B F1(gettmode)2.647 E F2 .147(\(\) and)B +F1(setterm)2.647 E F2 .148(\(\)\) w)B .148(as called.)-.1 F .148(It should al) +5.148 F -.1(wa)-.1 G .148(ys be called before e).1 F(xiting)-.15 E 1.047 +(and before the f)97 373.8 R 1.047(inal calls to)-.2 F F1(delwin)3.547 E F2 +3.547(\(\). It)B 1.046(does not e)3.547 F 3.546(xit. This)-.15 F 1.046 +(is especially useful for resetting tty)3.546 F +(stats when trapping rubouts via)97 385.8 Q F0 -3.888(ss)2.5 G -2.778(ii)3.888 +G -4.998(gg)2.778 G -5.558(nn)4.998 G -4.998(aa)5.558 G -2.778(ll)4.998 G F2 +(\(2\).)2.778 E F1(erase)72 414 Q F2<28293b87>A .066(Erases the windo)97 430.2 +R 2.566(wt)-.25 G 2.566(ob)177.768 430.2 S .066 +(lanks without setting the clear flag.)190.334 430.2 R .066 +(This is analagous to)5.066 F F1(clear)2.567 E F2 .067(\(\), e)B .067 +(xcept that)-.15 F 1.363(it ne)97 442.2 R -.15(ve)-.25 G 3.863(rc).15 G 1.363 +(auses a clear)136.536 442.2 R 1.363(-screen sequence to be generated on a)-.2 +F F1(refresh)3.862 E F2 3.862(\(\). This)B 1.362(has no associated)3.862 F<99> +97 454.2 Q F0 -8.328(mm)C -4.998(vv)8.328 G F2 2.5<9a63>4.998 G(ommand.)126.154 +454.2 Q F1(erasechar)72 482.4 Q F2<28293b87>A .23 +(Returns the erase character for the terminal,)97 498.6 R F3(i.e)2.73 E(.)-.15 +E F2 2.73(,t)C .231(he character used by the user to erase a single char)296.41 +498.6 R(-)-.2 E(acter from the input.)97 510.6 Q F1(flushok)72 538.8 Q F2(\()A +F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3(int boolf)2.5 E F2(\);)A +(Normally)97 555 Q(,)-.65 E F1(refresh)3.743 E F2(\(\))A F1(fflush)3.743 E F2 +(\()A F3 -.4('s)C F2(\);).4 E F3(stdout)3.743 E F2 1.243(when it is f)3.743 F +(inished.)-.2 E F1(flushok)6.242 E F2 1.242(\(\) allo)B 1.242 +(ws you to control)-.25 F 2.5(this. if)97 567 R F3(boolf)2.5 E F2 +(is non-zero \()2.5 E F3(i.e)A(.)-.15 E F2 2.5(,n)C(on-zero\) it will do the) +223.23 567 Q F1(fflush)2.5 E F2(\(\), otherwise it will not.)A F1(getch)72 +595.2 Q F2<28293b87>A .443 +(Gets a character from the terminal and \(if necessary\) echos it on the windo) +97 611.4 R 4.244 -.65(w. T)-.25 H .444(his returns ERR if it).65 F -.1(wo)97 +623.4 S .436(uld cause the screen to scroll ille).1 F -.05(ga)-.15 G(lly).05 E +5.435(.O)-.65 G .435(therwise, the character gotten is returned.)276.57 623.4 R +(If)5.435 E F3(noec)2.935 E(ho)-.15 E F2(has)2.935 E .561 +(been set, then the windo)97 635.4 R 3.061(wi)-.25 G 3.061(sl)208.985 635.4 S +.561(eft unaltered.)218.716 635.4 R .561 +(In order to retain control of the terminal, it is necessary)5.561 F .74(to ha) +97 647.4 R 1.04 -.15(ve o)-.2 H .74(ne of).15 F F3(noec)3.24 E(ho)-.15 E F2(,)A +F3(cbr)3.24 E(eak)-.37 E F2 3.24(,o)C(r)231.09 647.4 Q F3 -.15(ra)3.24 G(wmode) +.15 E F2 3.24(set. If)3.24 F .739(you do not set one, whate)3.239 F -.15(ve) +-.25 G 3.239(rr).15 G .739(outine you call to)432.063 647.4 R +(read characters will set)97 659.4 Q F3(cbr)2.5 E(eak)-.37 E F2 +(for you, and then reset to the original mode when f)2.5 E(inished.)-.2 E F1 +(getstr)72 687.6 Q F2(\()A F3 -.15(ch)C(ar).15 E F4(*)2.5 E F3(str)A F2<293b87> +A .571(Get a string through the windo)97 703.8 R 3.071(wa)-.25 G .571 +(nd put it in the location pointed to by)236.826 703.8 R F3(str)3.072 E F2 +3.072(,w)C .572(hich is assumed to be)416.162 703.8 R(lar)97 715.8 Q .798 +(ge enough to handle it.)-.18 F .798(It sets tty modes if necessary)5.798 F +3.298(,a)-.65 G .797(nd then calls)336.578 715.8 R F1(getch)3.297 E F2 .797 +(\(\) \(or)B F1(wgetch)3.297 E F2 .797(\(\)\) to)B EP +%%Page: 9 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 326.978(eP) +134.236 60 S(PS)465.656 60 Q(S1)471.768 60 Q(1:)477.33 60 Q(:1)482.332 60 Q(19) +485.664 60 Q(9-)490.666 60 Q(-9)495.668 60 Q(9)499 60 Q/F1 10/Times-Roman@0 SF +1.192(get the characters needed to f)97 96 R 1.192 +(ill in the string until a ne)-.2 F 1.193(wline or EOF is encountered.)-.25 F +1.193(The ne)6.193 F(wline)-.25 E(stripped of)97 108 Q 2.5(ft)-.25 G +(he string.)148.41 108 Q(This returns ERR if it w)5 E +(ould cause the screen to scroll ille)-.1 E -.05(ga)-.15 G(lly).05 E(.)-.65 E +/F2 10/Courier-Bold@0 SF(gettmode)72 136.2 Q F1(\(\);)A(Get the tty stats.)97 +152.4 Q(This is normally called by)5 E F2(initscr)2.5 E F1(\(\).)A F2(getyx)72 +180.6 Q F1(\()A/F3 10/Times-Italic@0 SF(WINDO)A(W)-.5 E/F4 10/Symbol SF(*)2.5 E +F3(win)A F1(,)A F3(int y)2.5 E F1(,)A F3(int x)2.5 E F1(\);)A .121 +(Puts the current \(y)97 196.8 R 2.5(,x)-.65 G 2.621(\)c)180.313 196.8 S .121 +(o-ordinates of)190.704 196.8 R F3(win)2.621 E F1 .121(in the v)2.621 F +(ariables)-.25 E F3(y)2.621 E F1(and)2.62 E F3(x)2.62 E F1 5.12(.S)C .12 +(ince it is a macro, not a function,)371.79 196.8 R +(you do not pass the address of)97 208.8 Q F3(y)2.5 E F1(and)2.5 E F3(x)2.5 E +F1(.)A F2(idlok)72 237 Q F1(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F1(,)A +F3(int boolf)2.5 E F1(\);)A(Reserv)97 253.2 Q .248(ed for future use.)-.15 F +.248(This will e)5.248 F -.15(ve)-.25 G .248(ntually signal to).15 F F2 +(refresh)2.748 E F1 .249(\(\) that it is all right to use the insert)B +(and delete line sequences when updating the windo)97 265.2 Q -.65(w.)-.25 G F2 +(inch)72 293.4 Q F1<28293b87>A .608 +(Returns the character at the current position on the gi)97 309.6 R -.15(ve) +-.25 G 3.108(nw).15 G(indo)339.302 309.6 Q 4.408 -.65(w. T)-.25 H .608 +(his does not mak).65 F 3.108(ea)-.1 G .908 -.15(ny c)458.832 309.6 T(hanges) +.15 E(to the windo)97 321.6 Q -.65(w.)-.25 G F2(initscr)72 349.8 Q F1(\(\);)A +.573(Initialize the screen routines.)97 366 R .573 +(This must be called before an)5.573 F 3.073(yo)-.15 G 3.073(ft)353.639 366 S +.573(he screen routines are used.)362.822 366 R .573(It ini-)5.573 F .564(tial\ +izes the terminal-type data and such, and without it none of the routines can \ +operate.)97 378 R .563(If standard)5.563 F .242(input is not a tty)97 390 R +2.742(,i)-.65 G 2.742(ts)170.35 390 S .242(ets the specif)179.762 390 R .242 +(ications to the terminal whose name is pointed to by)-.2 F F3(Def)2.743 E F4 +(-)460.217 395 Q F3(term)465.707 390 Q F1(\(ini-)2.743 E .097(tially "dumb"\).) +97 402 R .097(If the boolean)5.097 F F3(My)2.597 E F4(-)233.125 407 Q F3(term) +238.615 402 Q F1 .097(is non-zero,)2.597 F F3(Def)2.597 E F4(-)323.886 407 Q F3 +(term)329.376 402 Q F1 .097(is al)2.597 F -.1(wa)-.1 G .096(ys used.).1 F .096 +(If the system supports)5.096 F(the)97 414 Q F0 -6.668(TT)3.124 G -3.888(II) +6.668 G -7.778(OO)3.888 G -7.218(CC)7.778 G -7.778(GG)7.218 G -9.998(WW)7.778 G +-3.888(II)9.998 G -7.218(NN)3.888 G -5.558(SS)7.218 G -6.668(ZZ)5.558 G F3 +(ioctl\(2\))9.792 E F1 .624 +(call, it is used to get the number of lines and columns for the terminal,) +3.124 F(otherwise it is tak)97 426 Q(en from the)-.1 E F0 -3.328(tt)2.5 G +-4.438(ee)3.328 G -4.438(rr)4.438 G -8.328(mm)4.438 G -4.438(cc)8.328 G -4.998 +(aa)4.438 G -5.558(pp)4.998 G F1(description.)8.058 E F2(insch)72 454.2 Q F1 +(\()A F3 -.15(ch)C(ar c).15 E F1(\);)A(Insert)97 470.4 Q F3(c)2.67 E F1 .17 +(at the current \(y)2.67 F 2.5(,x)-.65 G 2.67(\)c)203 470.4 S .169 +(o-ordinates Each character after it shifts to the right, and the last charac-) +213.44 470.4 R(ter disappears.)97 482.4 Q(This returns ERR if it w)5 E +(ould cause the screen to scroll ille)-.1 E -.05(ga)-.15 G(lly).05 E(.)-.65 E +F2(insertln)72 510.6 Q F1(\(\);)A .801(Insert a line abo)97 526.8 R 1.101 -.15 +(ve t)-.15 H .801(he current one.).15 F(Ev)5.801 E .801(ery line belo)-.15 F +3.301(wt)-.25 G .801(he current line will be shifted do)321.48 526.8 R .802 +(wn, and the)-.25 F 1.048(bottom line will disappear)97 538.8 R 6.047(.T)-.55 G +1.047(he current line will become blank, and the current \(y)218.97 538.8 R 2.5 +(,x)-.65 G 3.547(\)c)447.693 538.8 S(o-ordinates)459.01 538.8 Q +(will remain unchanged.)97 550.8 Q F2(killchar)72 579 Q F1<28293b87>A .711 +(Returns the line kill character for the terminal,)97 595.2 R F3(i.e)3.212 E(.) +-.15 E F1 3.212(,t)C .712(he character used by the user to erase an entire) +311.272 595.2 R(line from the input.)97 607.2 Q F2(leaveok)72 635.4 Q F1(\()A +F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F1(,)A F3(int boolf)2.5 E F1<293b87>A +.297(Sets the boolean flag for lea)97 651.6 R .297 +(ving the cursor after the last change.)-.2 F(If)5.297 E F3(boolf)2.796 E F1 +.296(is non-zero, the cursor will)2.796 F .013 +(be left after the last update on the terminal, and the current \(y)97 663.6 R +2.5(,x)-.65 G 2.514(\)c)351.726 663.6 S .014(o-ordinates for)362.01 663.6 R F3 +(win)2.514 E F1 .014(will be changed)2.514 F(accordingly)97 675.6 Q 5(.I)-.65 G +(f)154.39 675.6 Q F3(boolf)2.5 E F1 .073(is 0 the cursor will be mo)99.5 687.6 +R -.15(ve)-.15 G 2.573(dt).15 G 2.573(ot)221.091 687.6 S .073(he current \(y) +231.444 687.6 R 2.5(,x)-.65 G 2.573(\)c)292.03 687.6 S 2.573(o-ordinates. This) +302.373 687.6 R .072(flag \(initially 0\) retains its v)2.573 F(alue)-.25 E +(until changed by the user)97 699.6 Q(.)-.55 E EP +%%Page: 10 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G -4.998 +(11)3.328 G 329.472 -4.998(00 S)4.998 H(Sc)-.56 E(cr)442.888 60 Q -.18(re) +447.33 60 S(ee)451.592 60 Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 +60 S(ac)474.55 60 Q(ck)479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 +60 Q(e)499.56 60 Q/F1 10/Courier-Bold@0 SF(move)72 96 Q/F2 10/Times-Roman@0 SF +(\()A/F3 10/Times-Italic@0 SF(int y)A F2(,)A F3(int x)2.5 E F2(\);)A .098 +(Change the current \(y)97 112.2 R 2.5(,x)-.65 G 2.599(\)c)193.564 112.2 S .099 +(o-ordinates of the windo)203.933 112.2 R 2.599(wt)-.25 G 2.599(o\()314.619 +112.2 S F3 1.1 -.55(y, x)325.548 112.2 T F2 2.599(\). This).55 F .099 +(returns ERR if it w)2.599 F .099(ould cause the)-.1 F(screen to scroll ille)97 +124.2 Q -.05(ga)-.15 G(lly).05 E(.)-.65 E F1(mvcur)72 152.4 Q F2(\()A F3 +(int lasty)A F2(,)A F3(int lastx)2.5 E F2(,)A F3(int ne)2.5 E(wy)-.15 E F2(,)A +F3(int ne)2.5 E(wx)-.15 E F2(\);)A(Mo)97 168.6 Q -.15(ve)-.15 G 3.117(st).15 G +.617(he terminal')129.817 168.6 R 3.117(sc)-.55 G .617(ursor from \()189.931 +168.6 R F3(lasty)A 2.5(,l)-.55 G(astx)265.605 168.6 Q F2 3.117(\)t)C 3.117(o\() +290.942 168.6 S F3(ne)302.389 168.6 Q(wy)-.15 E 2.5(,n)-.55 G -.15(ew)332.239 +168.6 S(x).15 E F2 3.117(\)i)C 3.117(na)356.866 168.6 S 3.117(na)369.423 168.6 +S .617(pproximation of optimal f)381.98 168.6 R(ash-)-.1 E 2.589(ion. This)97 +180.6 R .089(routine uses the functions borro)2.589 F .089(wed from)-.25 F F3 +-.2(ex)2.589 G F2 -.15(ve)2.789 G .089(rsion 2.6.).15 F .09 +(It is possible to use this optimiza-)5.09 F .352(tion without the benef)97 +192.6 R .352(it of the screen routines.)-.2 F -.4(Wi)5.352 G .352 +(th the screen routines, this should not be called by).4 F .968(the user)97 +204.6 R(.)-.55 E F1(move)5.968 E F2 .968(\(\) and)B F1(refresh)3.468 E F2 .969 +(\(\) should be used to mo)B 1.269 -.15(ve t)-.15 H .969 +(he cursor position, so that the routines).15 F(kno)97 216.6 Q 2.5(ww)-.25 G +(hat')128.69 216.6 Q 2.5(sg)-.55 G(oing on.)155.08 216.6 Q F1(mvprintw)72 244.8 +Q F2(\()A F3(int y)A F2(,)A F3(int x)2.5 E F2(,)A F3(const c)2.5 E(har)-.15 E +/F4 10/Symbol SF(*)2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A(Equi)97 261 Q +-.25(va)-.25 G(lent to:).25 E(mo)137 277.2 Q -.15(ve)-.15 G(\(y).15 E 2.5(,x) +-.65 G(\);)176.6 277.2 Q(printw\(fmt, ...\);)137 289.2 Q F1(mvscanw)72 321.6 Q +F2(\()A F3(int y)A F2(,)A F3(int x)2.5 E F2(,)A F3(const c)2.5 E(har)-.15 E F4 +(*)2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A(Equi)97 337.8 Q -.25(va)-.25 G +(lent to:).25 E(mo)137 354 Q -.15(ve)-.15 G(\(y).15 E 2.5(,x)-.65 G(\);)176.6 +354 Q(scanw\(fmt, ...\);)137 366 Q F1(mvwin)72 398.4 Q F2(\()A F3(WINDO)A(W)-.5 +E F4(*)2.5 E F3(win)A F2(,)A F3(int y)2.5 E F2(,)A F3(int x)2.5 E F2(\);)A(Mo) +97 414.6 Q 1.712 -.15(ve t)-.15 H 1.412(he home position of the windo).15 F(w) +-.25 E F3(win)3.912 E F2 1.412(from its current starting coordinates to \() +3.912 F F3 1.1 -.55(y, x)D F2 3.911(\). If).55 F(that)3.911 E -.1(wo)97 426.6 S +.842(uld put part or all of the windo).1 F 3.343(wo)-.25 G 1.343 -.25(ff t) +252.82 426.6 T .843(he edge of the terminal screen,).25 F F1(mvwin)3.343 E F2 +.843(\(\) returns ERR and)B .248(does not change an)97 438.6 R 2.748(ything. F) +-.15 F .248(or subwindo)-.15 F(ws,)-.25 E F1(mvwin)2.748 E F2 .247 +(\(\) also returns ERR if you attempt to mo)B .547 -.15(ve i)-.15 H 2.747(to) +.15 G -.25(ff)497.59 438.6 S(its main windo)97 450.6 Q 3.8 -.65(w. I)-.25 H 2.5 +(fy).65 G(ou mo)184.43 450.6 Q .3 -.15(ve a m)-.15 H(ain windo).15 E 1.3 -.65 +(w, a)-.25 H(ll subwindo).65 E(ws are mo)-.25 E -.15(ve)-.15 G 2.5(da).15 G +(long with it.)400.43 450.6 Q F1(mvwprintw)72 478.8 Q F2(\()A F3(WINDO)A(W)-.5 +E F4(*)2.5 E F3(win)A F2(,)A F3(int y)2.5 E F2(,)A F3(int x)2.5 E F2(,)A F3 +(const c)2.5 E(har)-.15 E F4(*)2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A +(Equi)97 495 Q -.25(va)-.25 G(lent to:).25 E(wmo)137 511.2 Q -.15(ve)-.15 G +(\(win, y).15 E 2.5(,x)-.65 G(\);)203.82 511.2 Q(printw\(fmt, ...\);)137 523.2 +Q F1(mvwscanw)72 555.6 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A +F3(int y)2.5 E F2(,)A F3(int x)2.5 E F2(,)A F3(const c)2.5 E(har)-.15 E F4(*) +2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A(Equi)97 571.8 Q -.25(va)-.25 G +(lent to:).25 E(wmo)137 588 Q -.15(ve)-.15 G(\(win, y).15 E 2.5(,x)-.65 G(\);) +203.82 588 Q(scanw\(fmt, ...\);)137 600 Q F1(newwin)72 632.4 Q F2(\()A F3 +(int lines)A F2(,)A F3(int cols)2.5 E F2(,)A F3(int be)2.5 E(gin_y)-.4 E F2(,)A +F3(int be)2.5 E(gin_x)-.4 E F2(\);)A 1.24(Create a ne)97 648.6 R 3.74(ww)-.25 G +(indo)162.39 648.6 Q 3.74(ww)-.25 G(ith)198.1 648.6 Q F3(lines)3.74 E F2 1.24 +(lines and)3.74 F F3(cols)3.74 E F2 1.24(columns starting at position \()3.74 F +F3(be)A(gin)-.4 E F4(-)439.14 653.6 Q F3 1.1 -.55(y, b)444.63 648.6 T -.4(eg) +.55 G(in).4 E F4(-)475.34 653.6 Q F3(x)480.83 648.6 Q F2 3.74(\). If)B(either) +97 660.6 Q F3(lines)2.765 E F2(or)2.765 E F3(cols)2.765 E F2 .265 +(is 0 \(zero\), that dimension will be set to \()2.765 F F3 .265(LINES \255 be) +B(gin)-.4 E F4(-)401.744 665.6 Q F3(y)407.234 660.6 Q F2 2.764(\)o)C 2.764(r\() +422.768 660.6 S F3 .264(COLS \255 be)432.192 660.6 R(gin)-.4 E F4(-)490.74 +665.6 Q F3(x)496.23 660.6 Q F2(\))A(respecti)97 672.6 Q -.15(ve)-.25 G(ly).15 E +5(.T)-.65 G(hus, to get a ne)157.88 672.6 Q 2.5(ww)-.25 G(indo)234.84 672.6 Q +2.5(wo)-.25 G 2.5(fd)267.09 672.6 S(imensions)277.92 672.6 Q F3(LINES)2.5 E F4 +<b4>2.5 E F3(COLS)2.5 E F2 2.5(,u)C(se)392.59 672.6 Q F1(newwin)2.5 E F2(\()A +F3(0)A F2(,)A F3(0)2.5 E F2(,)A F3(0)2.5 E F2(,)A F3(0)2.5 E F2(\).)A F1(nl)72 +700.8 Q F2<28293b87>A EP +%%Page: 11 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 321.976(eP) +134.236 60 S(PS)460.654 60 Q(S1)466.766 60 Q(1:)472.328 60 Q(:1)477.33 60 Q(19) +480.662 60 Q(9-)485.664 60 Q(-1)490.666 60 Q(11)493.998 60 Q(1)499 60 Q/F1 10 +/Times-Roman@0 SF 2.343(Set the terminal to nl mode,)97 96 R/F2 10 +/Times-Italic@0 SF(i.e)4.843 E(.)-.15 E F1 4.843(,s)C 2.343 +(tart/stop the system from mapping)247.971 96 R F0 -5.698(<<)4.843 G -7.218(RR) +5.698 G -6.668(EE)7.218 G -6.668(TT)6.668 G -7.218(UU)6.668 G -7.218(RR)7.218 G +-7.218(NN)7.218 G -5.698(>>)7.218 G F1(to)457.885 96 Q F0 -5.698(<<)4.843 G +-6.668(LL)5.698 G -3.888(II)6.668 G -7.218(NN)3.888 G -6.668(EE)7.218 G -3.328 +(--)6.668 G -6.108(FF)97 108 S -6.668(EE)6.108 G -6.668(EE)6.668 G -7.218(DD) +6.668 G -5.698(>>)7.218 G F1 5.696(.I)5.698 G 3.196(ft)140.906 108 S .696 +(he mapping is not done,)150.212 108 R/F3 10/Courier-Bold@0 SF(refresh)3.195 E +F1 .695(\(\) can do more optimization, so it is recommended,)B -.2(bu)97 120 S +2.5(tn).2 G(ot required, to turn it of)117.08 120 Q(f.)-.25 E F3(nocbreak)72 +148.2 Q F1<28293b87>A(Unset the terminal from cbreak mode.)97 164.4 Q F3 +(nocrmode)72 192.6 Q F1<28293b87>A .131(Identical to)97 208.8 R F3(nocbreak) +2.631 E F1 2.632(\(\). The)B .132(misnamed macro)2.632 F F3(nocrmode)2.632 E F1 +.132(\(\) is retained for backw)B .132(ards compatibil-)-.1 F +(ity with ealier v)97 220.8 Q(ersions of the library)-.15 E(.)-.65 E F3(noecho) +72 249 Q F1<28293b87>A -.45(Tu)97 265.2 S(rn echoing of characters of).45 E(f.) +-.25 E F3(nonl)72 293.4 Q F1<28293b87>A(Unset the terminal to from nl mode.)97 +309.6 Q(See)5 E F3(nl)2.5 E F1(\(\).)A F3(noraw)72 337.8 Q F1<28293b87>A +(Unset the terminal from ra)97 354 Q 2.5(wm)-.15 G 2.5(ode. See)220.44 354 R F3 +(raw)2.5 E F1(\(\).)A F3(overlay)72 382.2 Q F1(\()A F2(WINDO)A(W)-.5 E/F4 10 +/Symbol SF(*)2.5 E F2(win1)A F1(,)A F2(WINDO)2.5 E(W)-.5 E F4(*)2.5 E F2(win2)A +F1(\);)A(Ov)97 398.4 Q(erlay)-.15 E F2(win1)3.018 E F1(on)3.018 E F2(win2)3.018 +E F1 5.518(.T)C .517(he contents of)201.142 398.4 R F2(win1)3.017 E F1 3.017 +(,i)C(nsof)289.04 398.4 Q .517(ar as the)-.1 F 3.017(yf)-.15 G .517 +(it, are placed on)351.511 398.4 R F2(win2)3.017 E F1 .517(at their starting) +3.017 F(\(y)97 410.4 Q 2.5(,x)-.65 G 4.221(\)c)114.68 410.4 S 4.221 +(o-ordinates. This)126.671 410.4 R 1.721(is done non-destructi)4.221 F -.15(ve) +-.25 G(ly).15 E 4.221(,i)-.65 G 1.721(.e., blanks on)315.876 410.4 R F2(win1) +4.222 E F1(lea)4.222 E 2.022 -.15(ve t)-.2 H 1.722(he contents of the).15 F +1.646(space on)97 422.4 R F2(win2)4.146 E F1 4.146(untouched. Note)4.146 F +1.645(that all non-blank characters are o)4.146 F -.15(ve)-.15 G 1.645 +(rwritten destructi).15 F -.15(ve)-.25 G 1.645(ly in the).15 F -.15(ove)97 +434.4 S(rlay).15 E(.)-.65 E F3(overwrite)72 462.6 Q F1(\()A F2(WINDO)A(W)-.5 E +F4(*)2.5 E F2(win1)A F1(,)A F2(WINDO)2.5 E(W)-.5 E F4(*)2.5 E F2(win2)A F1(\);) +A(Ov)97 478.8 Q(erwrite)-.15 E F2(win1)2.554 E F1(on)2.554 E F2(win2)2.554 E F1 +5.054(.T)C .054(he contents of)207.616 478.8 R F2(win1)2.554 E F1 2.554(,i)C +(nsof)293.662 478.8 Q .054(ar as the)-.1 F 2.555(yf)-.15 G .055 +(it, are placed on)354.745 478.8 R F2(win2)2.555 E F1 .055(at their starting) +2.555 F(\(y)97 490.8 Q 2.5(,x)-.65 G 2.5(\)c)114.68 490.8 S 2.5 +(o-ordinates. This)124.95 490.8 R(is done destructi)2.5 E -.15(ve)-.25 G(ly).15 +E(,)-.65 E F2(i.e)2.5 E(.)-.15 E F1 2.5(,b)C(lanks on)306.51 490.8 Q F2(win1) +2.5 E F1(become blank on)2.5 E F2(win2)2.5 E F1(.)A F3(printw)72 519 Q F1(\()A +F2 -.15(ch)C(ar).15 E F4(*)2.5 E F2(fmt)A F1(,)A F2(...)2.5 E F1(\);)A .306 +(Performs a)97 535.2 R F3(printf)2.806 E F1 .306(\(\) on the windo)B 2.805(ws) +-.25 G .305(tarting at the current \(y)255.675 535.2 R 2.5(,x)-.65 G 2.805(\)c) +358.445 535.2 S 2.805(o-ordinates. It)369.02 535.2 R(uses)2.805 E F3(addstr) +2.805 E F1 .305(\(\) to)B 1.136(add the string on the windo)97 547.2 R 4.936 +-.65(w. I)-.25 H 3.637(ti).65 G 3.637(so)239.323 547.2 S 1.137 +(ften advisable to use the f)251.85 547.2 R 1.137(ield width options of)-.2 F +F3(printf)3.637 E F1 1.137(\(\) to)B -.2(avo)97 559.2 S .292(id lea).2 F .292 +(ving things on the windo)-.2 F 2.791(wf)-.25 G .291(rom earlier calls.)246.779 +559.2 R .291(This returns ERR if it w)5.291 F .291(ould cause the screen)-.1 F +(to scroll ille)97 571.2 Q -.05(ga)-.15 G(lly).05 E(.)-.65 E F3(raw)72 599.4 Q +F1<28293b87>A(Set the terminal to ra)97 617.2 Q 2.5(wm)-.15 G 2.5(ode. On) +198.23 617.2 R -.15(ve)2.5 G(rsion 7).15 E/F5 8/Times-Bold@0 SF -5.774(UU)2.5 G +-5.774(NN)5.774 G -3.11(II)5.774 G -5.774(XX)3.11 G/F6 5/Times-Bold@0 SF -2.498 +(22)5.774 -3.2 O F1(this also turns of)4.998 3.2 M 2.5(fn)-.25 G -.25(ew)376.6 +617.2 S(line mapping \(see).25 E F3(nl)2.5 E F1(\(\)\).)A F3(refresh)72 645.4 Q +F1<28293b87>A .32 LW 76 678.8 72 678.8 DL 80 678.8 76 678.8 DL 84 678.8 80 +678.8 DL 88 678.8 84 678.8 DL 92 678.8 88 678.8 DL 96 678.8 92 678.8 DL 100 +678.8 96 678.8 DL 104 678.8 100 678.8 DL 108 678.8 104 678.8 DL 112 678.8 108 +678.8 DL 116 678.8 112 678.8 DL 120 678.8 116 678.8 DL 124 678.8 120 678.8 DL +128 678.8 124 678.8 DL 132 678.8 128 678.8 DL 136 678.8 132 678.8 DL 140 678.8 +136 678.8 DL 144 678.8 140 678.8 DL 148 678.8 144 678.8 DL 152 678.8 148 678.8 +DL 156 678.8 152 678.8 DL 160 678.8 156 678.8 DL 164 678.8 160 678.8 DL 168 +678.8 164 678.8 DL 172 678.8 168 678.8 DL 176 678.8 172 678.8 DL 180 678.8 176 +678.8 DL 184 678.8 180 678.8 DL 188 678.8 184 678.8 DL 192 678.8 188 678.8 DL +196 678.8 192 678.8 DL 200 678.8 196 678.8 DL 204 678.8 200 678.8 DL 208 678.8 +204 678.8 DL 212 678.8 208 678.8 DL 216 678.8 212 678.8 DL/F7 5/Times-Roman@0 +SF(2)93.6 689.2 Q/F8 6/Times-Bold@0 SF -4.33(UU)2 3.2 O -4.33(NN)4.33 G -2.332 +(II)4.33 G -4.33(XX)2.332 G/F9 8/Times-Roman@0 SF +(is a trademark of Unix System Laboratories.)6.33 E EP +%%Page: 12 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G -4.998 +(11)3.328 G 329.472 -4.998(22 S)4.998 H(Sc)-.56 E(cr)442.888 60 Q -.18(re) +447.33 60 S(ee)451.592 60 Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 +60 S(ac)474.55 60 Q(ck)479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 +60 Q(e)499.56 60 Q/F1 10/Times-Roman@0 SF .947 +(Synchronize the terminal screen with the desired windo)97 96 R 4.747 -.65 +(w. I)-.25 H 3.448(ft).65 G .948(he windo)353.744 96 R 3.448(wi)-.25 G 3.448 +(sn)404.83 96 S .948(ot a screen, only that)417.168 96 R .13(part co)97 108 R +-.15(ve)-.15 G .13(red by it is updated.).15 F .13(This returns ERR if it w) +5.13 F .129(ould cause the screen to scroll ille)-.1 F -.05(ga)-.15 G(lly).05 E +5.129(.I)-.65 G 2.629(nt)481.921 108 S(his)492.33 108 Q +(case, it will update whate)97 120 Q -.15(ve)-.25 G 2.5(ri).15 G 2.5(tc)216.02 +120 S(an without causing the scroll.)225.74 120 Q 2.343(As a special case, if) +97 144 R/F2 10/Courier-Bold@0 SF(wrefresh)4.843 E F1 2.343 +(\(\) is called with the windo)B(w)-.25 E/F3 10/Times-Italic@0 SF(cur)4.843 E +(scr)-.1 E F1 2.343(the screen is cleared and)4.843 F .09 +(repainted as it is currently)97 156 R 5.09(.T)-.65 G .09(his is v)214.28 156 R +.09(ery useful for allo)-.15 F .09(wing the redra)-.25 F .09 +(wing of the screen when the user)-.15 F(has g)97 168 Q +(arbage dumped on his terminal.)-.05 E F2(resetty)72 196.2 Q F1<28293b87>A F2 +(resetty)97 212.4 Q F1 .456(\(\) restores them to what)B F2(savetty)2.956 E F1 +.456(\(\) stored.)B .457(These functions are performed automatically)5.456 F +(by)97 224.4 Q F2(initscr)2.5 E F1(\(\) and)A F2(endwin)2.5 E F1 2.5 +(\(\). This)B(function should not be used by the user)2.5 E(.)-.55 E F2 +(savetty)72 252.6 Q F1<28293b87>A F2(savetty)97 268.8 Q F1 .776(\(\) sa)B -.15 +(ve)-.2 G 3.276(st).15 G .776(he current tty characteristic flags. See)176.302 +268.8 R F2(resetty)3.275 E F1 3.275(\(\). This)B .775(function should not be) +3.275 F(used by the user)97 280.8 Q(.)-.55 E F2(scanw)72 309 Q F1(\()A F3 -.15 +(ch)C(ar).15 E/F4 10/Symbol SF(*)2.5 E F3(fmt)A F1(,)A F3(...)2.5 E F1(\);)A +.716(Perform a)97 325.2 R F2(scanf)3.216 E F1 .716(\(\) through the windo)B +3.216(wu)-.25 G(sing)270.466 325.2 Q F3(fmt)3.216 E F1 5.716(.I)C 3.216(td) +314.678 325.2 S .716(oes this using consecuti)325.674 325.2 R 1.016 -.15(ve c) +-.25 H .716(alls to).15 F F2(getch)3.216 E F1(\(\))A(\(or)97 337.2 Q F2(wgetch) +2.5 E F1 2.5(\(\)\). This)B(returns ERR if it w)2.5 E +(ould cause the screen to scroll ille)-.1 E -.05(ga)-.15 G(lly).05 E(.)-.65 E +F2(scroll)72 365.4 Q F1(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F1(\);)A +(Scroll the windo)97 381.6 Q 2.5(wu)-.25 G(pw)177.58 381.6 Q(ard one line.)-.1 +E(This is normally not used by the user)5 E(.)-.55 E F2(scrollok)72 409.8 Q F1 +(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F1(,)A F3(int boolf)2.5 E F1 +<293b87>A .198(Set the scroll flag for the gi)97 426 R -.15(ve)-.25 G 2.698(nw) +.15 G(indo)231.576 426 Q 3.998 -.65(w. I)-.25 H(f).65 E F3(boolf)2.698 E F1 +.197(is 0, scrolling is not allo)2.698 F 2.697(wed. This)-.25 F .197 +(is its def)2.697 F .197(ault set-)-.1 F(ting.)97 438 Q F2(standend)72 466.2 Q +F1<28293b87>A(End standout mode initiated by)97 482.4 Q F2(standout)2.5 E F1 +(\(\).)A F2(standout)72 510.6 Q F1<28293b87>A .406(Causes an)97 526.8 R 2.906 +(yc)-.15 G .407(haracters added to the windo)149.872 526.8 R 2.907(wt)-.25 G +2.907(ob)279.126 526.8 S 2.907(ep)292.033 526.8 S .407 +(ut in standout mode on the terminal \(if it has that)304.38 526.8 R +(capability\).)97 538.8 Q F2(subwin)72 567 Q F1(\()A F3(WINDO)A(W)-.5 E F4(*) +2.5 E F3(win)A F1(,)A F3(int lines)2.5 E F1(,)A F3(int cols)2.5 E F1(,)A F3 +(int be)2.5 E(gin_y)-.4 E F1(,)A F3(int be)2.5 E(gin_x)-.4 E F1(\);)A .367 +(Create a ne)97 583.2 R 2.867(ww)-.25 G(indo)159.771 583.2 Q 2.867(ww)-.25 G +(ith)194.608 583.2 Q F3(lines)2.867 E F1 .366(lines and)2.867 F F3(cols)2.866 E +F1 .366(columns starting at position \()2.866 F F3(be)A(gin)-.4 E F4(-)427.784 +588.2 Q F3 1.1 -.55(y, b)433.274 583.2 T -.4(eg).55 G(in).4 E F4(-)463.984 +588.2 Q F3(x)469.474 583.2 Q F1 2.866(\)i)C(nside)482.89 583.2 Q .322 +(the windo)97 595.2 R(w)-.25 E F3(win)2.822 E F1 5.322(.T)C .322 +(his means that an)175.216 595.2 R 2.822(yc)-.15 G .322 +(hange made to either windo)257.454 595.2 R 2.822(wi)-.25 G 2.822(nt)382.404 +595.2 S .322(he area co)393.006 595.2 R -.15(ve)-.15 G .323(red by the sub-).15 +F(windo)97 607.2 Q 2.755(ww)-.25 G .255(ill be made on both windo)138.945 607.2 +R(ws.)-.25 E F3(be)5.255 E(gin)-.4 E F4(-)285.375 612.2 Q F3 1.1 -.55(y, b) +290.865 607.2 T -.4(eg).55 G(in).4 E F4(-)321.575 612.2 Q F3(x)327.065 607.2 Q +F1 .255(are specif)2.755 F .255(ied relati)-.2 F .555 -.15(ve t)-.25 H 2.755 +(ot).15 G .255(he o)433.54 607.2 R -.15(ve)-.15 G .255(rall screen,).15 F .112 +(not the relati)97 619.2 R .412 -.15(ve \()-.25 H(0, 0\)).15 E(of)2.612 E F3 +(win)2.612 E F1 5.112(.I)C 2.612(fe)220.032 619.2 S(ither)230.414 619.2 Q F3 +(lines)2.612 E F1(or)2.612 E F3(cols)2.612 E F1 .113 +(is 0 \(zero\), that dimension will be set to \()2.612 F F3 .113(LINES \255)B +(be)97 631.2 Q(gin)-.4 E F4(-)118.82 636.2 Q F3(y)124.31 631.2 Q F1 2.5(\)o)C +2.5(r\()139.58 631.2 S F3(COLS \255 be)148.74 631.2 Q(gin)-.4 E F4(-)206.76 +636.2 Q F3(x)212.25 631.2 Q F1 2.5(\)r)C(especti)225.85 631.2 Q -.15(ve)-.25 G +(ly).15 E(.)-.65 E F2(touchline)72 659.4 Q F1(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 +E F3(win)A F1(,)A F3(int y)2.5 E F1(,)A F3(int startx)2.5 E F1(,)A F3(int endx) +2.5 E F1(\);)A .405(This function performs a function similar to)97 675.6 R F2 +(touchwin)2.904 E F1 .404(\(\) on a single line.)B .404(It marks the f)5.404 F +.404(irst change)-.2 F .167(for the gi)97 687.6 R -.15(ve)-.25 G 2.667(nl).15 G +.167(ine to be)153.481 687.6 R F3(startx)2.667 E F1 2.667(,i)C 2.667(fi)221.649 +687.6 S 2.667(ti)230.426 687.6 S 2.667(sb)238.653 687.6 S .167 +(efore the current f)250.21 687.6 R .167 +(irst change mark, and the last change mark is)-.2 F(set to be)97 699.6 Q F3 +(endx)2.5 E F1(if it is currently less than)2.5 E F3(endx)2.5 E F1(.)A EP +%%Page: 13 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 321.976(eP) +134.236 60 S(PS)460.654 60 Q(S1)466.766 60 Q(1:)472.328 60 Q(:1)477.33 60 Q(19) +480.662 60 Q(9-)485.664 60 Q(-1)490.666 60 Q(13)493.998 60 Q(3)499 60 Q/F1 10 +/Courier-Bold@0 SF(touchoverlap)72 96 Q/F2 10/Times-Roman@0 SF(\()A/F3 10 +/Times-Italic@0 SF(WINDO)A(W)-.5 E/F4 10/Symbol SF(*)2.5 E F3(win1)A F2(,)A F3 +(WINDO)2.5 E(W)-.5 E F4(*)2.5 E F3(win2)A F2(\);)A -.8(To)97 112.2 S .2 +(uch the windo).8 F(w)-.25 E F3(win2)2.7 E F2 .2(in the area which o)2.7 F -.15 +(ve)-.15 G .199(rlaps with).15 F F3(win1)2.699 E F2 5.199(.I)C 2.699(ft)355.317 +112.2 S(he)364.126 112.2 Q 2.699(yd)-.15 G 2.699(on)386.115 112.2 S .199(ot o) +398.814 112.2 R -.15(ve)-.15 G .199(rlap, no changes are).15 F(made.)97 124.2 Q +F1(touchwin)72 152.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A +(Mak)97 168.6 Q 2.747(ei)-.1 G 2.747(ta)125.197 168.6 S .247(ppear that the e) +135.164 168.6 R -.15(ve)-.25 G .248(ry location on the windo).15 F 2.748(wh) +-.25 G .248(as been changed.)319.794 168.6 R .248(This is usually only needed) +5.248 F(for refreshes with o)97 180.6 Q -.15(ve)-.15 G(rlapping windo).15 E +(ws.)-.25 E F1(tstp)72 208.8 Q F2(\(\))A .35(This function will sa)97 225 R .65 +-.15(ve t)-.2 H .35(he current tty state and then put the process to sleep.).15 +F .35(When the process gets)5.35 F 1.882(restarted, it restores the sa)97 237 R +-.15(ve)-.2 G 4.382(dt).15 G 1.882(ty state and then calls)229.92 237 R F1 +(wrefresh)4.382 E F2(\()A F3(cur)A(scr)-.1 E F2 1.882(\); to redra)B 4.383(wt) +-.15 G 1.883(he screen.)462.137 237 R F1(Initscr)97 249 Q F2 +(\(\) sets the signal SIGTSTP to trap to this routine.)A F1(unctrl)72 277.2 Q +F2(\()A F3 -.15(ch)C(ar).15 E F4(*)2.5 E F3 -.15(ch)C F2<293b87>.15 E +(Returns a string which is an ASCII representation of)97 293.4 Q F3 -.15(ch)2.5 +G F2 5(.C).15 G(haracters are 8 bits long.)332.93 293.4 Q F1(unctrllen)72 321.6 +Q F2(\()A F3 -.15(ch)C(ar).15 E F4(*)2.5 E F3 -.15(ch)C F2<293b87>.15 E +(Returns the length of the ASCII representation of)97 337.8 Q F3 -.15(ch)2.5 G +F2(.).15 E F1(vwprintw)72 366 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A +F2(,)A F3(const c)2.5 E(har)-.15 E F4(*)2.5 E F3(fmt)A F2(,)A F3(va_list ap)2.5 +E F2(\);)A 1.134(Identical to)97 382.2 R F1(printw)3.634 E F2 1.133(\(\) e)B +1.133(xcept that it tak)-.15 F 1.133(es both a windo)-.1 F 3.633(ws)-.25 G +(pecif)343.802 382.2 Q 1.133(ication and a pointer to a v)-.2 F(ariable)-.25 E +(length ar)97 394.2 Q(gument list.)-.18 E F1(vwscanw)72 422.4 Q F2(\()A F3 +(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3(const c)2.5 E(har)-.15 E F4(*) +2.5 E F3(fmt)A F2(,)A F3(va_list ap)2.5 E F2(\);)A 1.508(Identical to)97 438.6 +R F1(scanw)4.008 E F2 1.508(\(\) e)B 1.508(xcept that it tak)-.15 F 1.508 +(es both a windo)-.1 F 4.008(ws)-.25 G(pecif)341.55 438.6 Q 1.508 +(ication and a pointer to a v)-.2 F(ariable)-.25 E(length ar)97 450.6 Q +(gument list.)-.18 E F1(waddbytes)72 478.8 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*) +2.5 E F3(win)A F2(,)A F3 -.15(ch)2.5 G(ar).15 E F4(*)2.5 E F3(str)A F2(,)A F3 +(int len)2.5 E F2(\);)A .307(This function is the lo)97 495 R 2.807(wl)-.25 G +-2.15 -.25(ev e)198.565 495 T 2.807(lc).25 G .307(haracter output function.) +222.072 495 R F3(Len)5.306 E F2 .306(characters of the string)2.806 F F3(str) +2.806 E F2 .306(are output to)2.806 F(the current \(y)97 507 Q 2.5(,x)-.65 G +2.5(\)c)160.22 507 S(o-ordinates position of the windo)170.49 507 Q 2.5(ws)-.25 +G(pecif)316.62 507 Q(ied by)-.2 E F3(win.)2.5 E 1.29 +(The following functions dif)97 547.2 R 1.29(fer fr)-.18 F 1.291 +(om the standar)-.45 F 3.791(df)-.37 G 1.291(unctions only in their specif) +303.113 547.2 R 1.291(ication of a window)-.2 F(,)-.74 E -.15(ra)72 559.2 S +(ther than the use of the default stdscr).15 E(.)-1.11 E F1(waddch)72 587.4 Q +F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3 -.15(ch)2.5 G(ar c).15 +E(h)-.15 E F2(\);)A F1(waddstr)72 599.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E +F3(win)A F2(,)A F3 -.15(ch)2.5 G(ar).15 E F4(*)2.5 E F3(str)A F2(\);)A F1 +(wclear)72 611.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wclrtobot)72 623.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A +F1(wclrtoeol)72 635.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A +F1(wdelch)72 647.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wdeleteln)72 659.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A +F1(werase)72 671.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wgetch)72 683.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wgetstr)72 695.4 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3 +-.15(ch)2.5 G(ar).15 E F4(*)2.5 E F3(str)A F2(\);)A F1(winch)72 707.4 Q F2(\()A +F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2<293b87>A F1(winsch)72 719.4 Q F2(\()A +F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3 -.15(ch)2.5 G(ar c).15 E F2 +(\);)A EP +%%Page: 14 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G -4.998 +(11)3.328 G 329.472 -4.998(44 S)4.998 H(Sc)-.56 E(cr)442.888 60 Q -.18(re) +447.33 60 S(ee)451.592 60 Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 +60 S(ac)474.55 60 Q(ck)479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 +60 Q(e)499.56 60 Q/F1 10/Courier-Bold@0 SF(winsertln)72 96 Q/F2 10 +/Times-Roman@0 SF(\()A/F3 10/Times-Italic@0 SF(WINDO)A(W)-.5 E/F4 10/Symbol SF +(*)2.5 E F3(win)A F2(\);)A F1(wmove)72 108 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*) +2.5 E F3(win)A F2(,)A F3(int y)2.5 E F2(,)A F3(int)2.5 E F2(,)A F3(x")2.5 E F2 +(\);)A F1(wprintw)72 120 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,) +A F3 -.15(ch)2.5 G(ar).15 E F4(*)2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A F1 +(wrefresh)72 132 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wscanw)72 144 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(,)A F3 -.15 +(ch)2.5 G(ar).15 E F4(*)2.5 E F3(fmt)A F2(,)A F3(...)2.5 E F2(\);)A F1 +(wstandend)72 156 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A F1 +(wstandout)72 168 Q F2(\()A F3(WINDO)A(W)-.5 E F4(*)2.5 E F3(win)A F2(\);)A EP +%%Page: 15 14 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 321.976(eP) +134.236 60 S(PS)460.654 60 Q(S1)466.766 60 Q(1:)472.328 60 Q(:1)477.33 60 Q(19) +480.662 60 Q(9-)485.664 60 Q(-1)490.666 60 Q(15)493.998 60 Q(5)499 60 Q -4.998 +(11)72 96 S 7.496 -2.498(.. E)4.998 H(Ex)84.506 96 Q(xa)91.178 96 Q(am)96.18 96 +Q(mp)101.182 96 Q(pl)109.514 96 Q(le)115.076 96 Q(es)117.858 96 Q(s)122.3 96 Q +/F1 10/Times-Roman@0 SF 1.752(Here we present a fe)97 112.2 R 4.252(we)-.25 G +1.752(xamples of ho)201.7 112.2 R 4.252(wt)-.25 G 4.252(ou)275.866 112.2 S +1.752(se the package.)290.118 112.2 R(The)6.752 E 4.252(ya)-.15 G 1.751 +(ttempt to be representati)390.276 112.2 R -.15(ve)-.25 G(,).15 E .729 +(though not comprehensi)72 124.2 R -.15(ve)-.25 G 5.729(.F).15 G .729(urther e) +192.947 124.2 R .729(xamples can be found in the g)-.15 F .73 +(ames section of the source tree and in)-.05 F -.25(va)72 136.2 S +(rious utilities that use the screen such as).25 E/F2 10/Times-Italic@0 SF +(systat\(1\))2.5 E F1(.)A .258(The follo)97 152.4 R .258(wing e)-.25 F .258(xa\ +mples are intended to demonstrate the basic structure of a program using the p\ +ack-)-.15 F 2.98(age. An)72 164.4 R .48(additional, more comprehensi)2.98 F +-.15(ve)-.25 G 2.98(,p).15 G .481 +(rogram can be found in the source code in the)248.69 164.4 R F2 -.2(ex)2.981 G +(amples).2 E F1(subdi-)2.981 E(rectory)72 176.4 Q(.)-.65 E F0 -4.998(11)72 +200.4 S -2.498(..)4.998 G -4.998(11)2.498 G 7.496 -2.498(.. S)4.998 H(Si)92.01 +200.4 Q(im)97.572 200.4 Q(mp)100.354 200.4 Q(pl)108.686 200.4 Q(le)114.248 +200.4 Q 2.5(eC)117.03 200.4 S(Ch)123.972 200.4 Q(ha)131.194 200.4 Q(ar)136.756 +200.4 Q(ra)141.758 200.4 Q(ac)146.2 200.4 Q(ct)151.202 200.4 Q(te)155.644 200.4 +Q(er)158.976 200.4 Q 2.5(rO)163.418 200.4 S(Ou)170.36 200.4 Q(ut)178.142 200.4 +Q(tp)183.704 200.4 Q(pu)187.036 200.4 Q(ut)192.598 200.4 Q(t)198.16 200.4 Q F1 +.107(This program demonstrates ho)97 216.6 R 2.607(wt)-.25 G 2.607(os)231.608 +216.6 S .107(et up a windo)243.105 216.6 R 2.607(wa)-.25 G .107 +(nd output characters to it.)311.603 216.6 R .106(Also, it demonstrates)5.107 F +(ho)72 228.6 Q 2.959(wo)-.25 G .459(ne might control the output to the windo) +96.929 228.6 R 4.259 -.65(w. I)-.25 H 2.959(fy).65 G .46 +(ou run this program, you will get a demonstration of)290.43 228.6 R +(the character output chracteristics discussed in the abo)72 240.6 Q .3 -.15 +(ve C)-.15 H(haracter Output section.).15 E F0 -4.998(##)112 256.8 S -2.778(ii) +4.998 G -5.558(nn)2.778 G -4.438(cc)5.558 G -2.778(ll)4.438 G -5.558(uu)2.778 G +-5.558(dd)5.558 G -4.438(ee)5.558 G F1(<sys)6.938 E F2(/)-.28 E F1(types.h>)A +F0 -4.998(##)112 268.8 S -2.778(ii)4.998 G -5.558(nn)2.778 G -4.438(cc)5.558 G +-2.778(ll)4.438 G -5.558(uu)2.778 G -5.558(dd)5.558 G -4.438(ee)5.558 G F1 +(<curses.h>)6.938 E F0 -4.998(##)112 280.8 S -2.778(ii)4.998 G -5.558(nn)2.778 +G -4.438(cc)5.558 G -2.778(ll)4.438 G -5.558(uu)2.778 G -5.558(dd)5.558 G +-4.438(ee)5.558 G F1(<stdio.h>)6.938 E F0 -4.998(##)112 292.8 S -2.778(ii)4.998 +G -5.558(nn)2.778 G -4.438(cc)5.558 G -2.778(ll)4.438 G -5.558(uu)2.778 G +-5.558(dd)5.558 G -4.438(ee)5.558 G F1(<signal.h>)6.938 E F0 -4.998(##)112 +328.8 S -5.558(dd)4.998 G -4.438(ee)5.558 G 3.906 -3.328(ff i)4.438 H(in).55 E +(ne)132.872 328.8 Q(e)138.434 328.8 Q F1(YSIZE 10)2.5 E F0 -4.998(##)112 340.8 +S -5.558(dd)4.998 G -4.438(ee)5.558 G 3.906 -3.328(ff i)4.438 H(in).55 E(ne) +132.872 340.8 Q(e)138.434 340.8 Q F1(XSIZE 20)2.5 E F0 -2.778(ii)112 364.8 S +-5.558(nn)2.778 G -3.328(tt)5.558 G F1(quit\(\);)5.828 E(main\(\))112 388.8 Q +F0 -3.938({{)112 400.8 S -2.778(ii)167 412.8 S -5.558(nn)2.778 G -3.328(tt) +5.558 G F1(i, j, c;)5.828 E(size)167 424.8 Q/F3 10/Symbol SF(-)182.55 429.8 Q +F1 2.5(tl)188.04 424.8 S(en;)196.1 424.8 Q F0 -4.438(cc)167 436.8 S -5.558(hh) +4.438 G -4.998(aa)5.558 G -4.438(rr)4.998 G F1(id[100];)6.938 E(FILE)167 448.8 +Q F3(*)2.5 E F1(fp;)A F0 -4.438(cc)167 460.8 S -5.558(hh)4.438 G -4.998(aa) +5.558 G -4.438(rr)4.998 G F3(*)6.938 E F1(s;)A(initscr\(\);)167 484.8 Q F2(/) +366.72 484.8 Q F3(*)A F2(Always call initscr\(\) f)2.5 E(ir)-.2 E(st)-.1 E F3 +(*)2.5 E F2(/)-.28 E F1(signal\(SIGINT)167 496.8 Q 2.5(,q)-.74 G(uit\);)236.25 +496.8 Q F2(/)366.72 496.8 Q F3(*)A F2(Mak)2.5 E 2.5(es)-.1 G(ur)405.5 496.8 Q +2.5(ew)-.37 G(ou have a \264cleanup\264 fn)427.63 496.8 Q F3(*)2.5 E F2(/)-.28 +E F1(crmode\(\);)167 508.8 Q F2(/)366.72 508.8 Q F3(*)A F2 1.84 -.92(We w)2.5 H +(ant cbr).92 E(eak mode)-.37 E F3(*)2.5 E F2(/)-.28 E F1(noecho\(\);)167 520.8 +Q F2(/)366.72 520.8 Q F3(*)A F2 1.84 -.92(We w)2.5 H(ant to have contr).92 E +(ol of c)-.45 E(har)-.15 E(s)-.1 E F3(*)2.5 E F2(/)-.28 E F1(del)167 532.8 Q +(win\(stdscr\);)-.1 E F2(/)366.72 532.8 Q F3(*)A F2(Cr)2.5 E +(eate our own stdscr)-.37 E F3(*)2.5 E F2(/)-.28 E F1(stdscr = ne)167 544.8 Q +(wwin\(YSIZE, XSIZE, 10, 35\);)-.25 E(flushok\(stdscr)167 556.8 Q 2.5(,T)-.4 G +-.4(RU)234.37 556.8 S(E\);).4 E F2(/)366.72 556.8 Q F3(*)A F2 +(Enable flushing of stdout)2.5 E F3(*)2.5 E F2(/)-.28 E F1(scrollok\(stdscr)167 +568.8 Q 2.5(,T)-.4 G -.4(RU)236.59 568.8 S(E\);).4 E F2(/)366.72 568.8 Q F3(*)A +F2(Enable scr)2.5 E(olling)-.45 E F3(*)2.5 E F2(/)-.28 E F1(erase\(\);)167 +580.8 Q F2(/)366.72 580.8 Q F3(*)A F2(Initially)2.5 E 2.5(,c)-.55 G +(lear the scr)417.56 580.8 Q(een)-.37 E F3(*)2.5 E F2(/)-.28 E F1 +(standout\(\);)167 604.8 Q(mo)167 616.8 Q -.15(ve)-.15 G(\(0,0\);).15 E F0 +-7.218(ww)167 628.8 S -5.558(hh)7.218 G -2.778(ii)5.558 G -2.778(ll)2.778 G +-4.438(ee)2.778 G F1(\(1\))6.938 E F0 -3.938({{)2.5 G F1 2.5(c=g)217 640.8 S +(etchar\(\);)237.08 640.8 Q F0 -3.888(ss)217 652.8 S -7.218(ww)3.888 G -2.778 +(ii)7.218 G -3.328(tt)2.778 G -4.438(cc)3.328 G -5.558(hh)4.438 G F1(\(c\)) +5.558 E F0 -3.938({{)2.5 G -4.438(cc)217 664.8 S -4.998(aa)4.438 G -3.888(ss) +4.998 G -4.438(ee)3.888 G F1<b471b43a>6.938 E F2(/)366.72 664.8 Q F3(*)A F2 +(Quit on \264q\264)2.5 E F3(*)2.5 E F2(/)-.28 E F1(quit\(\);)267 676.8 Q F0 +-5.558(bb)267 688.8 S 6.196 -4.438(rr ee)5.558 H -4.998(aa)4.438 G -5.558(kk) +4.998 G F1(;)5.558 E EP +%%Page: 16 15 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G -4.998 +(11)3.328 G 275.804 -4.998(66 S)4.998 H(Sc)-.56 E(cr)389.22 60 Q -.18(re) +393.662 60 S(ee)397.924 60 Q(en)402.366 60 Q 2.5(nP)406.808 60 S -.1(Pa)414.87 +60 S(ac)420.882 60 Q(ck)425.884 60 Q(ka)430.326 60 Q(ag)435.888 60 Q(ge)440.89 +60 Q 2.5(eA)445.892 60 S -.25(Ap)452.834 60 S(pp)459.806 60 Q(pe)465.368 60 Q +(en)470.93 60 Q(nd)475.372 60 Q(di)480.934 60 Q(ix)486.496 60 Q 2.5(xA)489.278 +60 S(A)496.78 60 Q -4.438(cc)217 96 S -4.998(aa)4.438 G -3.888(ss)4.998 G +-4.438(ee)3.888 G/F1 10/Times-Roman@0 SF<b473b43a>6.938 E/F2 10/Times-Italic@0 +SF(/)366.72 96 Q/F3 10/Symbol SF(*)A F2(Go into standout mode on \264s\264)2.5 +E F3(*)2.5 E F2(/)-.28 E F1(standout\(\);)267 108 Q F0 -5.558(bb)267 120 S +6.196 -4.438(rr ee)5.558 H -4.998(aa)4.438 G -5.558(kk)4.998 G F1(;)5.558 E F0 +-4.438(cc)217 132 S -4.998(aa)4.438 G -3.888(ss)4.998 G -4.438(ee)3.888 G F1 +<b465b43a>6.938 E F2(/)366.72 132 Q F3(*)A F2(Exit standout mode on \264e\264) +2.5 E F3(*)2.5 E F2(/)-.28 E F1(standend\(\);)267 144 Q F0 -5.558(bb)267 156 S +6.196 -4.438(rr ee)5.558 H -4.998(aa)4.438 G -5.558(kk)4.998 G F1(;)5.558 E F0 +-4.438(cc)217 168 S -4.998(aa)4.438 G -3.888(ss)4.998 G -4.438(ee)3.888 G F1 +<b472b43a>6.938 E F2(/)366.72 168 Q F3(*)A F2 -1.05(Fo)2.5 G -.37(rc)1.05 G 2.5 +(ear).37 G(efr)412.98 168 Q(esh on \264r\264)-.37 E F3(*)2.5 E F2(/)-.28 E F1 +(wrefresh\(curscr\);)267 180 Q F0 -5.558(bb)267 192 S 6.196 -4.438(rr ee)5.558 +H -4.998(aa)4.438 G -5.558(kk)4.998 G F1(;)5.558 E F0 -5.558(dd)217 204 S +-4.438(ee)5.558 G -3.328(ff)4.438 G -4.998(aa)3.328 G -5.558(uu)4.998 G -2.778 +(ll)5.558 G -3.328(tt)2.778 G F1(:)3.328 E F2(/)366.72 204 Q F3(*)A F2 +(By default output the c)2.5 E(har)-.15 E(acter)-.15 E F3(*)2.5 E F2(/)-.28 E +F1(addch\(c\);)267 216 Q(refresh\(\);)267 228 Q F0 -3.938(}})217 240 S -3.938 +(}})167 252 S -3.938(}})112 264 S -2.778(ii)112 300 S -5.558(nn)2.778 G -3.328 +(tt)5.558 G F1(quit\(\))112 312 Q F0 -3.938({{)112 324 S F1(erase\(\);)167 336 +Q F2(/)316.72 336 Q F3(*)A F2 -.92(Te)2.5 G(rminate by er).92 E(asing the scr) +-.15 E(een)-.37 E F3(*)2.5 E F2(/)-.28 E F1(refresh\(\);)167 348 Q(endwin\(\);) +167 360 Q F2(/)316.72 360 Q F3(*)A F2(Always end with endwin\(\))2.5 E F3(*)2.5 +E F2(/)-.28 E F1(del)167 372 Q(win\(curscr\);)-.1 E F2(/)316.72 372 Q F3(*)A F2 +(Return stor)2.5 E -.1(age)-.15 G F3(*)2.6 E F2(/)-.28 E F1(del)167 384 Q +(win\(stdscr\);)-.1 E(putchar\(\264\\n\264\);)167 396 Q -.15(ex)167 408 S +(it\(0\);).15 E F0 -3.938(}})112 420 S -4.998(11)72 496.2 S -2.498(..)4.998 G +-4.998(22)2.498 G 7.496 -2.498(.. T)4.998 H -.74(Tw)92.01 496.2 S(wi)97.942 +496.2 Q(in)105.164 496.2 Q(nk)107.946 496.2 Q(kl)113.508 496.2 Q(le)119.07 +496.2 Q(e)121.852 496.2 Q F1 .934 +(This is a moderately simple program which prints patterns on the screen.)97 +512.4 R .934(It switches between pat-)5.934 F .501 +(terns of asterisks, putting them on one by one in random order)72 524.4 R +3.002(,a)-.4 G .502(nd then taking them of)335.914 524.4 R 3.002(fi)-.25 G +3.002(nt)437.334 524.4 S .502(he same f)448.116 524.4 R(ash-)-.1 E 2.5(ion. It) +72 536.4 R(is more ef)2.5 E -.2(fi)-.25 G(cient to write this using only the m\ +otion optimization, as is demonstrated belo).2 E -.65(w.)-.25 G F0 9.996 -4.998 +(## i)112 552.6 T(in)2.22 E(nc)122.286 552.6 Q(cl)127.848 552.6 Q(lu)132.29 +552.6 Q(ud)135.072 552.6 Q(de)140.634 552.6 Q(e)146.196 552.6 Q F1(<curses.h>) +217 552.6 Q F0 9.996 -4.998(## i)112 564.6 T(in)2.22 E(nc)122.286 564.6 Q(cl) +127.848 564.6 Q(lu)132.29 564.6 Q(ud)135.072 564.6 Q(de)140.634 564.6 Q(e) +146.196 564.6 Q F1(<signal.h>)217 564.6 Q F2(/)111.72 588.6 Q F3(*)A(*)114.5 +600.6 Q F2(the idea for this pr)2.5 E -.1(og)-.45 G -.15(ra).1 G 2.5(mw).15 G +(as a pr)231.03 600.6 Q(oduct of the ima)-.45 E(gination of)-.1 E F3(*)114.5 +612.6 Q F2 -.4(Ku)2.5 G(rt Sc).4 E 2.5(hoens. Not)-.15 F -.37(re)2.5 G +(sponsible for minds lost or stolen.).37 E F3(*)114.5 624.6 Q F2(/)-.28 E F0 +9.996 -4.998(## d)112 648.6 T(de)-.56 E(ef)125.066 648.6 Q -.25(fi)129.508 +648.6 S(in)132.59 648.6 Q(ne)135.372 648.6 Q(e)140.934 648.6 Q F1 14.72 +(NCOLS 80)217 648.6 R F0 9.996 -4.998(## d)112 660.6 T(de)-.56 E(ef)125.066 +660.6 Q -.25(fi)129.508 660.6 S(in)132.59 660.6 Q(ne)135.372 660.6 Q(e)140.934 +660.6 Q F1 11.95(NLINES 24)217 660.6 R F0 9.996 -4.998(## d)112 672.6 T(de)-.56 +E(ef)125.066 672.6 Q -.25(fi)129.508 672.6 S(in)132.59 672.6 Q(ne)135.372 672.6 +Q(e)140.934 672.6 Q F1(MAXP)217 672.6 Q -1.11(AT)-.92 G 25.64(TERNS 4)1.11 F F0 +-3.328(tt)112 696.6 S -4.998(yy)3.328 G -5.558(pp)4.998 G -4.438(ee)5.558 G +-5.558(dd)4.438 G -4.438(ee)5.558 G 6.656 -3.328(ff s)4.438 H(st)-.56 E(tr) +150.068 696.6 Q(ru)153.4 696.6 Q(uc)157.842 696.6 Q(ct)163.404 696.6 Q 2.5(t{) +167.846 696.6 S({)173.678 696.6 Q -2.778(ii)167 708.6 S -5.558(nn)2.778 G +-3.328(tt)5.558 G F1 1.3 -.65(y, x)217 708.6 T(;).65 E F0 -3.938(}})112 720.6 S +F1(LOCS;)6.438 E EP +%%Page: 17 16 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 2.5(eA) +134.236 60 S -.25(Ap)141.178 60 S(pp)148.15 60 Q(pe)153.712 60 Q(en)159.274 60 +Q(nd)163.716 60 Q(di)169.278 60 Q(ix)174.84 60 Q 2.5(xA)177.622 60 S 268.308 +(AP)185.124 60 S(PS)460.654 60 Q(S1)466.766 60 Q(1:)472.328 60 Q(:1)477.33 60 Q +(19)480.662 60 Q(9-)485.664 60 Q(-1)490.666 60 Q(17)493.998 60 Q(7)499 60 Q/F1 +10/Times-Roman@0 SF 26.94(LOCS Layout[NCOLS)112 96 R/F2 10/Symbol SF(*)2.5 E F1 +(NLINES];)2.5 E/F3 10/Times-Italic@0 SF(/)316.72 96 Q F2(*)A F3(curr)2.5 E +(ent boar)-.37 E 2.5(dl)-.37 G(ayout)387.37 96 Q F2(*)2.5 E F3(/)-.28 E F0 +-2.778(ii)112 120 S -5.558(nn)2.778 G -3.328(tt)5.558 G F1 -.15(Pa)167 120 S +(ttern,).15 E F3(/)316.72 120 Q F2(*)A F3(curr)2.5 E(ent pattern number)-.37 E +F2(*)2.5 E F3(/)-.28 E F1(Numstars;)167 132 Q F3(/)316.72 132 Q F2(*)A F3 +(number of star)2.5 E 2.5(si)-.1 G 2.5(np)394.96 132 S(attern)407.46 132 Q F2 +(*)2.5 E F3(/)-.28 E F0 -4.438(cc)112 156 S -5.558(hh)4.438 G -4.998(aa)5.558 G +-4.438(rr)4.998 G F2(*)167 156 Q F1(geten)A(v\(\);)-.4 E F0 -2.778(ii)112 180 S +-5.558(nn)2.778 G -3.328(tt)5.558 G F1(die\(\);)167 180 Q(main\(\))112 204 Q F0 +-3.938({{)112 216 S F1(srand\(getpid\(\)\);)167 228 Q F3(/)366.72 228 Q F2(*)A +F3(initialize r)2.5 E(andom sequence)-.15 E F2(*)2.5 E F3(/)-.28 E F1 +(initscr\(\);)167 252 Q(signal\(SIGINT)167 264 Q 2.5(,d)-.74 G(ie\);)236.25 264 +Q(noecho\(\);)167 276 Q(nonl\(\);)167 288 Q(lea)167 300 Q -.15(ve)-.2 G +(ok\(stdscr).15 E 2.5(,T)-.4 G -.4(RU)235.12 300 S(E\);).4 E(scrollok\(stdscr) +167 312 Q 2.5(,F)-.4 G(ALSE\);)235.3 312 Q F0 3.906 -3.328(ff o)167 336 T(or) +-1.67 E(r)175.086 336 Q F1(\(;;\))2.5 E F0 -3.938({{)2.5 G F1(mak)217 348 Q +(eboard\(\);)-.1 E F3(/)366.72 348 Q F2(*)A F3(mak)2.5 E 2.5(et)-.1 G(he boar) +403.28 348 Q 2.5(ds)-.37 G(etup)445.13 348 Q F2(*)2.5 E F3(/)-.28 E F1 +(puton\(\264)217 360 Q F2(*)A F1<b4293b>A F3(/)366.72 360 Q F2(*)A F3 +(put on \264)2.5 E F2(*)A F3<b473>A F2(*)2.5 E F3(/)-.28 E F1 +(puton\(\264 \264\);)217 372 Q F3(/)366.72 372 Q F2(*)A F3(co)2.5 E +(ver up with \264 \264s)-.1 E F2(*)2.5 E F3(/)-.28 E F0 -3.938(}})167 384 S +-3.938(}})112 396 S F3(/)111.72 420 Q F2(*)A(*)114.5 432 Q F3(On pr)2.5 E -.1 +(og)-.45 G -.15(ra).1 G 2.5(me).15 G(xit, mo)177.76 432 Q(ve the cur)-.1 E +(sor to the lower left corner by)-.1 E F2(*)114.5 444 Q F3(dir)2.5 E(ect addr) +-.37 E(essing)-.37 E 2.5(,s)-.1 G(ince curr)199.77 444 Q +(ent location is not guar)-.37 E(anteed.)-.15 E F2(*)114.5 456 Q F3 1.84 -.92 +(We l)2.5 H(ie and say we used to be at the upper right corner to guar).92 E +(antee)-.15 E F2(*)114.5 468 Q F3(absolute addr)2.5 E(essing.)-.37 E F2(*)114.5 +480 Q F3(/)-.28 E F1(die\(\))112 492 Q F0 -3.938({{)112 504 S F1 +(signal\(SIGINT)167 516 Q 2.5(,S)-.74 G(IG)236.81 516 Q F2(-)247.36 521 Q F1 +(IGN\);)252.85 516 Q(mvcur\(0, COLS)167 528 Q F2(-)2.5 E F1(1, LINES)2.5 E F2 +(-)2.5 E F1(1, 0\);)2.5 E(endwin\(\);)167 540 Q -.15(ex)167 552 S(it\(0\);).15 +E F0 -3.938(}})112 564 S F3(/)111.72 600 Q F2(*)A(*)114.5 612 Q F3(Mak)2.5 E +2.5(et)-.1 G(he curr)149.39 612 Q(ent boar)-.37 E 2.5(ds)-.37 G 2.5(etup. It) +222.81 612 R(pic)2.5 E(ks a r)-.2 E(andom pattern and)-.15 E F2(*)114.5 624 Q +F3(calls ison\(\) to determine if the c)2.5 E(har)-.15 E +(acter is on that pattern)-.15 E F2(*)114.5 636 Q F3(or not.)2.5 E F2(*)114.5 +648 Q F3(/)-.28 E F1(mak)112 660 Q(eboard\(\))-.1 E F0 -3.938({{)112 672 S F1 +(re)167 684 Q(g)-.15 E F0 -2.778(ii)2.5 G -5.558(nn)2.778 G -3.328(tt)5.558 G +F1 1.3 -.65(y, x)267 684 T(;).65 E(re)167 696 Q 2.5(gL)-.15 G(OCS)188.23 696 Q +F2(*)267 696 Q F1(lp;)A -.15(Pa)167 720 S(ttern = rand\(\) % MAXP).15 E -1.11 +(AT)-.92 G(TERNS;)1.11 E EP +%%Page: 18 17 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G -4.998 +(11)3.328 G 275.804 -4.998(88 S)4.998 H(Sc)-.56 E(cr)389.22 60 Q -.18(re) +393.662 60 S(ee)397.924 60 Q(en)402.366 60 Q 2.5(nP)406.808 60 S -.1(Pa)414.87 +60 S(ac)420.882 60 Q(ck)425.884 60 Q(ka)430.326 60 Q(ag)435.888 60 Q(ge)440.89 +60 Q 2.5(eA)445.892 60 S -.25(Ap)452.834 60 S(pp)459.806 60 Q(pe)465.368 60 Q +(en)470.93 60 Q(nd)475.372 60 Q(di)480.934 60 Q(ix)486.496 60 Q 2.5(xA)489.278 +60 S(A)496.78 60 Q/F1 10/Times-Roman@0 SF(lp = Layout;)167 96 Q F0 3.906 -3.328 +(ff o)167 108 T(or)-1.67 E(r)175.086 108 Q F1(\(y = 0; y < NLINES; y++\))2.5 E +F0 3.906 -3.328(ff o)217 120 T(or)-1.67 E(r)225.086 120 Q F1 +(\(x = 0; x < NCOLS; x++\))2.5 E F0 -2.778(ii)267 132 S -3.328(ff)2.778 G F1 +(\(ison\(y)5.828 E 2.5(,x)-.65 G(\)\))313.294 132 Q F0 -3.938({{)2.5 G F1(lp) +317 144 Q/F2 10/Symbol SF(-)A F1(>y = y;)A(lp)317 156 Q F2(-)A F1(>x = x;)A +(lp++;)317 168 Q F0 -3.938(}})267 180 S F1(Numstars = lp)167 192 Q F2(-)2.5 E +F1(Layout;)2.5 E F0 -3.938(}})112 204 S/F3 10/Times-Italic@0 SF(/)111.72 228 Q +F2(*)A(*)114.5 240 Q F3(Return TR)2.5 E(UE if \(y)-.4 E 2.5(,x)-.55 G 2.5(\)i) +203.54 240 S 2.5(so)212.15 240 S 2.5(nt)223.54 240 S(he curr)233.82 240 Q +(ent pattern.)-.37 E F2(*)114.5 252 Q F3(/)-.28 E F1(ison\(y)112 264 Q 2.5(,x) +-.65 G(\))146.35 264 Q(re)112 276 Q(g)-.15 E F0 -2.778(ii)2.5 G -5.558(nn)2.778 +G -3.328(tt)5.558 G F1 1.3 -.65(y, x)167 276 T(;).65 E F0 -3.938({{)2.5 G +-3.888(ss)167 300 S -7.218(ww)3.888 G -2.778(ii)7.218 G -3.328(tt)2.778 G +-4.438(cc)3.328 G -5.558(hh)4.438 G F1(\(P)8.058 E(attern\))-.15 E F0 -3.938 +({{)2.5 G -4.438(cc)172 312 S -4.998(aa)4.438 G -3.888(ss)4.998 G -4.438(ee) +3.888 G F1(0:)6.938 E F3(/)266.72 312 Q F2(*)A F3(alternating lines)2.5 E F2(*) +2.5 E F3(/)-.28 E F0 6.196 -4.438(rr ee)217 324 T -3.328(tt)4.438 G -5.558(uu) +3.328 G 6.226 -4.438(rr n)5.558 H(n)-1.12 E F1(!\(y & 01\);)2.5 E F0 -4.438(cc) +172 336 S -4.998(aa)4.438 G -3.888(ss)4.998 G -4.438(ee)3.888 G F1(1:)6.938 E +F3(/)266.72 336 Q F2(*)A F3(box)2.5 E F2(*)2.5 E F3(/)-.28 E F0 -2.778(ii)217 +348 S -3.328(ff)2.778 G F1(\(x >= LINES && y >= NCOLS\))5.828 E F0 6.196 -4.438 +(rr ee)267 360 T -3.328(tt)4.438 G -5.558(uu)3.328 G 6.226 -4.438(rr n)5.558 H +(n)-1.12 E F1 -.74(FA)2.5 G(LSE;).74 E F0 -2.778(ii)217 372 S -3.328(ff)2.778 G +F1(\(y < 3 || y >= NLINES)5.828 E F2(-)2.5 E F1(3\))2.5 E F0 6.196 -4.438 +(rr ee)267 384 T -3.328(tt)4.438 G -5.558(uu)3.328 G 6.226 -4.438(rr n)5.558 H +(n)-1.12 E F1(TR)2.5 E(UE;)-.4 E F0 6.196 -4.438(rr ee)217 396 T -3.328(tt) +4.438 G -5.558(uu)3.328 G 6.226 -4.438(rr n)5.558 H(n)-1.12 E F1 +(\(x < 3 || x >= NCOLS)2.5 E F2(-)2.5 E F1(3\);)2.5 E F0 -4.438(cc)172 408 S +-4.998(aa)4.438 G -3.888(ss)4.998 G -4.438(ee)3.888 G F1(2:)6.938 E F3(/)266.72 +408 Q F2(*)A F3(holy pattern!)2.5 E F2(*)2.5 E F3(/)-.28 E F0 6.196 -4.438 +(rr ee)217 420 T -3.328(tt)4.438 G -5.558(uu)3.328 G 6.226 -4.438(rr n)5.558 H +(n)-1.12 E F1(\(\(x + y\) & 01\);)2.5 E F0 -4.438(cc)172 432 S -4.998(aa)4.438 +G -3.888(ss)4.998 G -4.438(ee)3.888 G F1(3:)6.938 E F3(/)266.72 432 Q F2(*)A F3 +(bar acr)2.5 E(oss center)-.45 E F2(*)2.5 E F3(/)-.28 E F0 6.196 -4.438(rr ee) +217 444 T -3.328(tt)4.438 G -5.558(uu)3.328 G 6.226 -4.438(rr n)5.558 H(n)-1.12 +E F1(\(y >= 9 && y <= 15\);)2.5 E F0 -3.938(}})167 456 S F3(/)166.72 468 Q F2 +(*)A F3(NO)2.5 E(TREA)-.4 E(CHED)-.3 E F2(*)2.5 E F3(/)-.28 E F0 -3.938(}})112 +480 S F1(puton\(ch\))112 504 Q(re)112 516 Q(g)-.15 E F0 -4.438(cc)2.5 G -5.558 +(hh)4.438 G -4.998(aa)5.558 G -4.438(rr)4.998 G F1(ch;)217 516 Q F0 -3.938({{) +112 528 S F1(re)167 540 Q 2.5(gL)-.15 G(OCS)188.23 540 Q F2(*)267 540 Q F1(lp;) +A(re)167 552 Q(g)-.15 E F0 -2.778(ii)2.5 G -5.558(nn)2.778 G -3.328(tt)5.558 G +F1(r;)267 552 Q(re)167 564 Q 2.5(gL)-.15 G(OCS)188.23 564 Q F2(*)267 564 Q F1 +(end;)A 71.94(LOCS temp;)167 576 R(end = &Layout[Numstars];)167 600 Q F0 3.906 +-3.328(ff o)167 612 T(or)-1.67 E(r)175.086 612 Q F1 +(\(lp = Layout; lp < end; lp++\))2.5 E F0 -3.938({{)2.5 G F1 2.5(r=r)217 624 S +(and\(\) % Numstars;)234.3 624 Q(temp =)217 636 Q F2(*)2.5 E F1(lp;)A F2(*)217 +648 Q F1(lp = Layout[r];)A(Layout[r] = temp;)217 660 Q F0 -3.938(}})167 672 S +3.906 -3.328(ff o)167 696 T(or)-1.67 E(r)175.086 696 Q F1 +(\(lp = Layout; lp < end; lp++\))2.5 E F0 -3.938({{)2.5 G F1(mv)217 708 Q +(addch\(lp)-.25 E F2(-)A F1(>y)A 2.5(,l)-.65 G(p)287.78 708 Q F2(-)A F1 +(>x, ch\);)A(refresh\(\);)217 720 Q EP +%%Page: 19 18 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -5.558(SS)72 60 S -4.438(cc)5.558 G 6.196 -4.438(rr ee) +4.438 H -4.438(ee)4.438 G 11.116 -5.558(nn P)4.438 H -.1(Pa)-.55 G(ac)109.226 +60 Q(ck)114.228 60 Q(ka)118.67 60 Q(ag)124.232 60 Q(ge)129.234 60 Q 2.5(eA) +134.236 60 S -.25(Ap)141.178 60 S(pp)148.15 60 Q(pe)153.712 60 Q(en)159.274 60 +Q(nd)163.716 60 Q(di)169.278 60 Q(ix)174.84 60 Q 2.5(xA)177.622 60 S 268.308 +(AP)185.124 60 S(PS)460.654 60 Q(S1)466.766 60 Q(1:)472.328 60 Q(:1)477.33 60 Q +(19)480.662 60 Q(9-)485.664 60 Q(-1)490.666 60 Q(19)493.998 60 Q(9)499 60 Q +-3.938(}})167 96 S -3.938(}})112 108 S EP +%%Page: 2 19 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Bold@0 SF -6.108(PP)72 60 S -5.558(SS)6.108 G -4.998(11)5.558 G +-3.328(::)4.998 G -4.998(11)3.328 G -4.998(99)4.998 G -3.328(--)4.998 G 334.474 +-4.998(22 S)3.328 H(Sc)-.56 E(cr)442.888 60 Q -.18(re)447.33 60 S(ee)451.592 60 +Q(en)456.034 60 Q 2.5(nP)460.476 60 S -.1(Pa)468.538 60 S(ac)474.55 60 Q(ck) +479.552 60 Q(ka)483.994 60 Q(ag)489.556 60 Q(ge)494.558 60 Q(e)499.56 60 Q/F1 +10/Times-BoldItalic@0 SF(Contents)72 96 Q/F2 10/Times-Roman@0 SF 2.5(1O)72 +122.4 S -.15(ve)86.72 122.4 S(rvie).15 E 4.47(w.)-.25 G 28.5(.................\ +..............................................................................\ +.......................................... 3)125.5 122.4 R(1.1 T)102 136.8 Q +1.98(erminology ..............................................................\ +........................................................)-.7 F(3)499 136.8 Q +(1.2 Compiling Applications)102 151.2 Q 28.5(.................................\ +................................................................... 3)4.6 F +(1.3 Screen Updating)102 165.6 Q 28.5(........................................\ +........................................................................ 3)4.07 +F(1.4 Naming Con)102 180 Q -.15(ve)-.4 G 1.27(ntions .........................\ +..............................................................................\ +..).15 F(4)499 180 Q 2.5(2V)72 194.4 S 1.29(ariables .........................\ +..............................................................................\ +....................................)85.61 194.4 R(4)499 194.4 Q 2.5(3U)72 +208.8 S 1.01(sage ............................................................\ +..............................................................................\ +......)86.72 208.8 R(4)499 208.8 Q(3.1 Initialization)102 223.2 Q 28.5(.......\ +..............................................................................\ +................................. 5)4.89 F(3.2 Output)102 237.6 Q 28.5(.......\ +..............................................................................\ +........................................... 5)3.22 F(3.3 Input)102 252 Q 28.5(\ +..............................................................................\ +.................................................... 5)4.89 F(3.4 T)102 266.4 Q +2.26(ermination ..............................................................\ +.........................................................)-.7 F(5)499 266.4 Q +2.5(4C)72 280.8 S(ursor Mo)86.17 280.8 Q -.15(ve)-.15 G(ment Optimizations).15 +E 28.5(.......................................................................\ +.............................. 6)4.08 F 2.5(5C)72 295.2 S +(haracter Output and Scrolling)86.17 295.2 Q 28.5(............................\ +............................................................................ 6) +3.24 F 2.5(6T)72 309.6 S(erminal State Handling)84.91 309.6 Q 28.5(...........\ +..............................................................................\ +.......................... 6)2.82 F 2.5(7S)72 324 S(ubwindo)85.06 324 Q 2.08(w\ +s ............................................................................\ +.........................................................)-.25 F(6)499 324 Q +2.5(8T)72 338.4 S(he Functions)85.61 338.4 Q 28.5(............................\ +..............................................................................\ +......................... 6)3.5 F F0 11.686 -7.218(AA p)72 352.8 T(pp)1.66 E +(pe)84.536 352.8 Q(en)90.098 352.8 Q(nd)94.54 352.8 Q(di)100.102 352.8 Q(ix) +105.664 352.8 Q 2.5(xA)108.446 352.8 S(A)115.948 352.8 Q F2 23.5(.............\ +..............................................................................\ +............................................. 15)4.832 F 2.5(1E)72 367.2 S 1.56 +(xamples .....................................................................\ +.....................................................................)85.61 +367.2 R(15)494 367.2 Q(1.1 Simple Character Output)102 381.6 Q 23.5(..........\ +..............................................................................\ +........... 15)3.51 F(1.2 T)102 396 Q .97(winkle .............................\ +..............................................................................\ +...................)-.8 F(16)494 396 Q EP +%%Trailer +end +%%EOF diff --git a/lib/libcurses/PSD.doc/twinkle1.c b/lib/libcurses/PSD.doc/twinkle1.c new file mode 100644 index 00000000000..7d3d00db203 --- /dev/null +++ b/lib/libcurses/PSD.doc/twinkle1.c @@ -0,0 +1,157 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)twinkle1.c 8.1 (Berkeley) 6/8/93 +.\" +# include <curses.h> +# include <signal.h> + +/* + * the idea for this program was a product of the imagination of + * Kurt Schoens. Not responsible for minds lost or stolen. + */ + +# define NCOLS 80 +# define NLINES 24 +# define MAXPATTERNS 4 + +typedef struct { + int y, x; +} LOCS; + +LOCS Layout[NCOLS * NLINES]; /* current board layout */ + +int Pattern, /* current pattern number */ + Numstars; /* number of stars in pattern */ + +char *getenv(); + +int die(); + +main() +{ + srand(getpid()); /* initialize random sequence */ + + initscr(); + signal(SIGINT, die); + noecho(); + nonl(); + leaveok(stdscr, TRUE); + scrollok(stdscr, FALSE); + + for (;;) { + makeboard(); /* make the board setup */ + puton('*'); /* put on '*'s */ + puton(' '); /* cover up with ' 's */ + } +} + +/* + * On program exit, move the cursor to the lower left corner by + * direct addressing, since current location is not guaranteed. + * We lie and say we used to be at the upper right corner to guarantee + * absolute addressing. + */ +die() +{ + signal(SIGINT, SIG_IGN); + mvcur(0, COLS - 1, LINES - 1, 0); + endwin(); + exit(0); +} + + +/* + * Make the current board setup. It picks a random pattern and + * calls ison() to determine if the character is on that pattern + * or not. + */ +makeboard() +{ + reg int y, x; + reg LOCS *lp; + + Pattern = rand() % MAXPATTERNS; + lp = Layout; + for (y = 0; y < NLINES; y++) + for (x = 0; x < NCOLS; x++) + if (ison(y, x)) { + lp->y = y; + lp->x = x; + lp++; + } + Numstars = lp - Layout; +} + +/* + * Return TRUE if (y, x) is on the current pattern. + */ +ison(y, x) +reg int y, x; { + + switch (Pattern) { + case 0: /* alternating lines */ + return !(y & 01); + case 1: /* box */ + if (x >= LINES && y >= NCOLS) + return FALSE; + if (y < 3 || y >= NLINES - 3) + return TRUE; + return (x < 3 || x >= NCOLS - 3); + case 2: /* holy pattern! */ + return ((x + y) & 01); + case 3: /* bar across center */ + return (y >= 9 && y <= 15); + } + /* NOTREACHED */ +} + +puton(ch) +reg char ch; +{ + reg LOCS *lp; + reg int r; + reg LOCS *end; + LOCS temp; + + end = &Layout[Numstars]; + for (lp = Layout; lp < end; lp++) { + r = rand() % Numstars; + temp = *lp; + *lp = Layout[r]; + Layout[r] = temp; + } + + for (lp = Layout; lp < end; lp++) { + mvaddch(lp->y, lp->x, ch); + refresh(); + } +} diff --git a/lib/libcurses/PSD.doc/twinkle2.c b/lib/libcurses/PSD.doc/twinkle2.c new file mode 100644 index 00000000000..0a25590fcde --- /dev/null +++ b/lib/libcurses/PSD.doc/twinkle2.c @@ -0,0 +1,96 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)twinkle2.c 8.1 (Berkeley) 6/8/93 +.\" +extern int _putchar(); + +main() +{ + reg char *sp; + + srand(getpid()); /* initialize random sequence */ + + if (isatty(0)) { + gettmode(); + if ((sp = getenv("TERM")) != NULL) + setterm(sp); + signal(SIGINT, die); + } + else { + printf("Need a terminal on %d\n", _tty_ch); + exit(1); + } + _puts(TI); + _puts(VS); + + noecho(); + nonl(); + tputs(CL, NLINES, _putchar); + for (;;) { + makeboard(); /* make the board setup */ + puton('*'); /* put on '*'s */ + puton(' '); /* cover up with ' 's */ + } +} + +puton(ch) +char ch; +{ + reg LOCS *lp; + reg int r; + reg LOCS *end; + LOCS temp; + static int lasty, lastx; + + end = &Layout[Numstars]; + for (lp = Layout; lp < end; lp++) { + r = rand() % Numstars; + temp = *lp; + *lp = Layout[r]; + Layout[r] = temp; + } + + for (lp = Layout; lp < end; lp++) + /* prevent scrolling */ + if (!AM || (lp->y < NLINES - 1 || lp->x < NCOLS - 1)) { + mvcur(lasty, lastx, lp->y, lp->x); + putchar(ch); + lasty = lp->y; + if ((lastx = lp->x + 1) >= NCOLS) + if (AM) { + lastx = 0; + lasty++; + } + else + lastx = NCOLS - 1; + } +} diff --git a/lib/libcurses/PSD.doc/win_st.c b/lib/libcurses/PSD.doc/win_st.c new file mode 100644 index 00000000000..7790f6ca632 --- /dev/null +++ b/lib/libcurses/PSD.doc/win_st.c @@ -0,0 +1,58 @@ +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)win_st.c 8.1 (Berkeley) 6/8/93 +.\" +# define WINDOW struct _win_st + +struct _win_st { + short _cury, _curx; + short _maxy, _maxx; + short _begy, _begx; + short _flags; + short _ch_off; + bool _clear; + bool _leave; + bool _scroll; + char **_y; + short *_firstch; + short *_lastch; + struct _win_st *_nextp, *_orig; +}; + +# define _ENDLINE 001 +# define _FULLWIN 002 +# define _SCROLLWIN 004 +# define _FLUSH 010 +# define _FULLLINE 020 +# define _IDLINE 040 +# define _STANDOUT 0200 +# define _NOCHANGE -1 |
