From: <wda...@us...> - 2010-02-01 16:49:36
|
Revision: 5526 http://oorexx.svn.sourceforge.net/oorexx/?rev=5526&view=rev Author: wdashley Date: 2010-02-01 16:49:29 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Fixes for pads. More tests. Modified Paths: -------------- incubator/orxcurses/ncurses.cls incubator/orxcurses/orxncurses.cpp Added Paths: ----------- incubator/orxcurses/test11-3.rex incubator/orxcurses/test11-4.rex Modified: incubator/orxcurses/ncurses.cls =================================================================== --- incubator/orxcurses/ncurses.cls 2010-02-01 15:05:49 UTC (rev 5525) +++ incubator/orxcurses/ncurses.cls 2010-02-01 16:49:29 UTC (rev 5526) @@ -341,6 +341,7 @@ use strict arg ptr = self~dupwinprivate() return .window~new(ptr) +::METHOD doupdate EXTERNAL "LIBRARY orxncurses OrxCurDoupdate" ::METHOD dupwinprivate private EXTERNAL "LIBRARY orxncurses OrxCurDupwinprivate" ::METHOD echo EXTERNAL "LIBRARY orxncurses OrxCurEcho" ::METHOD noecho EXTERNAL "LIBRARY orxncurses OrxCurNoecho" @@ -541,14 +542,29 @@ ::class Pad public subclass Window -::METHOD init EXTERNAL "LIBRARY orxncurses OrxCurNewpad" +::METHOD newpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurNewpad" +::METHOD newsubpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurSubpadprivate" +::METHOD init +if arg() = 2 then do + use strict arg nlines, ncols + self~newpadprivate(nlines, ncols) + end +else do + use strict arg pad, nlines, ncols, begy, begx + self~newsubpadprivate(pad, nlines, ncols, begy, begx) + end +return ::METHOD echochar return self~ERR ::METHOD mvwin return self~ERR -::METHOD pechochar EXTERNAL "LIBRARY orxncurses OrxCurPechochar" -::METHOD pnoutrefresh EXTERNAL "LIBRARY orxncurses OrxCurPnoutrefresh" +--::METHOD pechochar EXTERNAL "LIBRARY orxncurses OrxCurPechochar" +--::METHOD pnoutrefresh EXTERNAL "LIBRARY orxncurses OrxCurPnoutrefresh" +::METHOD pnoutrefresh +use strict arg minrow, mincol, sminrow, smincol, smaxrow, smaxcol +.window~stdscr()~copywin(self, minrow, mincol, sminrow, smincol, smaxrow, smaxcol, .false) +return self~OK --::METHOD prefresh EXTERNAL "LIBRARY orxncurses OrxCurPrefresh" ::METHOD prefresh use strict arg minrow, mincol, sminrow, smincol, smaxrow, smaxcol @@ -567,8 +583,7 @@ return self~ERR ::METHOD subpad use strict arg nlines, ncols, begy, begx -ptr = self~subpadprivate(nlines, ncols, begy, begx) -return .window~new(ptr) +return .pad~new(self, nlines, ncols, begy, begx) ::METHOD subwin return self~ERR ::METHOD wnoutrefresh Modified: incubator/orxcurses/orxncurses.cpp =================================================================== --- incubator/orxcurses/orxncurses.cpp 2010-02-01 15:05:49 UTC (rev 5525) +++ incubator/orxcurses/orxncurses.cpp 2010-02-01 16:49:29 UTC (rev 5526) @@ -1223,6 +1223,20 @@ } /** + * Method: OrxCurDoupdate + * + * Update the terminal. + * + * @return Zero. + **/ +RexxMethod0(int, // Return type + OrxCurDoupdate) // Object_method name +{ + + return doupdate(); +} + +/** * Method: OrxCurEcho * * Turn on echo. @@ -3583,17 +3597,20 @@ * * @return Zero. **/ -RexxMethod5(RexxObjectPtr, // Return type +RexxMethod6(int, // Return type OrxCurSubpadprivate, // Object_method name CSELF, cself, // Self + RexxObjectPtr, pad, int, nlines, int, ncols, int, begy, int, begx) { - WINDOW *ptr = subpad((WINDOW *)cself, nlines, ncols, SUBTRACTONE(begy), SUBTRACTONE(begx)); - return (RexxObjectPtr)context->NewPointer(ptr); + WINDOW *padptr = (WINDOW *) context->ObjectToCSelf(pad); + WINDOW *ptr = subpad((WINDOW *)padptr, nlines, ncols, SUBTRACTONE(begy), SUBTRACTONE(begx)); + context->SetObjectVariable("CSELF", context->NewPointer(ptr)); + return 0; } /** @@ -4133,6 +4150,7 @@ REXX_METHOD(OrxCurDelwin, OrxCurDelwin), REXX_METHOD(OrxCurDerwinprivate, OrxCurDerwinprivate), REXX_METHOD(OrxCurDupwinprivate, OrxCurDupwinprivate), + REXX_METHOD(OrxCurDoupdate, OrxCurDoupdate), REXX_METHOD(OrxCurEcho, OrxCurEcho), REXX_METHOD(OrxCurNoecho, OrxCurNoecho), REXX_METHOD(OrxCurErase, OrxCurErase), Added: incubator/orxcurses/test11-3.rex =================================================================== --- incubator/orxcurses/test11-3.rex (rev 0) +++ incubator/orxcurses/test11-3.rex 2010-02-01 16:49:29 UTC (rev 5526) @@ -0,0 +1,70 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association 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 COPYRIGHT HOLDERS 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 COPYRIGHT */ +/* OWNER 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. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +numeric digits 12 +lf = '0A'x + +scr = .window~new() + +pod = .pad~new(50, 50) + +scr~addstr("New pad created" || lf) +scr~refresh() + +pea = pod~subpad(20, 20, 30, 30) + +scr~addstr("Subpad created" || lf) +scr~refresh() + +scr~getch() + +scr~endwin() +return + + +eof: +eof = .true +return + + +::requires 'ncurses.cls' + Property changes on: incubator/orxcurses/test11-3.rex ___________________________________________________________________ Added: svn:executable + * Added: incubator/orxcurses/test11-4.rex =================================================================== --- incubator/orxcurses/test11-4.rex (rev 0) +++ incubator/orxcurses/test11-4.rex 2010-02-01 16:49:29 UTC (rev 5526) @@ -0,0 +1,91 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association 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 COPYRIGHT HOLDERS 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 COPYRIGHT */ +/* OWNER 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. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +numeric digits 12 +lf = '0A'x +filename = 'Readme.txt' +tall = 24 +wide = 19 +spacer = 5 + +scr = .window~new() + +p = .pad~new(200, wide + 1) + +s1 = p~subpad(tall, wide + 1, 1, 1) +s2 = p~subpad(tall, wide + 1, tall + 1, 1) +s3 = p~subpad(tall, wide + 1, (2 * tall) + 1, 1) + +strm = .stream~new(filename) +strm~open('read') +eof = .false +call on notready name eof + +ch = strm~charin() +do while \eof + p~addch(ch) + ch = strm~charin() + end +strm~close() + +-- s1~prefresh(1, 1, 1, 1, tall, wide + 1) +-- s2~prefresh(1, 1, 1, wide + spacer + 1, tall, (wide * 2) + spacer) +-- s3~prefresh(1, 1, 1, (wide * 2) + (spacer * 2), tall, (wide *3) + (spacer * 2)) +/* this is the optimized version */ +s1~pnoutrefresh(1, 1, 1, 1, tall, wide + 1) +s2~pnoutrefresh(1, 1, 1, wide + spacer + 1, tall, (wide * 2) + spacer) +s3~pnoutrefresh(1, 1, 1, (wide * 2) + (spacer * 2), tall, (wide *3) + (spacer * 2)) +scr~doupdate() + +scr~getch() + +scr~endwin() +return + + +eof: +eof = .true +return + + +::requires 'ncurses.cls' + Property changes on: incubator/orxcurses/test11-4.rex ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |