spiderape-cvs Mailing List for SpiderApe: Beefing up SpiderMonkey
Status: Beta
Brought to you by:
sgbeal
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(134) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(125) |
Feb
|
Mar
(104) |
Apr
(61) |
May
(21) |
Jun
(13) |
Jul
(4) |
Aug
(70) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(58) |
Feb
(114) |
Mar
|
Apr
(13) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(47) |
Oct
(4) |
Nov
|
Dec
|
| 2008 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: <sg...@us...> - 2010-11-28 10:58:16
|
Revision: 65
http://spiderape.svn.sourceforge.net/spiderape/?rev=65&view=rev
Author: sgbeal
Date: 2010-11-28 10:58:10 +0000 (Sun, 28 Nov 2010)
Log Message:
-----------
s/mkdirhier/mkdir -p/
Modified Paths:
--------------
trunk/doc/doxygen/Makefile
Modified: trunk/doc/doxygen/Makefile
===================================================================
--- trunk/doc/doxygen/Makefile 2010-11-28 10:56:40 UTC (rev 64)
+++ trunk/doc/doxygen/Makefile 2010-11-28 10:58:10 UTC (rev 65)
@@ -76,7 +76,7 @@
SYMLINK = $(PACKAGE_NAME)-doxygen
INSTALL_ABS = $(INSTALL_DEST)/$(INSTALL_SUBDIR)
install: html
- @test -d $(INSTALL_DEST) || mkdirhier $(INSTALL_DEST); \
+ @test -d $(INSTALL_DEST) || mkdir -p $(INSTALL_DEST); \
test -d $(INSTALL_DEST) || exit
@test -d $(INSTALL_ABS) && rm -fr $(INSTALL_ABS); \
cp -r html $(INSTALL_ABS)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2010-11-28 10:56:49
|
Revision: 64
http://spiderape.svn.sourceforge.net/spiderape/?rev=64&view=rev
Author: sgbeal
Date: 2010-11-28 10:56:40 +0000 (Sun, 28 Nov 2010)
Log Message:
-----------
Renamed a member to work around platforms where 'getc' is a macro.
Modified Paths:
--------------
trunk/src/ape/cfile.cpp
trunk/src/ape/cfile.hpp
Modified: trunk/src/ape/cfile.cpp
===================================================================
--- trunk/src/ape/cfile.cpp 2009-03-21 08:59:20 UTC (rev 63)
+++ trunk/src/ape/cfile.cpp 2010-11-28 10:56:40 UTC (rev 64)
@@ -123,7 +123,7 @@
return 0;
}
- int CFile::getc()
+ int CFile::getChar()
{
return this->m_f
? ::fgetc( this->m_f )
@@ -212,7 +212,7 @@
ci.Member<CFile::strings::seek,int,long,int>( &CFile::seek );
ci.Member<CFile::strings::tell,long>( &CFile::tell );
ci.Member<CFile::strings::rewind,int>( &CFile::rewind );
- ci.Member<CFile::strings::getc,int>( &CFile::getc );
+ ci.Member<CFile::strings::getc,int>( &CFile::getChar );
ci.Define();
}
Modified: trunk/src/ape/cfile.hpp
===================================================================
--- trunk/src/ape/cfile.hpp 2009-03-21 08:59:20 UTC (rev 63)
+++ trunk/src/ape/cfile.hpp 2010-11-28 10:56:40 UTC (rev 64)
@@ -163,7 +163,7 @@
/** Gets one char from this file and returns it,
or -1 on EOF or error.
*/
- int getc();
+ int getChar();
// int fgetpos(fpos_t *pos);
// int fsetpos(fpos_t *pos);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2009-03-21 08:59:25
|
Revision: 63
http://spiderape.svn.sourceforge.net/spiderape/?rev=63&view=rev
Author: sgbeal
Date: 2009-03-21 08:59:20 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
fixed a very old bug regarding the (non)use of std::string::npos
Modified Paths:
--------------
trunk/src/ape/to_source.cpp
Modified: trunk/src/ape/to_source.cpp
===================================================================
--- trunk/src/ape/to_source.cpp 2008-05-08 23:12:20 UTC (rev 62)
+++ trunk/src/ape/to_source.cpp 2009-03-21 08:59:20 UTC (rev 63)
@@ -60,8 +60,8 @@
std::string quote_js_string( std::string const & s )
{
- if( 0 == s.find('\'') ) return "'"+s+"'";
- else if( 0 == s.find("\"") ) return "\""+s+"\"";
+ if( std::string::npos == s.find('\'') ) return "'"+s+"'";
+ else if( std::string::npos == s.find("\"") ) return "\""+s+"\"";
else
{
std::string x = s;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2008-05-08 23:12:23
|
Revision: 62
http://spiderape.svn.sourceforge.net/spiderape/?rev=62&view=rev
Author: sgbeal
Date: 2008-05-08 16:12:20 -0700 (Thu, 08 May 2008)
Log Message:
-----------
fixes for gcc 4.3
Modified Paths:
--------------
trunk/src/ape/ape.cpp
trunk/src/ape/class.hpp
Modified: trunk/src/ape/ape.cpp
===================================================================
--- trunk/src/ape/ape.cpp 2008-04-30 13:37:40 UTC (rev 61)
+++ trunk/src/ape/ape.cpp 2008-05-08 23:12:20 UTC (rev 62)
@@ -6,6 +6,7 @@
#include <set>
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
#include <sf.net/ape/ape.hpp>
#include <sf.net/ape/exception.hpp>
Modified: trunk/src/ape/class.hpp
===================================================================
--- trunk/src/ape/class.hpp 2008-04-30 13:37:40 UTC (rev 61)
+++ trunk/src/ape/class.hpp 2008-05-08 23:12:20 UTC (rev 62)
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
#include <map>
+#include <string.h> // memset()
#ifdef WIN32
#pragma warning( push )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2008-04-30 13:37:44
|
Revision: 61
http://spiderape.svn.sourceforge.net/spiderape/?rev=61&view=rev
Author: sgbeal
Date: 2008-04-30 06:37:40 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
ran through doxygen -u
Modified Paths:
--------------
trunk/doc/doxygen/Doxyfile.at
Modified: trunk/doc/doxygen/Doxyfile.at
===================================================================
--- trunk/doc/doxygen/Doxyfile.at 2008-04-06 20:32:48 UTC (rev 60)
+++ trunk/doc/doxygen/Doxyfile.at 2008-04-30 13:37:40 UTC (rev 61)
@@ -1,4 +1,4 @@
-# Doxyfile 1.4.1
+# Doxyfile 1.5.3
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@@ -14,6 +14,14 @@
# Project related configuration options
#---------------------------------------------------------------------------
+# This tag specifies the encoding used for all characters in the config file that
+# follow. The default is UTF-8 which is also the encoding used for all text before
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
+# possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
@@ -45,24 +53,14 @@
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
@@ -135,11 +133,19 @@
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = YES
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
@@ -161,12 +167,11 @@
INHERIT_DOCS = NO
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
-DISTRIBUTE_GROUP_DOC = NO
+SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
@@ -189,13 +194,34 @@
OPTIMIZE_OUTPUT_FOR_C = NO
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
# For instance, namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
@@ -238,6 +264,13 @@
EXTRACT_LOCAL_METHODS = NO
+# If this flag is set to YES, the members of anonymous namespaces will be extracted
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}',
+# where file will be replaced with the base name of the file that contains the anonymous
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
@@ -370,7 +403,7 @@
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation.
+# in the documentation. The default is NO.
SHOW_DIRECTORIES = YES
@@ -379,7 +412,7 @@
# version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the progam writes to standard output
+# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
@@ -427,7 +460,7 @@
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
-WARN_FORMAT = "$file:$line: $text"
+WARN_FORMAT = "$file:$line: $text "
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
@@ -446,12 +479,19 @@
INPUT = @DOXYGEN_INPUT@
+# This tag can be used to specify the character encoding of the source files that
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
FILE_PATTERNS = *.cpp \
*.hpp
@@ -476,10 +516,19 @@
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
EXCLUDE_PATTERNS =
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the output.
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
@@ -538,7 +587,9 @@
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
+# then you must also enable this option. If you don't then doxygen will produce
+# a warning and turn it on anyway
SOURCE_BROWSER = YES
@@ -565,6 +616,21 @@
REFERENCES_RELATION = YES
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
@@ -649,6 +715,14 @@
GENERATE_HTMLHELP = NO
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
@@ -951,7 +1025,7 @@
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = YES
@@ -1054,6 +1128,14 @@
CLASS_DIAGRAMS = YES
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
+# be found in the default search path.
+
+MSCGEN_PATH =
+
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
@@ -1111,7 +1193,7 @@
INCLUDED_BY_GRAPH = YES
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
# generate a call dependency graph for every global function or class method.
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
@@ -1119,6 +1201,14 @@
CALL_GRAPH = NO
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
@@ -1148,31 +1238,23 @@
DOTFILE_DIRS =
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the number
+# of direct children of the root node in a graph is already larger than
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-MAX_DOT_GRAPH_WIDTH = 1024
+DOT_GRAPH_MAX_NODES = 50
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2008-04-06 20:32:50
|
Revision: 60
http://spiderape.svn.sourceforge.net/spiderape/?rev=60&view=rev
Author: sgbeal
Date: 2008-04-06 13:32:48 -0700 (Sun, 06 Apr 2008)
Log Message:
-----------
removed the ncurses++ license stuff, as that no longer applies
Modified Paths:
--------------
trunk/LICENSE
Modified: trunk/LICENSE
===================================================================
--- trunk/LICENSE 2008-01-13 15:15:37 UTC (rev 59)
+++ trunk/LICENSE 2008-04-06 20:32:48 UTC (rev 60)
@@ -3,34 +3,3 @@
The majority of these sources are released under the Mozilla Public
License (MPL). Some files fall under other licenses, none of them more
restrictive than the MPL. See each source file for the specifics.
-
-The ncurses++ distribution, from which we have stolen code (see
-src/nc/*.?pp), requires that we repeat its copyright statement:
-
-/****************************************************************************
- * Copyright (c) 1998-2001,2004 Free Software Foundation, Inc. *
- * *
- * Permission is hereby granted, free of charge, to any person obtaining a *
- * copy of this software and associated documentation files (the *
- * "Software"), to deal in the Software without restriction, including *
- * without limitation the rights to use, copy, modify, merge, publish, *
- * distribute, distribute with modifications, sublicense, and/or sell *
- * copies of the Software, and to permit persons to whom the Software is *
- * furnished to do so, subject to the following conditions: *
- * *
- * The above copyright notice and this permission notice shall be included *
- * in all copies or substantial portions of the Software. *
- * *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
- * *
- * Except as contained in this notice, the name(s) of the above copyright *
- * holders shall not be used in advertising or otherwise to promote the *
- * sale, use or other dealings in this Software without prior written *
- * authorization. *
- ****************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2008-01-13 15:15:39
|
Revision: 59
http://spiderape.svn.sourceforge.net/spiderape/?rev=59&view=rev
Author: sgbeal
Date: 2008-01-13 07:15:37 -0800 (Sun, 13 Jan 2008)
Log Message:
-----------
added warning about volatility of ROWID fields
Modified Paths:
--------------
plugins/SQLite3/SpiderApe-Plugin-SQLite3.odt
Modified: plugins/SQLite3/SpiderApe-Plugin-SQLite3.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2008-01-13 14:57:27
|
Revision: 58
http://spiderape.svn.sourceforge.net/spiderape/?rev=58&view=rev
Author: sgbeal
Date: 2008-01-13 06:57:26 -0800 (Sun, 13 Jan 2008)
Log Message:
-----------
minor typo correction
Modified Paths:
--------------
plugins/ncurses/SpiderApe-Plugin-ncurses.odt
Modified: plugins/ncurses/SpiderApe-Plugin-ncurses.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-10-05 15:37:42
|
Revision: 57
http://spiderape.svn.sourceforge.net/spiderape/?rev=57&view=rev
Author: sgbeal
Date: 2007-10-05 08:37:41 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
minor cleanups
Modified Paths:
--------------
plugins/ncurses/Makefile
plugins/ncurses/NCursesPanel.cpp
plugins/ncurses/NCursesPanel.js
plugins/ncurses/NCursesWindow.hpp
plugins/ncurses/nccolors.hpp
plugins/ncurses/panel.cpp
Modified: plugins/ncurses/Makefile
===================================================================
--- plugins/ncurses/Makefile 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/Makefile 2007-10-05 15:37:41 UTC (rev 57)
@@ -12,6 +12,7 @@
ncstream.cpp \
ncwrapper.cpp \
panel.cpp \
+ NCursesPanel.cpp \
NCursesWindow.cpp
APE.PLUGIN.HEADERS = \
Modified: plugins/ncurses/NCursesPanel.cpp
===================================================================
--- plugins/ncurses/NCursesPanel.cpp 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/NCursesPanel.cpp 2007-10-05 15:37:41 UTC (rev 57)
@@ -70,7 +70,7 @@
}
}
else if( 4 == argc )
- { // ctor(lines,cols,width,height)
+ { // ctor(lines,cols,y,x)
jsval wjv = JSVAL_NULL;
nc_newwin( cx, JS_GetGlobalObject(cx), argc, argv, &wjv );
WINDOW * w = jsval_to_WINDOW( cx, wjv );
@@ -106,7 +106,6 @@
}
char const * NCursesPanel::strings::class_name = "NCursesPanel";
- char const * NCursesPanel::strings::bogo = "bogo";
void NCursesPanel::init_js_class()
{
@@ -115,17 +114,10 @@
inited = true;
typedef NCursesPanel::ClassType CT;
CT::impl & ci = CT().Implement();
-
- ci.Member<NCursesPanel::strings::bogo>( &NCursesPanel::bogo );
-
+ //ci.Member<NCursesPanel::strings::bogo>( &NCursesPanel::bogo );
ci.Define();
}
- NCP_JS_NATIVE_MEMBER(bogo)
- {
- return JS_TRUE;
- }
-
JSBool NCursesPanel::init_context( JSContext * cx, JSObject * obj )
{
NCursesPanel::init_js_class();
@@ -135,6 +127,8 @@
typedef NCursesWindow::ClassType CTW;
CTW::impl & cw = CTW().Implement();
JSBool ret = JS_SetPrototype( cx, cp.get_prototype(cx), cw.get_prototype(cx) );
+#if 0
+// this isn't necessary because the base class functions take care of the this.isPanel() check:
ape::scriptable proto( cx, cp.get_prototype(cx) );
if( !(
ret
@@ -147,6 +141,7 @@
)) {
throw new ape::exception( cx, "NCursesPanel::init_context(): add_function() failed while setting up prototype functions." );
}
+#endif
return ret;
}
Modified: plugins/ncurses/NCursesPanel.js
===================================================================
--- plugins/ncurses/NCursesPanel.js 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/NCursesPanel.js 2007-10-05 15:37:41 UTC (rev 57)
@@ -34,7 +34,7 @@
}
}
-var root = new NCursesPanel(0,0,0,0);
+var root = new NCursesPanel(stdscr);
root.background( ascii('~') | nc_color('black','yellow'));
nc_curs_set(0);
nc_capture_cout(root.ncwindow());
Modified: plugins/ncurses/NCursesWindow.hpp
===================================================================
--- plugins/ncurses/NCursesWindow.hpp 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/NCursesWindow.hpp 2007-10-05 15:37:41 UTC (rev 57)
@@ -211,15 +211,30 @@
/**
- Not yet workie.
+ A JS-side wrapper around ncurses PANELs. Does not really
+ add any functionality which isn't alread available via
+ NCursesWindow.
*/
class NCursesPanel : public NCursesWindow
{
public:
/**
Constructor required by Class<>.
+
+ Accepts:
+
+ (WINDOW) = makes a new panel associated with
+ WINDOW. This object takes over the window, which
+ must not be already associated with an
+ NCursesWindow object.
+
+ (lines,cols,y,x) = makes a new WINDOW and a PANEL
+ associated with that window.
+
+ Illegal arguments == exception.
*/
NCursesPanel( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval );
+
/**
*/
virtual ~NCursesPanel();
@@ -238,8 +253,6 @@
*/
static JSBool init_context(JSContext *, JSObject *);
- JS_NATIVE_MEMBER(bogo);
-
/**
These strings are used by Class<>.
*/
@@ -257,10 +270,6 @@
private:
NCursesPanel & operator=(NCursesPanel const &); // not implemented
NCursesPanel(NCursesPanel const &); // not implemented
-
- /** Ensures that initscr() has been run. */
- static void shared_init( JSContext *);
-
}; // class NCursesPanel
Modified: plugins/ncurses/nccolors.hpp
===================================================================
--- plugins/ncurses/nccolors.hpp 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/nccolors.hpp 2007-10-05 15:37:41 UTC (rev 57)
@@ -35,7 +35,7 @@
in that order, A palette entry is made. The entries
are grouped by background, not foreground. That is,
- colors 1..7 habe a bg of COLOR_BLACK, 8..15 have
+ colors 1..7 have a bg of COLOR_BLACK, 8..15 have
a bg of COLOR_RED, etc...
The full list of colors is here:
Modified: plugins/ncurses/panel.cpp
===================================================================
--- plugins/ncurses/panel.cpp 2007-10-05 15:34:10 UTC (rev 56)
+++ plugins/ncurses/panel.cpp 2007-10-05 15:37:41 UTC (rev 57)
@@ -13,18 +13,15 @@
#define CHECKBINDER(FUNCNAME,JV) JWBinder * bin = JWBinder::get_binder(cx,JV); \
if(!bin) { \
- JS_ReportError( cx,"%s() could not get bound native object."); \
- return JS_FALSE; \
+ return ape::set_pending_exception( cx,"%s() could not get bound native object."); \
}
#define ASSERTNC(FUNCNAME,CX) if( ! stdscr ) { \
- JS_ReportError(CX,"Function %s() requires that curses mode be running (try nc_initscr()).", FUNCNAME); \
- return JS_FALSE; \
+ return ape::set_pending_exception(CX,"Function %s() requires that curses mode be running (try nc_initscr()).", FUNCNAME); \
}
#define ASSERTARGC(FUNCNAME,CX,ARGC_EXPR) if(!(ARGC_EXPR)) { \
- JS_ReportError( CX,"%s() argument check failed: %s",FUNCNAME,# ARGC_EXPR ); \
- return JS_FALSE; \
+ return ape::set_pending_exception( CX,"%s() argument check failed: %s",FUNCNAME,# ARGC_EXPR ); \
} \
ASSERTNC(FUNCNAME,CX)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-10-05 15:34:12
|
Revision: 56
http://spiderape.svn.sourceforge.net/spiderape/?rev=56&view=rev
Author: sgbeal
Date: 2007-10-05 08:34:10 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
added NCursesPanel
Modified Paths:
--------------
plugins/ncurses/SpiderApe-Plugin-ncurses.odt
Modified: plugins/ncurses/SpiderApe-Plugin-ncurses.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-10-05 15:07:18
|
Revision: 55
http://spiderape.svn.sourceforge.net/spiderape/?rev=55&view=rev
Author: sgbeal
Date: 2007-10-05 08:07:07 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
NCursesPanel subclassing appears to work.
Modified Paths:
--------------
plugins/ncurses/NCursesPanel.cpp
plugins/ncurses/NCursesPanel.js
plugins/ncurses/NCursesWindow.cpp
plugins/ncurses/NCursesWindow.hpp
Modified: plugins/ncurses/NCursesPanel.cpp
===================================================================
--- plugins/ncurses/NCursesPanel.cpp 2007-10-05 12:54:45 UTC (rev 54)
+++ plugins/ncurses/NCursesPanel.cpp 2007-10-05 15:07:07 UTC (rev 55)
@@ -1,4 +1,4 @@
-#error "DO NOT USE THIS CODE! It doesn't work!"
+//#error "DO NOT USE THIS CODE! It doesn't work!"
#include <map>
#include <sf.net/ape/plugin.hpp>
@@ -40,26 +40,69 @@
namespace nc {
NCursesPanel::NCursesPanel( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval )
- : NCursesWindow( cx, obj, argc, argv, rval )
+ : NCursesWindow( cx, obj, 0, 0, 0 )
{
- jsval pv = JSVAL_NULL;
- jsval av[1] = { this->window_handle_jsval() };
- nc_new_panel( cx, JS_GetGlobalObject(cx), 1, av, &pv );
- PANEL * p = jsval_to<PANEL>( cx, pv );
- if( ! p )
+ if( 1 == argc )
+ { // ctor(WINDOW)
+ if( WINDOW * ncw = jsval_to_WINDOW(cx,argv[0]) )
+ { // ctor(WINDOW)
+ this->set_window( ncw );
+ jsval av[1] = {
+ this->window_handle_jsval()
+ };
+ jsval pv = JSVAL_NULL;
+ nc_new_panel( cx, JS_GetGlobalObject(cx), 1, av, &pv );
+ PANEL * p = jsval_to_PANEL( cx, pv );
+ if( ! p )
+ {
+ throw ape::exception( cx, "%s(WINDOW) ctor: nc_new_panel(WINDOW) failed!",
+ NCursesPanel::strings::class_name);
+ }
+ this->set_window( ncw );
+ this->set_panel( p );
+ }
+ //else if( NCursesWindow * par = ape::jsval_to<NCursesWindow>( cx, argv[0] ) )
+ // we can't do this like i want to because of WINDOW ownership issues.
+ else
+ {
+ throw new ape::exception( cx, "%s(WINDOW) ctor: requires a WINDOW argument!",
+ NCursesPanel::strings::class_name );
+ }
+ }
+ else if( 4 == argc )
+ { // ctor(lines,cols,width,height)
+ jsval wjv = JSVAL_NULL;
+ nc_newwin( cx, JS_GetGlobalObject(cx), argc, argv, &wjv );
+ WINDOW * w = jsval_to_WINDOW( cx, wjv );
+ if( ! w )
+ {
+ throw new ape::exception( cx, "%s(lines,cols,width,height) ctor: nc_newwin() failed!",
+ NCursesPanel::strings::class_name );
+ }
+ this->set_window( w );
+ jsval pjv = JSVAL_NULL;
+ jsval av[1] = { wjv };
+ nc_new_panel( cx, JS_GetGlobalObject(cx), 1, av, &pjv );
+ PANEL * p = jsval_to_PANEL( cx, pjv );
+ if( ! p )
+ {
+ throw new ape::exception( cx, "%s(lines,cols,width,height) ctor: nc_new_panel() failed!",
+ NCursesPanel::strings::class_name );
+ }
+ this->set_panel( p );
+ }
+ else
{
- throw ape::exception( cx, "NCursesPanel::ctor couldn't get PANEL handle." );
+ throw new ape::exception( cx,
+ "%s() ctor got no valid arguments! RTFM!",
+ NCursesPanel::strings::class_name );
}
- this->set_panel( p );
ape::bind::bind_native<NCursesPanel>( cx, obj, this );
- //ape::bind::bind_native<PANEL>( cx, pv, p );
-// this->add_function("tryit",
-// "function(){nc_hide_panel(");
}
NCursesPanel::~NCursesPanel()
{
- ape::bind::unbind_native<NCursesPanel>( cx, obj, this );
+ ape::bind::unbind_native<NCursesPanel>( this->js_context(), this->js_object(), this );
}
char const * NCursesPanel::strings::class_name = "NCursesPanel";
Modified: plugins/ncurses/NCursesPanel.js
===================================================================
--- plugins/ncurses/NCursesPanel.js 2007-10-05 12:54:45 UTC (rev 54)
+++ plugins/ncurses/NCursesPanel.js 2007-10-05 15:07:07 UTC (rev 55)
@@ -34,7 +34,7 @@
}
}
-var root = new NCursesWindow(nc_new_panel(nc_newwin(0,0,0,0)));
+var root = new NCursesPanel(0,0,0,0);
root.background( ascii('~') | nc_color('black','yellow'));
nc_curs_set(0);
nc_capture_cout(root.ncwindow());
@@ -47,14 +47,14 @@
var woffset = {x:5,y:2};
var wpos = {y:3,x:3,incr:function(){this.x+=woffset.x;this.y+=woffset.y}};
var cpnl = null;
-curpnl = wins[pos] = new NCursesWindow( nc_new_panel(nc_newwin(rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x)));
+curpnl = wins[pos] = new NCursesPanel( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x );
wpos.incr();
curpnl.background( nc_color('white',pos) );
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
curpnl.refresh();
pos = 'red';
-curpnl = wins[pos] = new NCursesWindow(nc_new_panel(nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x )));
+curpnl = wins[pos] = new NCursesPanel( nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x ) );
wpos.incr();
curpnl.background( nc_color('white',pos) );
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
@@ -64,14 +64,15 @@
pos = 'cyan';
-curpnl = wins[pos] = new NCursesWindow(nc_new_panel(nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x )));
+curpnl = wins[pos] = new NCursesPanel( nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x ) );
wpos.incr();
curpnl.background( nc_color('black',pos) );
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
curpnl.refresh();
pos = 'green';
-curpnl = wins[pos] = new NCursesWindow(nc_new_panel(nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x )));
+curpnl = wins[pos] = new NCursesPanel( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x );
+ //new NCursesWindow(nc_new_panel(nc_newwin( rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x )));
wpos.incr();
curpnl.background( nc_color('black',pos) );
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
@@ -98,6 +99,8 @@
curpnl = wins['cyan'];
+print("instanceof NCursesWindow ??? ==",curpnl instanceof NCursesWindow);
+
//curpnl.moveWindow( rootgeom.h/3, 1 );
//curpnl.hide();
// var bogo = new NCursesWindow(1,1,0,0);
Modified: plugins/ncurses/NCursesWindow.cpp
===================================================================
--- plugins/ncurses/NCursesWindow.cpp 2007-10-05 12:54:45 UTC (rev 54)
+++ plugins/ncurses/NCursesWindow.cpp 2007-10-05 15:07:07 UTC (rev 55)
@@ -159,13 +159,15 @@
{
NCursesWindow::shared_init(cx);
if( (! argc) && rval )
- {
+ { // called via empty JS ctor
this->m_ncwin = stdscr;
}
else if( argc || argv || rval )
{
this->setup( cx, obj, argc, argv );
}
+ // else assume subclass will run setup().
+
if( rval ) *rval = this->js_value();
ape::bind::bind_native<NCursesWindow>( this->js_context(),
this->js_value(),
@@ -609,8 +611,8 @@
(*it).first.c_str() );
}
}
- //return NCursesPanel::init_context(cx,obj);
- return JS_TRUE;
+ return NCursesPanel::init_context(cx,obj);
+ //return JS_TRUE;
}
Modified: plugins/ncurses/NCursesWindow.hpp
===================================================================
--- plugins/ncurses/NCursesWindow.hpp 2007-10-05 12:54:45 UTC (rev 54)
+++ plugins/ncurses/NCursesWindow.hpp 2007-10-05 15:07:07 UTC (rev 55)
@@ -167,7 +167,9 @@
/** Sets this object's PANEL, which must be registered
with SpiderApe's native binding system, using the same
- jsval as the one used by this->window_handle().
+ jsval as the one used by this->window_handle(). p MUST
+ be associated with this->window_handle() or results
+ are undefined.
*/
void set_panel( PANEL * p );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-10-05 12:54:48
|
Revision: 54
http://spiderape.svn.sourceforge.net/spiderape/?rev=54&view=rev
Author: sgbeal
Date: 2007-10-05 05:54:45 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
some refactoring before trying to re-do the NCursesPanel class
Modified Paths:
--------------
plugins/ncurses/NCursesWindow.cpp
plugins/ncurses/NCursesWindow.hpp
Modified: plugins/ncurses/NCursesWindow.cpp
===================================================================
--- plugins/ncurses/NCursesWindow.cpp 2007-09-30 18:36:38 UTC (rev 53)
+++ plugins/ncurses/NCursesWindow.cpp 2007-10-05 12:54:45 UTC (rev 54)
@@ -51,31 +51,17 @@
// {
// }
- NCursesWindow::NCursesWindow( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval ) :
- ::ape::scriptable_base< NCursesWindow >(cx,obj),
- m_par(0),
- m_ncwin(0),
- m_ncwinjv(JSVAL_NULL),
- m_ncpanel(0),
- m_ch()
+ void NCursesWindow::setup( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv )
{
- NCursesWindow::shared_init(cx);
- if( ! argc )
+ if( 1 == argc )
{
- this->m_ncwin = stdscr;
- this->m_ncwinjv = WINDOW_to_jsval( cx, stdscr );
- }
- else if( 1 == argc )
- {
if( PANEL * p = JWBinder::get_panel(cx, argv[0] ) )
{ // ctor(PANEL)
this->m_ncwin = panel_window(p);
- this->m_ncwinjv = WINDOW_to_jsval( cx, this->m_ncwin );
this->m_ncpanel = p;
}
else if( WINDOW * ncw = jsval_to_WINDOW(cx,argv[0]) )
{ // ctor(WINDOW)
- this->m_ncwinjv = argv[0];
this->m_ncwin = ncw;
}
else if( NCursesWindow * par = ape::jsval_to<NCursesWindow>( cx, argv[0] ) )
@@ -93,9 +79,10 @@
int_to_jsval(1), // y
int_to_jsval(1) // x
};
- nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &this->m_ncwinjv );
+ jsval winjv = JSVAL_NULL;
+ nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &winjv );
//CERR << "window from derwin() == ["<<jsval_to_std_string(cx,this->m_ncwinjv)<<'\n';
- this->m_ncwin = jsval_to_WINDOW( cx, this->m_ncwinjv );
+ this->m_ncwin = jsval_to_WINDOW( cx, winjv );
if( ! this->m_ncwin )
{
throw new ape::exception( cx, "%s 1-arg ctor: nc_derwin(NCursesWindow,%d,%d,%d,%d) failed!",
@@ -116,10 +103,11 @@
jsval av[5] = { WINDOW_to_jsval(cx,stdscr),
argv[0], argv[1],
argv[2], argv[3] };
- nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &this->m_ncwinjv );
+ jsval winjv = JSVAL_NULL;
+ nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &winjv );
//nc_newwin( cx, JS_GetGlobalObject(cx), argc, argv, &this->m_ncwinjv );
// ^^^ using nc_newwin here doesn't work: window is hidden behind stdscr on stdscr refresh
- this->m_ncwin = jsval_to_WINDOW( cx, this->m_ncwinjv );
+ this->m_ncwin = jsval_to_WINDOW( cx, winjv );
if( ! this->m_ncwin )
{
throw new ape::exception( cx, "%s 4-arg ctor: nc_newwin() failed!",
@@ -135,33 +123,53 @@
NCursesWindow::strings::class_name,
NCursesWindow::strings::class_name);
}
- jsval av[] = { par->m_ncwinjv,
+ jsval av[] = { par->window_handle_jsval(),
argv[1], argv[2],
argv[3], argv[4] };
- nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &this->m_ncwinjv );
- if( JSVAL_NULL == this->m_ncwinjv )
+ jsval winjv = JSVAL_NULL;
+ nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &winjv );
+ if( JSVAL_NULL == winjv )
{
throw new ape::exception( cx, "%s 5-arg ctor: nc_derwin() failed!",
NCursesWindow::strings::class_name);
}
- this->m_ncwin = ape::jsval_to<WINDOW>( cx, this->m_ncwinjv );
+ this->m_ncwin = ape::jsval_to<WINDOW>( cx, winjv );
this->set_parent( par );
}
else
{
- throw ape::exception( cx, "%s ctor: did not get valid arguments.",
+ throw ape::exception( cx, "%s::setup(): did not get valid arguments.",
NCursesWindow::strings::class_name);
}
if( ! this->m_ncwin )
{
- throw ape::exception( cx, "%s ctor: this object has no valid WINDOW handle.",
+ throw ape::exception( cx, "%s::setup(): this object has no valid WINDOW handle.",
NCursesWindow::strings::class_name );
}
+ }
+
+ NCursesWindow::NCursesWindow( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval ) :
+ ::ape::scriptable_base< NCursesWindow >(cx,obj),
+ m_par(0),
+ m_ncwin(0),
+ m_ncpanel(0),
+ m_ch()
+ {
+ NCursesWindow::shared_init(cx);
+ if( (! argc) && rval )
+ {
+ this->m_ncwin = stdscr;
+ }
+ else if( argc || argv || rval )
+ {
+ this->setup( cx, obj, argc, argv );
+ }
+ if( rval ) *rval = this->js_value();
ape::bind::bind_native<NCursesWindow>( this->js_context(),
- this->js_value(),
- this );
+ this->js_value(),
+ this );
}
NCursesWindow::~NCursesWindow()
@@ -192,7 +200,7 @@
// TODO: what to do when m_ncwin==stdscr AND we have a panel?
if( this->m_ncwin != stdscr )
{
- jsval av[1] = { this->m_ncwinjv };
+ jsval av[1] = { this->window_handle_jsval() };
jsval ignored;
try {
nc_delwin( this->js_context(), JS_GetGlobalObject(this->js_context()), 1, av, &ignored );
@@ -208,6 +216,11 @@
this->m_ncpanel = p;
}
+ void NCursesWindow::set_window( WINDOW * w )
+ {
+ this->m_ncwin = w;
+ }
+
bool NCursesWindow::is_panel()
{
return 0 != this->m_ncpanel;
@@ -294,7 +307,10 @@
jsval NCursesWindow::window_handle_jsval()
{
- return this->m_ncwinjv;
+ return this->m_ncwin
+ ? WINDOW_to_jsval( this->js_context(),
+ this->m_ncwin )
+ : JSVAL_NULL;
}
NCW_JS_NATIVE_MEMBER(wrap_addstr)
@@ -357,7 +373,7 @@
NCW_JS_NATIVE_MEMBER(wrap_border)
{
jsval av[argc+1];
- av[0] = this->m_ncwinjv;
+ av[0] = this->window_handle_jsval();
for( uint32 i = 0; (i < argc) && (i<9); ++i )
{
av[i+1] = argv[i];
@@ -369,7 +385,7 @@
{
JSObject * glob = JS_GetGlobalObject(cx);
jsval av[argc+1];
- av[0] = this->m_ncwinjv;
+ av[0] = this->window_handle_jsval();
if( 0 == argc )
{
return nc_wgetstr(cx,glob,1,av,rval);
@@ -403,7 +419,7 @@
{
JSObject * glob = JS_GetGlobalObject(cx);
jsval av[argc+1];
- av[0] = this->m_ncwinjv;
+ av[0] = this->window_handle_jsval();
if( 2 == argc )
{ // hLine(attr,count)
av[1] = argv[0];
@@ -428,7 +444,7 @@
{
JSObject * glob = JS_GetGlobalObject(cx);
jsval av[argc+1];
- av[0] = this->m_ncwinjv;
+ av[0] = this->window_handle_jsval();
if( 2 == argc )
{ // vline(attr,count)
av[1] = argv[0];
Modified: plugins/ncurses/NCursesWindow.hpp
===================================================================
--- plugins/ncurses/NCursesWindow.hpp 2007-09-30 18:36:38 UTC (rev 53)
+++ plugins/ncurses/NCursesWindow.hpp 2007-10-05 12:54:45 UTC (rev 54)
@@ -62,6 +62,13 @@
given geometry (which must lie completely within
the parent).
+
+ Subclasses should pass 0 for (argc,argv,rval) and
+ either call the protected setup() member or do
+ argument handling themselves. Additionally, subclasses
+ must call (*rval = this->js_value()). In no other case
+ is a null rval parameter legal.
+
*/
NCursesWindow( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval );
@@ -158,8 +165,35 @@
*/
NCursesWindow * set_parent(NCursesWindow *);
+ /** Sets this object's PANEL, which must be registered
+ with SpiderApe's native binding system, using the same
+ jsval as the one used by this->window_handle().
+ */
void set_panel( PANEL * p );
+ /** Sets this object's WINDOW, which must be registered
+ with SpiderApe's native binding system.
+ */
+ void set_window( WINDOW * p );
+
+ /**
+ Called by the ctor IF the ctor is passed a non-0
+ argc argument. It handles the following cases:
+
+ (argc==1): argv[0] must be a WINDOW, PANEL, or NCursesWindow.
+
+ (argc==4): argv == (lines,cols,y,x), sets up a WINDOW as a child
+ of stdscr.
+
+ (argc==5): argv == (parent, lines, cols, y, x). parent must be an
+ NCursesWindow. Sets up a subwindow of the parent using the given
+ geometry.
+
+ If it gets invalid arguments it throws an ape::exception.
+ */
+ void setup( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv );
+
+
private:
NCursesWindow & operator=(NCursesWindow const &); // not implemented
NCursesWindow(NCursesWindow const &); // not implemented
@@ -169,7 +203,6 @@
typedef std::list<NCursesWindow *> child_list;
NCursesWindow * m_par; // parent window
WINDOW * m_ncwin; // underlying window handle
- jsval m_ncwinjv; // jsval for m_ncwin.
PANEL * m_ncpanel;
child_list m_ch; // list of child windows
}; // class NCursesWindow
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-30 18:36:40
|
Revision: 53
http://spiderape.svn.sourceforge.net/spiderape/?rev=53&view=rev
Author: sgbeal
Date: 2007-09-30 11:36:38 -0700 (Sun, 30 Sep 2007)
Log Message:
-----------
removed sqlite3 reference
Modified Paths:
--------------
plugins/SamplePlugin/README
Modified: plugins/SamplePlugin/README
===================================================================
--- plugins/SamplePlugin/README 2007-09-30 18:24:41 UTC (rev 52)
+++ plugins/SamplePlugin/README 2007-09-30 18:36:38 UTC (rev 53)
@@ -3,7 +3,6 @@
Maintainer: stephan at s11n net
SpiderApe home page: http://SpiderApe.sf.net
-sqlite3 home page: http://sqlite.org
This plugin provides no useful features in and of itself. It exists as
a demonstration of how to write a plugin and as a starting point for
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-30 18:24:46
|
Revision: 52
http://spiderape.svn.sourceforge.net/spiderape/?rev=52&view=rev
Author: sgbeal
Date: 2007-09-30 11:24:41 -0700 (Sun, 30 Sep 2007)
Log Message:
-----------
more changes
Modified Paths:
--------------
trunk/ChangeLog
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-09-29 15:45:57 UTC (rev 51)
+++ trunk/ChangeLog 2007-09-30 18:24:41 UTC (rev 52)
@@ -4,6 +4,16 @@
Home page: http://SpiderApe.sourceforge.net
========================================================================
+2007.09.29:
+
+- Added debuggering macro SPIDERAPE_CURRENT_FUNCTION, which is similar
+to __FUNCTION__. This is mostly useful for plugins, which often use
+macros in JSNative functions for checking argument counts. (In fact,
+the ncurses plugin now needs this macro.)
+
+- Added scriptable_base::set() member.
+
+
26.09.2007:
- Added ape::js_simple_object class to simplify the returning of JS-side
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-29 15:46:00
|
Revision: 51
http://spiderape.svn.sourceforge.net/spiderape/?rev=51&view=rev
Author: sgbeal
Date: 2007-09-29 08:45:57 -0700 (Sat, 29 Sep 2007)
Log Message:
-----------
moved the SQLite3 docs into their own document
Modified Paths:
--------------
trunk/doc/SpiderApe-Plugins.odt
Modified: trunk/doc/SpiderApe-Plugins.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-29 15:43:31
|
Revision: 50
http://spiderape.svn.sourceforge.net/spiderape/?rev=50&view=rev
Author: sgbeal
Date: 2007-09-29 08:43:29 -0700 (Sat, 29 Sep 2007)
Log Message:
-----------
egg
Added Paths:
-----------
plugins/SQLite3/SpiderApe-Plugin-SQLite3.odt
Added: plugins/SQLite3/SpiderApe-Plugin-SQLite3.odt
===================================================================
(Binary files differ)
Property changes on: plugins/SQLite3/SpiderApe-Plugin-SQLite3.odt
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-29 14:46:39
|
Revision: 49
http://spiderape.svn.sourceforge.net/spiderape/?rev=49&view=rev
Author: sgbeal
Date: 2007-09-29 07:46:38 -0700 (Sat, 29 Sep 2007)
Log Message:
-----------
added SPIDERAPE_CURRENT_FUNCTION macro
Modified Paths:
--------------
trunk/src/ape/debuggering_macros.hpp
Modified: trunk/src/ape/debuggering_macros.hpp
===================================================================
--- trunk/src/ape/debuggering_macros.hpp 2007-09-29 06:17:12 UTC (rev 48)
+++ trunk/src/ape/debuggering_macros.hpp 2007-09-29 14:46:38 UTC (rev 49)
@@ -14,4 +14,21 @@
#endif
+
+// SPIDERAPE_CURRENT_FUNCTION is a "portable" equivalent to __FUNCTION__.
+#ifdef __GNUC__
+# define SPIDERAPE_CURRENT_FUNCTION __PRETTY_FUNCTION__
+#elif defined(__BORLANDC__)
+# define SPIDERAPE_CURRENT_FUNCTION __FUNC__
+#elif defined(_MSC_VER)
+# if _MSC_VER >= 1300 // .NET 2003
+# define SPIDERAPE_CURRENT_FUNCTION __FUNCDNAME__
+# else
+# define SPIDERAPE_CURRENT_FUNCTION __FUNCTION__
+# endif
+#else
+# define SPIDERAPE_CURRENT_FUNCTION __FUNCTION__
+#endif
+
+
#endif // s11n_net_NCJS_DEBUGGERING_MACROS_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-29 06:17:15
|
Revision: 48
http://spiderape.svn.sourceforge.net/spiderape/?rev=48&view=rev
Author: sgbeal
Date: 2007-09-28 23:17:12 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
added more mouse support. Needs new macros from this morning's SpiderApe commit.
Modified Paths:
--------------
plugins/ncurses/SpiderApe-Plugin-ncurses.odt
plugins/ncurses/ncwrapper.cpp
plugins/ncurses/ncwrapper.hpp
plugins/ncurses/scripts/mouse.js
Modified: plugins/ncurses/SpiderApe-Plugin-ncurses.odt
===================================================================
(Binary files differ)
Modified: plugins/ncurses/ncwrapper.cpp
===================================================================
--- plugins/ncurses/ncwrapper.cpp 2007-09-28 14:39:50 UTC (rev 47)
+++ plugins/ncurses/ncwrapper.cpp 2007-09-29 06:17:12 UTC (rev 48)
@@ -66,14 +66,12 @@
// ASSERTNC asserts that stdscr is available.
#define ASSERTNC(FUNCNAME,CX) if( ! stdscr ) { \
- JS_ReportError(CX,"Function %s() requires that curses mode be running (try nc_initscr()).", FUNCNAME); \
- return JS_FALSE; \
+ return ape::set_pending_exception(CX,"Function %s() requires that curses mode be running (try nc_initscr()).", FUNCNAME); \
}
// ASSERTARGC asserts that the argv array meets some basic condition. It also calls ASSERTNC(FUNCNAME,CX).
#define ASSERTARGC(FUNCNAME,CX,ARGC_EXPR) if(!(ARGC_EXPR)) { \
- JS_ReportError( CX,"%s() argument check failed: %s",FUNCNAME,# ARGC_EXPR ); \
- return JS_FALSE; \
+ return ape::set_pending_exception( CX,"%s() argument check failed: %s",SPIDERAPE_CURRENT_FUNCTION,# ARGC_EXPR ); \
} \
ASSERTNC(FUNCNAME,CX)
@@ -466,6 +464,11 @@
<< "this['BUTTON4_DOUBLE_CLICKED']="<<NCURSES_MOUSE_MASK(4,NCURSES_DOUBLE_CLICKED)<<";"
<< "this['BUTTON4_TRIPLE_CLICKED']="<<NCURSES_MOUSE_MASK(4,NCURSES_TRIPLE_CLICKED)<<";"
+ << "this['BUTTON_CTRL']="<<BUTTON_CTRL<<';'
+ << "this['BUTTON_SHIFT']="<<BUTTON_SHIFT<<';'
+ << "this['BUTTON_ALT']="<<BUTTON_ALT<<';'
+ << "this['REPORT_MOUSE_POSITION']="<<REPORT_MOUSE_POSITION<<';'
+ << "this['ALL_MOUSE_EVENTS']="<<ALL_MOUSE_EVENTS<<';'
;
#endif
@@ -541,6 +544,8 @@
{"nc_keyok", nc_keyok, 0},
{"nc_keypad", nc_keypad, 0},
{"nc_meta", nc_meta, 0},
+ {"nc_mouseinterval",nc_mouseinterval,0},
+ {"nc_mousemask",nc_mousemask,0},
{"nc_move_panel", nc_move_panel, 0},
{"nc_movewin", nc_movewin, 0 },
{"nc_mvwaddch", nc_mvwaddch, 0},
@@ -615,6 +620,7 @@
{"nc_wdelch", nc_wdelch, 0},
{"nc_wdeleteln", nc_wdeleteln, 0},
{"nc_wechochar", nc_wechochar, 0},
+ {"nc_wenclose",nc_wenclose,0},
{"nc_werase", nc_werase, 0},
{"nc_wgeometry", nc_wgeometry, 0},
{"nc_wgetch", nc_wgetch, 0},
@@ -773,9 +779,9 @@
::keypad( stdscr, true );
::meta( stdscr, true );
::noecho();
-#if NCURSES_MOUSE_VERSION
- mousemask( ALL_MOUSE_EVENTS, NULL );
-#endif // NCURSES_MOUSE_VERSION
+// #if NCURSES_MOUSE_VERSION
+// mousemask( ALL_MOUSE_EVENTS, NULL );
+// #endif // NCURSES_MOUSE_VERSION
if( ! create_ncurses_objects(cx,globobj) )
{
@@ -2128,6 +2134,48 @@
return JS_TRUE;
}
+ JS_FUNC(nc_wenclose)
+ {
+ ASSERTARGC("nc_wenclose",cx,(3==argc));
+ *rval = bool_to_jsval( cx, ::ape::fwd_to_func3<bool,WINDOW const *,int,int>( wenclose, cx, obj, argc, argv ) );
+ return JS_TRUE;
+ }
+
+ JS_FUNC(nc_mouseinterval)
+ {
+ ASSERTARGC("nc_mouseinterval",cx,(1==argc));
+#if ! NCURSES_MOUSE_VERSION
+ *rval = JSVAL_NULL;
+#else
+ *rval = int_to_jsval( cx, ::ape::fwd_to_func1<int,int>( mouseinterval, cx, obj, argc, argv ) );
+#endif
+ return JS_TRUE;
+ }
+
+ JS_FUNC(nc_mousemask)
+ {
+ ASSERTARGC("nc_mousemask",cx,((0==argc) || (1==argc)));
+#if ! NCURSES_MOUSE_VERSION
+ *rval = JSVAL_NULL;
+#else
+ mmask_t mret;
+ if( 0 == argc )
+ {
+ // A weird workaround for the lack of a real getter:
+ mousemask( ALL_MOUSE_EVENTS, &mret );
+ mousemask( mret, NULL );
+ }
+ else
+ {
+ mmask_t arg = jsval_to_long( cx, argv[0] );
+ mret = mousemask( arg, NULL );
+ }
+ *rval = long_to_jsval( cx, mret );
+#endif
+ return JS_TRUE;
+ }
+
+
JS_FUNC(nc_getmouse)
{
#if ! NCURSES_MOUSE_VERSION
@@ -2142,14 +2190,24 @@
quasi.set( "z", int_to_jsval(evt.z) );
quasi.set( "id", int_to_jsval(evt.id) );
quasi.set( "bstate", int_to_jsval(evt.bstate) );
- //scriptable scr( cx, quasi.js_object() );
- //scr.eval( "print('scr=',this.toSource())");
*rval = quasi.js_value();
#endif // NCURSES_MOUSE_VERSION
return JS_TRUE;
+ }
+
+ JS_FUNC(nc_ungetmouse)
+ {
+#if ! NCURSES_MOUSE_VERSION
+ *rval = JSVAL_NULL;
+#else
+ return ape::set_pending_exception(cx,"nc_ungetmouse() not yet implemented.");
+#endif // NCURSES_MOUSE_VERSION
+ return JS_TRUE;
+
}
+
} } // namespace ape::nc
#undef ASSERTARGC
Modified: plugins/ncurses/ncwrapper.hpp
===================================================================
--- plugins/ncurses/ncwrapper.hpp 2007-09-28 14:39:50 UTC (rev 47)
+++ plugins/ncurses/ncwrapper.hpp 2007-09-29 06:17:12 UTC (rev 48)
@@ -624,8 +624,33 @@
*/
NC_WRAPPER_FUNC(getmouse);
+ /** Not yet implemented. */
+ NC_WRAPPER_FUNC(ungetmouse);
+ NC_WRAPPER_FUNC(wenclose);
+ NC_WRAPPER_FUNC(mouseinterval);
/**
+ Similar, but not identical, to the native function.
+
+ If passed no arguments then it acts like a getter, fetching
+ the current mousemask value. If passed 1 argument it is
+ used as a mouse mask and the mask which gets actually
+ implemented is returned (which may be different than the
+ requested mask).
+
+ JS Usage:
+
+ var mask = nc_mousemask(); // getter
+
+ var actualmask = nc_mousemask( ... requested mask ... ); // setter
+
+
+ */
+ NC_WRAPPER_FUNC(mousemask);
+
+
+
+ /**
This non-standard curses function returns the
geometry of it's first argument, which must be
a WINDOW.
Modified: plugins/ncurses/scripts/mouse.js
===================================================================
--- plugins/ncurses/scripts/mouse.js 2007-09-28 14:39:50 UTC (rev 47)
+++ plugins/ncurses/scripts/mouse.js 2007-09-29 06:17:12 UTC (rev 48)
@@ -1,35 +1,34 @@
assert(open_dll('../ncurses.so'));
nc_initscr();
+nc_capture_cout(stdscr);
+var mask = ncurses.BUTTON1_PRESSED | ncurses.BUTTON1_RELEASED;
+print( "requesting mousemask(",format_token('%08x',mask),") ==",
+ format_token('%08x',nc_mousemask(mask)) );
+print("actual mousemask() ==",format_token('%08x',nc_mousemask()) );;
nc_scrollok(stdscr,true);
nc_noecho();
-var sub = nc_subwin(stdscr,3,4,5,6);
-nc_wbkgd( sub, ncurses["-"] | nc_color("white","red"));
-nc_capture_cout(stdscr);
-nc_wmove(stdscr,12,0);
-print("nc_getparyx(sub) ==",nc_getparyx(sub).toSource());
-print("nc_getparyx(sub).y ==",nc_getparyx(sub).y);
-print("nc_getpary(sub) ==",nc_getpary(sub));
-print("nc_getparx(sub) ==",nc_getparx(sub));
-if( 0 ) {
- for( var i = 0; i < 4; ++i ) {
- print("nc_curs_set("+i+") ==",nc_curs_set(i));
- nc_getch();
- }
-}
-if( 1 ) {
- print( "mouse ?? ==",ncurses.MOUSE_VERSION );
+// This subwin is only to demonstrate nc_wenclose()
+var subwin = nc_subwin(stdscr,5,15,0,nc_screen_width()/2);
+nc_wbkgd( subwin, nc_color('white','red') | ncurses.A_BOLD );
+nc_waddstr(subwin, "Click here.");
+nc_wrefresh(subwin);
+nc_wmove(stdscr,10,0);
+
+
+if( ncurses.MOUSE_VERSION ) {
print("Play with the mouse. Tap 'q' to quit.");
var key = 0;
while( ascii('q') != (key = nc_wgetch(stdscr)) ) {
if( key == ncurses.KEY_MOUSE ) {
var evt = nc_getmouse();
print( "mouse :",key,evt.toSource() );
+ if( nc_wenclose(subwin,evt.y,evt.x) ) {
+ print("Event hit the subwindow.");
+ }
}
}
}
-print("Tap any key to exit.");
-nc_wgetch(stdscr);
nc_endwin();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 14:39:52
|
Revision: 47
http://spiderape.svn.sourceforge.net/spiderape/?rev=47&view=rev
Author: sgbeal
Date: 2007-09-28 07:39:50 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
more reorgs and additions
Modified Paths:
--------------
plugins/ncurses/SpiderApe-Plugin-ncurses.odt
Modified: plugins/ncurses/SpiderApe-Plugin-ncurses.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 11:18:21
|
Revision: 46
http://spiderape.svn.sourceforge.net/spiderape/?rev=46&view=rev
Author: sgbeal
Date: 2007-09-28 04:18:20 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
minor fixes... moving over to the laptop
Modified Paths:
--------------
plugins/ncurses/ChangeLog
plugins/ncurses/NCursesPanel.js
plugins/ncurses/binder.cpp
plugins/ncurses/ncwrapper.cpp
plugins/ncurses/panel.cpp
plugins/ncurses/quicktests.js
plugins/ncurses/scripts/ripoffline.js
Modified: plugins/ncurses/ChangeLog
===================================================================
--- plugins/ncurses/ChangeLog 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/ChangeLog 2007-09-28 11:18:20 UTC (rev 46)
@@ -1,6 +1,23 @@
This is the informal changelog for the 'nc' plugin for SpiderApe.
+20070928:
+
+- Fundmental rework of the cleanup done during nc_endwin(). i don't think
+it was actually cleaning up before.
+
+- Added several new bound functions. Now we're at 152 funcs.
+
+- NCursesWindow class is working. PANEL support works as an add-on to the
+NCursesWindow class, as opposed to a subclass. (The initial attempt
+was to make a subclass, but it behaved really buggy.)
+
+- Changed the way that WINDOW/PANEL/PAD handles are doled out to JS-space,
+to avoid accidentally re-using the same handle ID from the NCursesWindow
+class and to avoid the special-case ID handling of stdscr (which caused
+a segfault during shutdown/cleanup in some cases).
+
+
20070927:
- A minor bug fix for a broken return value in wbkgd().
@@ -10,7 +27,7 @@
low-level API.
- Removed the older NCurses dir from the svn repository and renamed
-this one to 'ncurses'. svn (suprisingly) choked on the case-sensitive
+this one to 'ncurses'. svn (suprisingly) choked on the case-insensitive
similar names, though, and left my dirs in a bit of a mess. :/
Modified: plugins/ncurses/NCursesPanel.js
===================================================================
--- plugins/ncurses/NCursesPanel.js 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/NCursesPanel.js 2007-09-28 11:18:20 UTC (rev 46)
@@ -1,6 +1,39 @@
assert(open_dll('./ncurses.so'));
+
+var doRipoffLine = 1;
+
+if( doRipoffLine ) { // ripoffline demo...
+ var ripwins = new Array();
+ function ripoffhandler(win,cols) {
+ ripwins[ripwins.length] = win;
+ return 0;
+ }
+
+ function ripoffhandler2(win,cols) {
+ ripwins[ripwins.length] = win;
+ return 0;
+ }
+
+ for( var i = 0; i < 5; ++i ) {
+ var even = (i%2);
+ nc_ripoffline( even ? -1 : 1,
+ even ? ripoffhandler : ripoffhandler2 );
+ }
+}
+//nc_ripoffline
nc_initscr();
+if( doRipoffLine ) {
+ var fgcolors = new Array( 'white', 'yellow', 'red', 'cyan', 'blue' );
+ for( var i = 0; i < ripwins.length; ++i ) {
+ var rw = ripwins[i];
+ nc_wbkgd( rw, nc_color(fgcolors[i%5],'black') );
+ //nc_wattron( rw, ncurses.A_REVERSE );
+ nc_mvwaddstr( rw, 0, 0, "Ripped-off line #"+i );
+ nc_wrefresh( rw );
+ }
+}
+
var root = new NCursesWindow(nc_new_panel(nc_newwin(0,0,0,0)));
root.background( ascii('~') | nc_color('black','yellow'));
nc_curs_set(0);
@@ -12,7 +45,7 @@
var pos = 'blue';
var woffset = {x:5,y:2};
-var wpos = {y:0,x:0,incr:function(){this.x+=woffset.x;this.y+=woffset.y}};
+var wpos = {y:3,x:3,incr:function(){this.x+=woffset.x;this.y+=woffset.y}};
var cpnl = null;
curpnl = wins[pos] = new NCursesWindow( nc_new_panel(nc_newwin(rootgeom.h / 2, rootgeom.w / 2, wpos.y, wpos.x)));
wpos.incr();
Modified: plugins/ncurses/binder.cpp
===================================================================
--- plugins/ncurses/binder.cpp 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/binder.cpp 2007-09-28 11:18:20 UTC (rev 46)
@@ -181,8 +181,8 @@
{
// Kludge: remove stream-to-window redirects:
using namespace Private;
- WindowStreamMap str( captured_streams() );
- captured_streams().clear();
+ WindowStreamMap str;
+ str.swap( captured_streams() );
typedef WindowStreamMap::iterator WIT;
WIT stit = str.begin();
WIT head = stit;
@@ -193,7 +193,6 @@
}
// /KLUDGE
}
-#if 1
/**
We walk the list of all binders and make a deletion
queue for items WITHOUT parents (those with parents
@@ -204,7 +203,6 @@
*/
BinderList them;
BinderList bl( JWBinder::all_binders() );
- //JWBinder::all_binders().clear();
BinderList::reverse_iterator rit = bl.rbegin();
JWBinder * cur = 0;
for( ; bl.rend() != rit; ++rit )
@@ -223,7 +221,6 @@
{
delete *it;
}
-#endif
}
int JWBinder::free_panel()
Modified: plugins/ncurses/ncwrapper.cpp
===================================================================
--- plugins/ncurses/ncwrapper.cpp 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/ncwrapper.cpp 2007-09-28 11:18:20 UTC (rev 46)
@@ -333,13 +333,14 @@
////////////////////////////////////////
// set up the F#'ing key names...
for( int i = KEY_F(1); i <= KEY_F(12); ++i ) {
- os << "this['F"<<(i-KEY_F(0))<<"'] = "<<i<<";\n"
- << "this["<<i<<"] = 'F"<<(i-KEY_F(0))<<"';\n"
+ os << "this['KEY_F"<<(i-KEY_F(0))<<"'] = "<<i<<";\n"
+ << "this["<<i<<"] = 'KEY_F"<<(i-KEY_F(0))<<"';\n"
;
}
+ os << "this.KEY_F = function(n) { return this['KEY_F'+n];};";
// Page/Movement keys:
- os << "this["<<KEY_DOWN<<"] = 'DOWN';\n"
+ os << "this["<<KEY_DOWN<<"] = 'KEY_DOWN';\n"
<< "this['KEY_DOWN'] = "<<KEY_DOWN<<";\n"
<< "this["<<KEY_UP<<"] = 'KEY_UP';\n"
<< "this['KEY_UP'] = "<<KEY_UP<<";\n"
@@ -429,6 +430,8 @@
<< "this['ACS_BSBS'] = "<<ACS_BSBS<<";\n"
<< "this['ACS_SBSB'] = "<<ACS_SBSB<<";\n"
<< "this['ACS_SSSS'] = "<<ACS_SSSS<<";\n"
+
+
<< "this['KEY_MOUSE'] = "<<KEY_MOUSE<<";\n"
<< "this['KEY_RESIZE'] = "<<KEY_RESIZE<<";\n"
<< "this['KEY_EVENT'] = "<<KEY_EVENT<<";\n"
@@ -456,6 +459,13 @@
<< "this['BUTTON3_CLICKED']="<<NCURSES_MOUSE_MASK(3,NCURSES_BUTTON_CLICKED)<<";"
<< "this['BUTTON3_DOUBLE_CLICKED']="<<NCURSES_MOUSE_MASK(3,NCURSES_DOUBLE_CLICKED)<<";"
<< "this['BUTTON3_TRIPLE_CLICKED']="<<NCURSES_MOUSE_MASK(3,NCURSES_TRIPLE_CLICKED)<<";"
+
+ << "this['BUTTON4_RELEASED']="<<NCURSES_MOUSE_MASK(4,NCURSES_BUTTON_RELEASED)<<";"
+ << "this['BUTTON4_PRESSED']="<<NCURSES_MOUSE_MASK(4,NCURSES_BUTTON_PRESSED)<<";"
+ << "this['BUTTON4_CLICKED']="<<NCURSES_MOUSE_MASK(4,NCURSES_BUTTON_CLICKED)<<";"
+ << "this['BUTTON4_DOUBLE_CLICKED']="<<NCURSES_MOUSE_MASK(4,NCURSES_DOUBLE_CLICKED)<<";"
+ << "this['BUTTON4_TRIPLE_CLICKED']="<<NCURSES_MOUSE_MASK(4,NCURSES_TRIPLE_CLICKED)<<";"
+
;
#endif
@@ -591,7 +601,6 @@
{"nc_waddvnstr", nc_waddvnstr, 0},
{"nc_waddvstr", nc_waddvstr, 0},
{"nc_wattroff", nc_wattroff, 0},
- {"nc_wattroff", nc_wattroff, 0},
{"nc_wattron", nc_wattron, 0},
{"nc_wattrset", nc_wattrset, 0},
{"nc_wbegx", nc_wbegx, 0},
@@ -1015,7 +1024,7 @@
JS_FUNC(nc_wprint)
{
- ASSERTARGC("nc_wbkgd",cx,(0<argc));
+ ASSERTARGC("nc_wprint",cx,(0<argc));
WINDOW * w = jsval_to_WINDOW(cx,argv[0]);
if( ! w )
{
@@ -1063,7 +1072,7 @@
if( WIN_IS_PAD(w) )
{
// todo???: prefresh()
- JS_ReportWarning(cx,"nc_wrefresh() was passed a PAD. This is not legal." );
+ //JS_ReportWarning(cx,"nc_wrefresh() was passed a PAD. This is not legal." );
return JS_TRUE;
}
else if( bin->panel() )
@@ -2030,7 +2039,7 @@
JS_FUNC(nc_keypad)
{
ASSERTARGC("nc_mvwinch",cx,(2==argc));
- *rval = int_to_jsval( cx, ::ape::fwd_to_func2<int,WINDOW *,int>( keypad, cx, obj, argc, argv ) );
+ *rval = int_to_jsval( cx, ::ape::fwd_to_func2<int,WINDOW *,bool>( keypad, cx, obj, argc, argv ) );
return JS_TRUE;
}
@@ -2043,7 +2052,7 @@
int n = jsval_to_int(*(argv++));
int attr = jsval_to_int(*(argv++));
short color = jsval_to_short(*(argv++));
- *rval = mvwchgat(w,y,x,n,attr,color,0);
+ *rval = int_to_jsval( mvwchgat(w,y,x,n,attr,color,0) );
return JS_TRUE;
}
JS_FUNC(nc_wchgat)
@@ -2066,7 +2075,7 @@
int attr = av++.to<int>();
short color = av++.to<short>();
#endif
- *rval = wchgat(w,n,attr,color,0);
+ *rval = int_to_jsval( wchgat(w,n,attr,color,0) );
return JS_TRUE;
}
@@ -2076,8 +2085,7 @@
*rval = NCJS_ERR;
if( 2 != argc )
{
- JS_ReportError( cx, "nc_ripoffline() requires 2 arguments: ([1 || -1], Function)" );
- return JS_FALSE;
+ return ape::set_pending_exception( cx, "nc_ripoffline() requires 2 arguments: ([1 || -1], Function)" );
}
int l = jsval_to_int( argv[0] );
if( 0 == l )
Modified: plugins/ncurses/panel.cpp
===================================================================
--- plugins/ncurses/panel.cpp 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/panel.cpp 2007-09-28 11:18:20 UTC (rev 46)
@@ -221,10 +221,9 @@
JS_FUNC(nc_replace_panel)
{
- JS_ReportError(cx,"%s:%d: nc_replace_panel() probably can't be correctly implemented here.",
+ *rval = ::ape::int_to_jsval(-1);
+ return ape::set_pending_exception( cx,"%s:%d: nc_replace_panel() probably can't be correctly implemented here.",
__FILE__, __LINE__ );
- *rval = ::ape::int_to_jsval(-1);
- return JS_FALSE;
ASSERTARGC("nc_replace_panel",cx,(2==argc));
CHECKBINDER("nc_replace_panel",argv[0]);
Modified: plugins/ncurses/quicktests.js
===================================================================
--- plugins/ncurses/quicktests.js 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/quicktests.js 2007-09-28 11:18:20 UTC (rev 46)
@@ -1,35 +1,7 @@
assert(open_dll('./ncurses.so'));
nc_initscr();
-nc_scrollok(stdscr,true);
-nc_noecho();
-var sub = nc_subwin(stdscr,3,4,5,6);
-nc_wbkgd( sub, ncurses["-"] | nc_color("white","red"));
-nc_capture_cout(stdscr);
-nc_wmove(stdscr,12,0);
-print("nc_getparyx(sub) ==",nc_getparyx(sub).toSource());
-print("nc_getparyx(sub).y ==",nc_getparyx(sub).y);
-print("nc_getpary(sub) ==",nc_getpary(sub));
-print("nc_getparx(sub) ==",nc_getparx(sub));
-
-if( 0 ) {
- for( var i = 0; i < 4; ++i ) {
- print("nc_curs_set("+i+") ==",nc_curs_set(i));
- nc_getch();
- }
+for( var k in ncurses ) {
+ cerr( k,'=',ncurses[k] );
}
-if( 1 ) {
- print( "mouse ?? ==",ncurses.MOUSE_VERSION );
- print("Play with the mouse. Tap 'q' to quit.");
- var key = 0;
- while( ascii('q') != (key = nc_wgetch(stdscr)) ) {
- if( key == ncurses.KEY_MOUSE ) {
- var evt = nc_getmouse();
- print( "mouse :",key,evt.toSource() );
- }
- }
-}
-
-print("Tap any key to exit.");
-nc_wgetch(stdscr);
nc_endwin();
Modified: plugins/ncurses/scripts/ripoffline.js
===================================================================
--- plugins/ncurses/scripts/ripoffline.js 2007-09-28 07:11:07 UTC (rev 45)
+++ plugins/ncurses/scripts/ripoffline.js 2007-09-28 11:18:20 UTC (rev 46)
@@ -4,7 +4,7 @@
if( ! is_defined( 'ncurses' ) )
{
- var dll = 'nc';
+ var dll = '../ncurses.so';
if( ! open_dll(dll) ) {
throw new Error("JSWindow could not load plugin from '"+dll+"'");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 07:11:09
|
Revision: 45
http://spiderape.svn.sourceforge.net/spiderape/?rev=45&view=rev
Author: sgbeal
Date: 2007-09-28 00:11:07 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
lots of changes/reorgs/additions. Going to bed.
Modified Paths:
--------------
plugins/ncurses/SpiderApe-Plugin-ncurses.odt
Modified: plugins/ncurses/SpiderApe-Plugin-ncurses.odt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 07:10:43
|
Revision: 44
http://spiderape.svn.sourceforge.net/spiderape/?rev=44&view=rev
Author: sgbeal
Date: 2007-09-28 00:10:42 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
egg
Added Paths:
-----------
plugins/ncurses/scripts/mouse.js
Added: plugins/ncurses/scripts/mouse.js
===================================================================
--- plugins/ncurses/scripts/mouse.js (rev 0)
+++ plugins/ncurses/scripts/mouse.js 2007-09-28 07:10:42 UTC (rev 44)
@@ -0,0 +1,35 @@
+assert(open_dll('../ncurses.so'));
+
+nc_initscr();
+nc_scrollok(stdscr,true);
+nc_noecho();
+var sub = nc_subwin(stdscr,3,4,5,6);
+nc_wbkgd( sub, ncurses["-"] | nc_color("white","red"));
+nc_capture_cout(stdscr);
+nc_wmove(stdscr,12,0);
+print("nc_getparyx(sub) ==",nc_getparyx(sub).toSource());
+print("nc_getparyx(sub).y ==",nc_getparyx(sub).y);
+print("nc_getpary(sub) ==",nc_getpary(sub));
+print("nc_getparx(sub) ==",nc_getparx(sub));
+
+if( 0 ) {
+ for( var i = 0; i < 4; ++i ) {
+ print("nc_curs_set("+i+") ==",nc_curs_set(i));
+ nc_getch();
+ }
+}
+if( 1 ) {
+ print( "mouse ?? ==",ncurses.MOUSE_VERSION );
+ print("Play with the mouse. Tap 'q' to quit.");
+ var key = 0;
+ while( ascii('q') != (key = nc_wgetch(stdscr)) ) {
+ if( key == ncurses.KEY_MOUSE ) {
+ var evt = nc_getmouse();
+ print( "mouse :",key,evt.toSource() );
+ }
+ }
+}
+
+print("Tap any key to exit.");
+nc_wgetch(stdscr);
+nc_endwin();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 04:23:10
|
Revision: 43
http://spiderape.svn.sourceforge.net/spiderape/?rev=43&view=rev
Author: sgbeal
Date: 2007-09-27 21:23:08 -0700 (Thu, 27 Sep 2007)
Log Message:
-----------
endwin-related window cleanup issues appear to be solved.
Modified Paths:
--------------
plugins/ncurses/binder.cpp
plugins/ncurses/ncwrapper.cpp
Modified: plugins/ncurses/binder.cpp
===================================================================
--- plugins/ncurses/binder.cpp 2007-09-28 03:44:42 UTC (rev 42)
+++ plugins/ncurses/binder.cpp 2007-09-28 04:23:08 UTC (rev 43)
@@ -16,6 +16,13 @@
}
} // namespace Private
+ JWBinder::BinderList & JWBinder::all_binders()
+ {
+ static BinderList bob;
+ return bob;
+ }
+
+
void JWBinder::link_child( JWBinder * ch )
{
if( ! ch ) return;
@@ -43,7 +50,7 @@
{
::ape::bind::bind_native<PANEL>( this->m_cx, this->m_v, this->m_pnl );
}
- //JWBinder::all_binders().push_back(this);
+ JWBinder::all_binders().push_back(this);
}
JWBinder::JWBinder(JSContext *cx, PANEL *p, jsval jv ) :
m_cx(cx), m_win(panel_window(p)), m_pnl(p), m_v(jv),
@@ -60,14 +67,6 @@
jsval JWBinder::js_value() const { return this->m_v; }
-// unsigned long JWBinder::flags() const { return this->m_f; }
-// unsigned long JWBinder::flags( unsigned long f )
-// {
-// unsigned long ret = f;
-// this->m_f = f;
-// return ret;
-// }
-
JSContext * JWBinder::js_context() { return this->m_cx; }
WINDOW * JWBinder::window() { return this->m_win; }
@@ -105,74 +104,80 @@
JWBinder::~JWBinder()
{
- //JWBinder::all_binders().remove(this);
- this->parent( 0 );
+ JWBinder::all_binders().remove(this);
::ape::bind::unbind_native<JWBinder>( this->m_cx, this->m_v, this );
- ::ape::bind::unbind_native<WINDOW>( this->m_cx, this->m_v, this->m_win );
- if( 0 )
+
+ // We re-grab the WINDOW from the central repo to avoid having a dangling WINDOW
+ // when two binders point to the same WINDOW (as in the case of PANELized WINDOWS).
+ WINDOW * theWin = ape::bind::get_native<WINDOW*>( this->m_cx, this->m_v );
+ if( ! theWin ) return;
+ ::ape::bind::unbind_native<WINDOW>( this->m_cx, this->m_v, theWin );
+
+#if 0
{
void * pt = this->m_pnl ? (void*)this->m_pnl : (void*)this->m_win;
- CERR << "Deleting "<<
- (this->m_pnl ? "PANEL " : "WINDOW ") << std::hex << pt
- << " with"<<(this->m_parent?"out":" ")<<" parent"
- << ", JSObject " << std::hex << jsval_to_cstring( this->js_context(), this->js_value() )
+ CERR << "Deleting WINDOW"<<
+ (this->m_pnl ? "+PANEL" : "") << std::hex << pt
+ << ", "<<(this->m_parent?"with":"without")<<" parent"
<< '\n';
}
+#endif //debuggering output
- {
- // Kludge: remove stream-to-window redirects:
+ this->parent( 0 );
+
+ { // KLUDGE #1: remove stream-to-window redirects:
using namespace Private;
WindowStreamMap & str = captured_streams();
typedef WindowStreamMap::iterator WIT;
- WIT stit = str.lower_bound(this->m_win);
+ WIT stit = str.lower_bound(theWin);
WIT head = stit;
- WIT stet = str.upper_bound(this->m_win);
+ WIT stet = str.upper_bound(theWin);
for( ; stet != stit; ++stit )
{
delete (*stit).second;
//str.erase(stit);
}
str.erase( head, stet );
- // /KLUDGE
- }
- {
- // KLUDGE #2: remove data bound via nc_set_userdata()
+ } // /KLUDGE #1
+
+ { // KLUDGE #2: remove data bound via nc_set_userdata()
typedef ::ape::jsval_t JT;
- JT * j = ::ape::bind::get_native<JT>( this->js_context(), this->js_value() );
+ JT * j = ::ape::bind::get_native<JT>( this->js_context(), this->m_v );
if( j )
{
- ::ape::bind::unbind_native<JT>( this->js_context(), this->js_value(), j );
+ ::ape::bind::unbind_native<JT>( this->js_context(), this->m_v, j );
delete j;
j = 0;
}
- // /KLUDGE #2
+ }// /KLUDGE #2
+
+ { // Free up children ...
+ BinderList lcp(this->m_ch); // need a copy to avoid modifying original while we're deleting.
+ BinderList::iterator it = lcp.begin();
+ for( ; lcp.end() != it; ++it )
+ {
+#if 0
+ CERR << "Deleting child WINDOW " << std::hex << (*it)->window() << '\n';
+#endif // debuggering output
+ delete *it;
+ }
}
- BinderList lcp(this->m_ch); // need a copy to avoid modifying original while we're deleting.
- BinderList::iterator it = lcp.begin();
- for( ; lcp.end() != it; ++it )
- {
- if(1) CERR << "Deleting child WINDOW " << std::hex << (*it)->window()
- << ", JSObject " << std::hex << jsval_to_cstring( this->js_context(), (*it)->js_value() )
- << '\n';
- delete *it;
- }
- if( stdscr && this->m_win )
+ if( stdscr && theWin )
{
- if( this->m_win != stdscr )
+ //werase(theWin);
+ //CERR << "FIXME: panel is not being freed!\n";
+ this->free_panel();
+ if( theWin != stdscr )
{
- werase(this->m_win);
- delwin( this->m_win );
+ delwin(theWin);
}
}
- this->free_panel();
}
void JWBinder::endwin_cleanup()
{
- CERR << "JWBinder::endwin_cleanup()...\n";
-
{
// Kludge: remove stream-to-window redirects:
using namespace Private;
@@ -188,7 +193,7 @@
}
// /KLUDGE
}
-#if 0
+#if 1
/**
We walk the list of all binders and make a deletion
queue for items WITHOUT parents (those with parents
@@ -198,7 +203,8 @@
avoid a segfault later on.
*/
BinderList them;
- BinderList & bl = JWBinder::all_binders();
+ BinderList bl( JWBinder::all_binders() );
+ //JWBinder::all_binders().clear();
BinderList::reverse_iterator rit = bl.rbegin();
JWBinder * cur = 0;
for( ; bl.rend() != rit; ++rit )
@@ -220,17 +226,12 @@
#endif
}
- JWBinder::BinderList & JWBinder::all_binders()
- {
- static BinderList bob;
- return bob;
- }
-
int JWBinder::free_panel()
{
- if( !stdscr || !this->m_pnl ) return ERR;
- ::ape::bind::unbind_native<PANEL>( this->m_cx, this->m_v, this->m_pnl );
- int ret = del_panel( this->m_pnl );
+ PANEL * thePanel = ape::bind::get_native<PANEL*>( this->m_cx, this->m_v );
+ if( !stdscr || !thePanel ) return ERR;
+ ::ape::bind::unbind_native<PANEL*>( this->m_cx, this->m_v, thePanel );
+ int ret = del_panel( thePanel );
this->m_pnl = 0;
return ret;
}
Modified: plugins/ncurses/ncwrapper.cpp
===================================================================
--- plugins/ncurses/ncwrapper.cpp 2007-09-28 03:44:42 UTC (rev 42)
+++ plugins/ncurses/ncwrapper.cpp 2007-09-28 04:23:08 UTC (rev 43)
@@ -794,12 +794,8 @@
return JS_TRUE;
}
ripoff::reset(); // must come before JWBinder::endwin_cleanup()!!!
- //CERR << "Freeing stdscr property...\n";
JS_DeleteProperty(cx, obj, "stdscr");
- //CERR << "Freed stdscr property.\n";
- CERR << "FIXME: nc_endwin cleanup: need to nuke all window resources!\n";
JWBinder::endwin_cleanup();
- //CERR << "DONE: endwin_cleanup()!\n";
int rc = endwin();
if( 0 != rc )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sg...@us...> - 2007-09-28 03:44:51
|
Revision: 42
http://spiderape.svn.sourceforge.net/spiderape/?rev=42&view=rev
Author: sgbeal
Date: 2007-09-27 20:44:42 -0700 (Thu, 27 Sep 2007)
Log Message:
-----------
mostly works but has seriously broken endwin cleanup routines which need fixing
Modified Paths:
--------------
plugins/ncurses/Makefile
plugins/ncurses/NCursesPanel.cpp
plugins/ncurses/NCursesPanel.js
plugins/ncurses/NCursesWindow.cpp
plugins/ncurses/NCursesWindow.hpp
plugins/ncurses/binder.cpp
plugins/ncurses/binder.hpp
plugins/ncurses/ncwrapper.cpp
plugins/ncurses/ncwrapper.hpp
plugins/ncurses/panel.cpp
plugins/ncurses/plugin.make
plugins/ncurses/scripts/JCWindow.inc.js
plugins/ncurses/scripts/ncpad.js
plugins/ncurses/scripts/ncpanel.js
plugins/ncurses/scripts/ncurses.js
plugins/ncurses/scripts/ncws.inc.js
plugins/ncurses/scripts/ncws.js
plugins/ncurses/scripts/ripoffline.js
Modified: plugins/ncurses/Makefile
===================================================================
--- plugins/ncurses/Makefile 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/Makefile 2007-09-28 03:44:42 UTC (rev 42)
@@ -26,7 +26,9 @@
# APE.PLUGIN.TESTSCRIPT =
APE.PLUGIN.DIST_FILES = \
ChangeLog README \
- $(wildcard *.cpp *.hpp *.js) \
+ $(APE.PLUGIN.SOURCES) \
+ $(APE.PLUGIN.HEADERS) \
+ $(wildcard *.js) \
$(wildcard scripts/*.js)
CLEAN_FILES += $(wildcard *~ scripts/*~)
Modified: plugins/ncurses/NCursesPanel.cpp
===================================================================
--- plugins/ncurses/NCursesPanel.cpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/NCursesPanel.cpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -9,6 +9,8 @@
#define JS_NATIVE_MEMBER(CL,FN) JSBool CL::FN( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval )
#define NCP_JS_NATIVE_MEMBER(FN) JS_NATIVE_MEMBER(NCursesPanel,FN)
+#define ENABLE_STATIC_INIT 0
+#if ENABLE_STATIC_INIT
namespace {
/**
This function will be called during static initialization phase
@@ -32,6 +34,7 @@
static bool inited_at_dlopen_time = ( spiderape_dll_init(),true );
}
+#endif // ENABLE_STATIC_INIT
namespace ape {
namespace nc {
@@ -67,7 +70,7 @@
static bool inited = false;
if( inited ) return;
inited = true;
- typedef ::ape::Class<NCursesPanel::strings::class_name,NCursesPanel> CT;
+ typedef NCursesPanel::ClassType CT;
CT::impl & ci = CT().Implement();
ci.Member<NCursesPanel::strings::bogo>( &NCursesPanel::bogo );
@@ -83,7 +86,7 @@
JSBool NCursesPanel::init_context( JSContext * cx, JSObject * obj )
{
NCursesPanel::init_js_class();
- typedef ::ape::Class<NCursesPanel::strings::class_name,NCursesPanel> CTP;
+ typedef NCursesPanel::ClassType CTP;
CTP::impl & cp = CTP().Implement();
cp.init_context(cx,obj);
typedef NCursesWindow::ClassType CTW;
Modified: plugins/ncurses/NCursesPanel.js
===================================================================
--- plugins/ncurses/NCursesPanel.js 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/NCursesPanel.js 2007-09-28 03:44:42 UTC (rev 42)
@@ -4,7 +4,10 @@
var root = new NCursesWindow(nc_new_panel(nc_newwin(0,0,0,0)));
root.background( ascii('~') | nc_color('black','yellow'));
nc_curs_set(0);
+nc_capture_cout(root.ncwindow());
var rootgeom = nc_wgeometry(root.ncwindow());
+root.moveCursor( rootgeom.h / 3 * 2, 0 );
+root.scrollOk();
var wins = [];
var pos = 'blue';
@@ -23,7 +26,6 @@
curpnl.background( nc_color('white',pos) );
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
curpnl.refresh();
-nc_capture_cout(curpnl.ncwindow());
curpnl.moveCursor(3,0);
print("This is stdout.");
@@ -42,25 +44,26 @@
curpnl.addString( "geom=="+curpnl.geometry().toSource() );
curpnl.sub = new NCursesWindow(curpnl);
curpnl.sub.background( nc_color('black','white') );
-curpnl.sub.addString("Subwindow of panel '"+pos+"'.\n");
+curpnl.sub.print("Subwindow of panel '"+pos+"'.");
+//curpnl.sub.refresh();
-function ref() { nc_update_panels(); nc_doupdate(); }
-curpnl.refresh(); curpnl.getch();
-curpnl.sub.addString("bottom =="+wins['red'].bottom() );
-curpnl.refresh(); curpnl.getch();
-curpnl.sub.addString("top =="+wins['cyan'].top() );
-curpnl.refresh(); curpnl.getch();
+function ref() { nc_update_panels(); nc_doupdate(); root.getch(); }
+ref()
+print("bottom =="+wins['red'].bottom() );
+ref()
+print("top =="+wins['cyan'].top() );
+ref();
curpnl = wins['red'];
curpnl.top();
-curpnl.refresh();curpnl.getch();
+ref();
wins['green'].top();
-curpnl.refresh();curpnl.getch();
-print("move =="+wins['cyan'].moveWindow(4,4) );
-curpnl.refresh(); curpnl.getch();
+ref();
+print("move =="+wins['green'].moveWindow(4,4) );
+ref();
+print("move =="+wins['green'].moveWindow(6,16) );
-
curpnl = wins['cyan'];
//curpnl.moveWindow( rootgeom.h/3, 1 );
//curpnl.hide();
@@ -72,10 +75,8 @@
// nc_doupdate();
var attr = ncurses.A_BLINK | ncurses.A_UNDERLINE | ncurses.A_STANDOUT;
-var win = wins['red'];
-win.moveCursor(0,0);
-win.attrOn(attr);
+root.attrOn(attr);
print( "Tap any key to quit." );
-win.attrOff( attr );
+root.attrOff( attr );
root.getch();
nc_endwin();
Modified: plugins/ncurses/NCursesWindow.cpp
===================================================================
--- plugins/ncurses/NCursesWindow.cpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/NCursesWindow.cpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -7,7 +7,6 @@
#define JS_NATIVE_MEMBER(CL,FN) JSBool CL::FN( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval )
#define NCW_JS_NATIVE_MEMBER(FN) JS_NATIVE_MEMBER(NCursesWindow,FN)
-#define NCP_JS_NATIVE_MEMBER(FN) JS_NATIVE_MEMBER(NCursesPanel,FN)
namespace {
/**
@@ -36,10 +35,6 @@
namespace ape {
namespace nc {
-
-
-
-
void NCursesWindow::shared_init( JSContext * cx )
{
if( stdscr ) return;
@@ -71,28 +66,26 @@
this->m_ncwinjv = WINDOW_to_jsval( cx, stdscr );
}
else if( 1 == argc )
- { // ctor(NCursesWindow) = parent window which we will wrap ourselves in
+ {
if( PANEL * p = JWBinder::get_panel(cx, argv[0] ) )
- {
+ { // ctor(PANEL)
this->m_ncwin = panel_window(p);
this->m_ncwinjv = WINDOW_to_jsval( cx, this->m_ncwin );
this->m_ncpanel = p;
-#if 0
- this->add_function( "bottom", "function(){return nc_bottom_panel(this.ncpanel());}");
- this->add_function( "hide", "function(){return nc_hide_panel(this.ncpanel());}");
- this->add_function( "moveWindow", "function(y,x) { return nc_move_panel( this.ncpanel(),y,x); }");
- this->add_function( "refresh", "function() { return nc_wrefresh(this.ncpanel()); }");
- this->add_function( "show", "function(){return nc_show_panel(this.ncpanel());}");
- this->add_function( "top", "function(){return nc_top_panel(this.ncpanel());}");
-#endif
}
+ else if( WINDOW * ncw = jsval_to_WINDOW(cx,argv[0]) )
+ { // ctor(WINDOW)
+ this->m_ncwinjv = argv[0];
+ this->m_ncwin = ncw;
+ }
else if( NCursesWindow * par = ape::jsval_to<NCursesWindow>( cx, argv[0] ) )
- { // ctor(NCursesWindow)
+ { // ctor(NCursesWindow) = parent window which we will wrap ourselves in
int w = par->width()-2;
int h = par->height()-2;
if( (w<=0) || (h<=0) )
{
- throw ape::exception( cx, "NCursesWindow 1-arg ctor: NCursesWindow parent is too small to contain a child.");
+ throw ape::exception( cx, "%s 1-arg ctor: NCursesWindow parent is too small to contain a child.",
+ NCursesWindow::strings::class_name);
}
jsval av[] = { par->window_handle_jsval(),
int_to_jsval(h), // lines
@@ -105,19 +98,17 @@
this->m_ncwin = jsval_to_WINDOW( cx, this->m_ncwinjv );
if( ! this->m_ncwin )
{
- throw new ape::exception( cx, "NCursesWindow 1-arg ctor: nc_derwin(NCursesWindow,%d,%d,%d,%d) failed!",
+ throw new ape::exception( cx, "%s 1-arg ctor: nc_derwin(NCursesWindow,%d,%d,%d,%d) failed!",
+ NCursesWindow::strings::class_name,
h,w,1,1);
}
this->set_parent( par );
}
- else if( WINDOW * ncw = jsval_to_WINDOW(cx,argv[0]) )
- { // ctor(WINDOW)
- this->m_ncwinjv = argv[0];
- this->m_ncwin = ncw;
- }
else
{
- throw new ape::exception( cx, "NCursesWindow 1-arg ctor: requires a WINDOW or NCursesWindow argument!" );
+ throw new ape::exception( cx, "%s 1-arg ctor: requires a PANEL or WINDOW or %s argument!",
+ NCursesWindow::strings::class_name,
+ NCursesWindow::strings::class_name );
}
}
else if( 4 == argc )
@@ -131,7 +122,8 @@
this->m_ncwin = jsval_to_WINDOW( cx, this->m_ncwinjv );
if( ! this->m_ncwin )
{
- throw new ape::exception( cx, "NCursesWindow 4-arg ctor: nc_newwin() failed!" );
+ throw new ape::exception( cx, "%s 4-arg ctor: nc_newwin() failed!",
+ NCursesWindow::strings::class_name);
}
}
else if( 5 == argc )
@@ -139,7 +131,9 @@
NCursesWindow * par = ape::jsval_to<NCursesWindow>( cx, argv[0] );
if( ! par )
{
- throw ape::exception( cx, "NCursesWindow 5-arg ctor requires (NCursesWindow,int,int,int,int) arguments.");
+ throw ape::exception( cx, "%s 5-arg ctor requires (%s,int,int,int,int) arguments.",
+ NCursesWindow::strings::class_name,
+ NCursesWindow::strings::class_name);
}
jsval av[] = { par->m_ncwinjv,
argv[1], argv[2],
@@ -147,37 +141,43 @@
nc_derwin( cx, JS_GetGlobalObject(cx), 5, av, &this->m_ncwinjv );
if( JSVAL_NULL == this->m_ncwinjv )
{
- throw new ape::exception( cx, "NCursesWindow 5-arg ctor: nc_derwin() failed!" );
+ throw new ape::exception( cx, "%s 5-arg ctor: nc_derwin() failed!",
+ NCursesWindow::strings::class_name);
}
this->m_ncwin = ape::jsval_to<WINDOW>( cx, this->m_ncwinjv );
this->set_parent( par );
}
else
{
- throw ape::exception( cx, "NCursesWindow ctor: did not get valid arguments." );
+ throw ape::exception( cx, "%s ctor: did not get valid arguments.",
+ NCursesWindow::strings::class_name);
}
if( ! this->m_ncwin )
{
- throw ape::exception( cx, "NCursesWindow ctor: did not get a WINDOW handle." );
+ throw ape::exception( cx, "%s ctor: this object has no valid WINDOW handle.",
+ NCursesWindow::strings::class_name );
}
- /**
- Note that Class<>'s ctor will bind this object to
- obj, but we cover the case of natively-created
- NCursesWindow by doing the binding ourselves here, and
- undoing it in the dtor.
- */
- ::ape::bind::bind_native<NCursesWindow>( this->js_context(),
+ ape::bind::bind_native<NCursesWindow>( this->js_context(),
this->js_value(),
this );
-// ::ape::bind::bind_native<WINDOW>( this->js_context(),
-// this->js_value(),
-// this->m_ncwin );
}
NCursesWindow::~NCursesWindow()
{
+ // We MUST unbind ourselves or the JS GC will end up causing a double-delete of this object:
+ ape::bind::unbind_native<NCursesWindow>( this->js_context(),
+ this->js_value(),
+ this );
+ if( ! stdscr )
+ {
+ return;
+ /**
+ This is to try to avoid a post-main() crash when GC finalizes
+ these objects.
+ */
+ }
if( this->m_par )
{
this->m_par->m_ch.remove( this );
@@ -201,14 +201,6 @@
}
catch(...) { /* ignore it! */ }
}
-
- /** See the notes in the ctor. */
- ::ape::bind::unbind_native<NCursesWindow>( this->js_context(),
- this->js_value(),
- this );
-// ::ape::bind::unbind_native<WINDOW>( this->js_context(),
-// this->js_value(),
-// this->m_ncwin );
}
void NCursesWindow::set_panel( PANEL * p )
@@ -335,7 +327,8 @@
av[4] = argv[3];
return nc_mvwaddnstr( cx, JS_GetGlobalObject(cx), 5, av, rval );
}
- return ape::set_pending_exception( cx, "NCursesWindow::%s() expects (string) or (y,x,string) arguments.",
+ return ape::set_pending_exception( cx, "%s::%s() expects (string) or (y,x,string) arguments.",
+ NCursesWindow::strings::class_name,
NCursesWindow::strings::wrap_addstr );
}
@@ -356,7 +349,8 @@
av[3] = argv[2];
return nc_mvwaddstr( cx, JS_GetGlobalObject(cx), 4, av, rval );
}
- return ape::set_pending_exception( cx, "NCursesWindow::%s() expects (int) or (y,x,int) arguments.",
+ return ape::set_pending_exception( cx, "%s::%s() expects (int) or (y,x,int) arguments.",
+ NCursesWindow::strings::class_name,
NCursesWindow::strings::wrap_addch );
}
@@ -399,7 +393,8 @@
return nc_mvwgetnstr(cx,glob,4,av,rval);
}
return ape::set_pending_exception( cx,
- "NCursesWindow::%s(): expects arguments matching one of: (), (N), (Y,X), or (Y,X,N)",
+ "%s::%s(): expects arguments matching one of: (), (N), (Y,X), or (Y,X,N)",
+ NCursesWindow::strings::class_name,
NCursesWindow::strings::wrap_getstring );
}
@@ -424,7 +419,8 @@
return nc_mvwhline(cx,glob,5,av,rval);
}
return ape::set_pending_exception( cx,
- "NCursesWindow::%s(): expects arguments matching one of: (int,N) (Y,X,int,N)",
+ "%s::%s(): expects arguments matching one of: (int,N) (Y,X,int,N)",
+ NCursesWindow::strings::class_name,
NCursesWindow::strings::wrap_hline );
}
@@ -448,7 +444,8 @@
return nc_mvwvline(cx,glob,5,av,rval);
}
return ape::set_pending_exception( cx,
- "NCursesWindow::%s(): expects arguments matching one of: (int,N) (Y,X,int,N)",
+ "%s::%s(): expects arguments matching one of: (int,N) (Y,X,int,N)",
+ NCursesWindow::strings::class_name,
NCursesWindow::strings::wrap_vline );
}
@@ -506,7 +503,6 @@
ci.Member<NCursesWindow::strings::wrap_getstring>( &NCursesWindow::wrap_getstring );
ci.Member<NCursesWindow::strings::wrap_hline>( &NCursesWindow::wrap_hline );
ci.Member<NCursesWindow::strings::wrap_vline>( &NCursesWindow::wrap_vline );
-
////////////////////////////////////////////////////
// If you want to automatically have a global instance
@@ -524,73 +520,7 @@
ci.Define();
}
- NCursesPanel::NCursesPanel( JSContext * cx, JSObject * obj, uint32 argc, jsval * argv, jsval * rval )
- : NCursesWindow( cx, obj, argc, argv, rval )
- {
- jsval pv = JSVAL_NULL;
- jsval av[1] = { this->window_handle_jsval() };
- nc_new_panel( cx, JS_GetGlobalObject(cx), 1, av, &pv );
- PANEL * p = jsval_to<PANEL>( cx, pv );
- if( ! p )
- {
- throw ape::exception( cx, "NCursesPanel::ctor couldn't get PANEL handle." );
- }
- this->set_panel( p );
- //ape::bind::bind_native<PANEL>( cx, pv, p );
-// this->add_function("tryit",
-// "function(){nc_hide_panel(");
- }
- NCursesPanel::~NCursesPanel()
- {
-
- }
-
- char const * NCursesPanel::strings::class_name = "NCursesPanel";
- char const * NCursesPanel::strings::bogo = "bogo";
-
- void NCursesPanel::init_js_class()
- {
- static bool inited = false;
- if( inited ) return;
- inited = true;
- typedef ::ape::Class<NCursesPanel::strings::class_name,NCursesPanel> CT;
- CT::impl & ci = CT().Implement();
-
- ci.Member<NCursesPanel::strings::bogo>( &NCursesPanel::bogo );
-
- ci.Define();
- }
-
- NCP_JS_NATIVE_MEMBER(bogo)
- {
- return JS_TRUE;
- }
-
- JSBool NCursesPanel::init_context( JSContext * cx, JSObject * obj )
- {
- NCursesPanel::init_js_class();
- typedef ::ape::Class<NCursesPanel::strings::class_name,NCursesPanel> CTP;
- CTP::impl & cp = CTP().Implement();
- cp.init_context(cx,obj);
- typedef NCursesWindow::ClassType CTW;
- CTW::impl & cw = CTW().Implement();
- JSBool ret = JS_SetPrototype( cx, cp.get_prototype(cx), cw.get_prototype(cx) );
- ape::scriptable proto( cx, cp.get_prototype(cx) );
- if( !(
- ret
- && proto.add_function( "bottom", "function(){return nc_bottom_panel(this.ncpanel());}")
- && proto.add_function( "hide", "function(){return nc_hide_panel(this.ncpanel());}")
- && proto.add_function( "moveWindow", "function(y,x) { return nc_move_panel( this.ncpanel(),y,x); }")
- && proto.add_function( "refresh", "function() { return nc_wrefresh(this.ncpanel()); }")
- && proto.add_function( "show", "function(){return nc_show_panel(this.ncpanel());}")
- && proto.add_function( "top", "function(){return nc_top_panel(this.ncpanel());}")
- )) {
- throw new ape::exception( cx, "NCursesPanel::init_context(): add_function() failed while setting up prototype functions." );
- }
- return ret;
- }
-
/**
Initialize NCursesWindow for the given context.
*/
@@ -609,10 +539,10 @@
// Add NCursesWindow to the context:
if( ! ci.init_context( cx, obj ) )
{
- throw ape::exception( cx, "NCursesWindow::init_context(): ClassType::impl::init_context() failed!" );
+ throw ape::exception( cx, "%s::init_context(): ClassType::impl::init_context() failed!",
+ NCursesWindow::strings::class_name );
}
//CERR << "NCursesWindow prototype == "<<std::hex<<ci.get_prototype(cx)<<'\n';
- ape::scriptable proto( cx, ci.get_prototype(cx) );
typedef std::map<std::string,std::string> StringMap;
StringMap funcmap;
@@ -634,7 +564,11 @@
funcmap["noutRefresh"] = "function() { return nc_wnoutrefresh(this.ncwindow()); }";
funcmap["overlay"] = "function(tgt) { return nc_overlay(this.ncwindow(),(tgt instanceof NCursesWindow) ? tgt.ncwindow() : tgt); }";
funcmap["overwrite"] = "function(tgt) { return nc_overwrite(this.ncwindow(),(tgt instanceof NCursesWindow) ? tgt.ncwindow() : tgt); }";
- // WTF? Causes an ape::exceptiion: && proto.add_function( "print", "function(str) { return this.addString(str+'\n'); }")
+ // WTF? Causes an ape::exception: && proto.add_function( "print", "function(str) { return this.addString(str+'\n'); }")
+ // WTF? funcmap["print"] = "function(str) { nc_wprint(this.ncwindow(),str); }";
+ // WTF? but THIS compiles: funcmap["print"] = "function(str) { }";
+ // WTF? And THIS works:
+ funcmap["print"] = "function() { var a=[]; a[0]=this.ncwindow(); for(var x=0;x<arguments.length;++x){a[1+x]=arguments[x]}; nc_wprint.apply(this,a);}";
funcmap["refresh"] = "function() { return nc_wrefresh(this.isPanel() ? this.ncpanel() : this.ncwindow()); }";
funcmap["scrollOk"] = "function(b) { return nc_scrollok(this.ncwindow(),(undefined===b)?true:b); }";
funcmap["touch"] = "function() { return nc_touchwin(this.ncwindow()); }";
@@ -643,22 +577,24 @@
// funcmap["redraw"] = "function() { return nc_wredrawwin(this.ncwindow()); }";
// funcmap["redrawLine"] = "function(start,count) { return nc_wredrawln(this.ncwindow(),start,count); }";
-
// PANEL-only functions:
- funcmap["bottom"] = "function() { return this.ncpanel() ? nc_bottom_panel(this.ncpanel()) : ncurses.ERR; }";
+ funcmap["bottom"] = "function() {return this.isPanel() ? nc_bottom_panel(this.ncpanel()) : ncurses.ERR;}";
funcmap["top"] = "function(){return this.isPanel() ? nc_top_panel(this.ncpanel()) : ncurses.ERR;}";
funcmap["show"] = "function(){return this.isPanel() ? nc_show_panel(this.ncpanel()) : ncurses.ERR;}";
funcmap["hide"] = "function(){return this.isPanel() ? nc_hide_panel(this.ncpanel()) : ncurses.ERR;}";
+ ape::scriptable proto( cx, ci.get_prototype(cx) );
for( StringMap::iterator it = funcmap.begin(); funcmap.end() != it; ++it )
{
if( ! proto.add_function( (*it).first, (*it).second ) )
{
- JS_ReportWarning( cx, "NCursesWindow: error adding prototype function '%s'.",
+ JS_ReportWarning( cx, "%s: error adding prototype function '%s'.",
+ NCursesWindow::strings::class_name,
(*it).first.c_str() );
}
}
- return NCursesPanel::init_context(cx,obj);
+ //return NCursesPanel::init_context(cx,obj);
+ return JS_TRUE;
}
@@ -666,5 +602,4 @@
} // namespace ape
#undef NCW_JS_NATIVE_MEMBER
-#undef NCP_JS_NATIVE_MEMBER
#undef JS_NATIVE_MEMBER
Modified: plugins/ncurses/NCursesWindow.hpp
===================================================================
--- plugins/ncurses/NCursesWindow.hpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/NCursesWindow.hpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -18,8 +18,11 @@
NCursesWindow provides a JS-bound OO interface for
ncurses-based windows. Its is designed for use with the
ape::Class mechanism (thus its odd implementation). This
- class should not be used from C++ code - it may not behave
- as expected (then again, it might).
+ class should not be instantiated from C++ code - it will
+ not behave as expected. If you MUST instantiate it from
+ C++, then use
+ NCursesWindow::ClassType().Implement().create_object(...)
+ so that it gets correctly registered with the VM.
Reminder: some functions have odd names
(e.g. wrap_addstr()) to avoid naming conflicts with ncurses
@@ -211,6 +214,11 @@
static char const * bogo;
};
+ /**
+ Convience typedef for use with the Class<>-related code.
+ */
+ typedef ::ape::Class<NCursesPanel::strings::class_name,NCursesPanel> ClassType;
+
private:
NCursesPanel & operator=(NCursesPanel const &); // not implemented
NCursesPanel(NCursesPanel const &); // not implemented
Modified: plugins/ncurses/binder.cpp
===================================================================
--- plugins/ncurses/binder.cpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/binder.cpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -3,6 +3,7 @@
#include <sf.net/ape/spiderape.hpp>
#include <sf.net/ape/binder.hpp> // a DIFFERENT binder.hpp, actually
#include <sf.net/ape/debuggering_macros.hpp> // CERR
+#include "NCursesWindow.hpp"
namespace ape {
namespace nc {
@@ -15,15 +16,6 @@
}
} // namespace Private
-
- int JWBinder::m_counter = 1000;
- // ^^^ we start with a "large" number because if we don't then
- // it is possible that integer arguments passed (incorrectly)
- // as WINDOW handles will be interpreted as a WINDOW (probably
- // a different one than intended). Yes, this did happen to
- // me. We choose an arbitrary integer which is expected to be
- // larger than screen coordinates.
-
void JWBinder::link_child( JWBinder * ch )
{
if( ! ch ) return;
@@ -32,7 +24,7 @@
void JWBinder::unlink_child( JWBinder * ch )
{
- this->m_ch.erase(std::find(this->m_ch.begin(),this->m_ch.end(),ch));
+ this->m_ch.remove(ch); //erase(std::find(this->m_ch.begin(),this->m_ch.end(),ch));
}
void JWBinder::init()
@@ -41,56 +33,41 @@
{
throw ::ape::exception( this->m_cx, "JWBinder(JSContext*[0x%x],WINDOW*[0x%x]) requires non-null pointers as arguments.", this->m_cx, this->m_win );
}
- // Avoid the possibility that our m_counter collides
- // with the global object's jsval, which is bound to stdscr:
- JWBinder * check = ::ape::bind::get_native<JWBinder>( this->m_cx, this->m_v );
- while( check )
- {
- this->m_v = int_to_jsval(++m_counter);
- check = ::ape::bind::get_native<JWBinder>( this->m_cx, this->m_v );
- }
+ this->m_v = ape::js_simple_object(this->m_cx).js_value();
keypad( this->m_win,true );
meta( this->m_win, true );
-// this->windowmap()[this->m_win] = this;
::ape::bind::bind_native<JWBinder>( this->m_cx, this->m_v, this );
::ape::bind::bind_native<WINDOW>( this->m_cx, this->m_v, this->m_win );
if( this->m_pnl )
{
::ape::bind::bind_native<PANEL>( this->m_cx, this->m_v, this->m_pnl );
}
+ //JWBinder::all_binders().push_back(this);
}
JWBinder::JWBinder(JSContext *cx, PANEL *p, jsval jv ) :
- m_cx(cx), m_win(panel_window(p)), m_pnl(p), m_v(jv ? jv : int_to_jsval(++m_counter)),
+ m_cx(cx), m_win(panel_window(p)), m_pnl(p), m_v(jv),
m_f(0), m_parent(0), m_ch()
{
this->init();
}
JWBinder::JWBinder(JSContext *cx, WINDOW * w, jsval jv ) :
- m_cx(cx), m_win(w), m_pnl(0), m_v(jv ? jv : int_to_jsval(++m_counter)),
+ m_cx(cx), m_win(w), m_pnl(0), m_v(jv),
m_f(0), m_parent(0), m_ch()
{
this->init();
}
-// JWBinder * JWBinder::binder_for( WINDOW * w )
+ jsval JWBinder::js_value() const { return this->m_v; }
+
+// unsigned long JWBinder::flags() const { return this->m_f; }
+// unsigned long JWBinder::flags( unsigned long f )
// {
-// WinMap::iterator it = windowmap().find(w);
-// return (windowmap().end() == it)
-// ? 0
-// : (*it).second;
+// unsigned long ret = f;
+// this->m_f = f;
+// return ret;
// }
- jsval JWBinder::js_value() const { return this->m_v; }
-
- unsigned long JWBinder::flags() const { return this->m_f; }
- unsigned long JWBinder::flags( unsigned long f )
- {
- unsigned long ret = f;
- this->m_f = f;
- return ret;
- }
-
JSContext * JWBinder::js_context() { return this->m_cx; }
WINDOW * JWBinder::window() { return this->m_win; }
@@ -128,69 +105,130 @@
JWBinder::~JWBinder()
{
- if(0) CERR << "Deleting WINDOW " << std::hex << this->window()
- << ", JSObject " << std::hex << jsval_to_cstring( this->js_context(), this->js_value() )
- << '\n';
+ //JWBinder::all_binders().remove(this);
+ this->parent( 0 );
+ ::ape::bind::unbind_native<JWBinder>( this->m_cx, this->m_v, this );
+ ::ape::bind::unbind_native<WINDOW>( this->m_cx, this->m_v, this->m_win );
+ if( 0 )
+ {
+ void * pt = this->m_pnl ? (void*)this->m_pnl : (void*)this->m_win;
+ CERR << "Deleting "<<
+ (this->m_pnl ? "PANEL " : "WINDOW ") << std::hex << pt
+ << " with"<<(this->m_parent?"out":" ")<<" parent"
+ << ", JSObject " << std::hex << jsval_to_cstring( this->js_context(), this->js_value() )
+ << '\n';
+ }
- // Kludge: remove stream-to-window redirects:
- using namespace Private;
- WindowStreamMap & str = captured_streams();
- typedef WindowStreamMap::iterator WIT;
- WIT stit = str.lower_bound(this->m_win);
- WIT head = stit;
- WIT stet = str.upper_bound(this->m_win);
- for( ; stet != stit; ++stit )
{
- delete (*stit).second;
- //str.erase(stit);
+ // Kludge: remove stream-to-window redirects:
+ using namespace Private;
+ WindowStreamMap & str = captured_streams();
+ typedef WindowStreamMap::iterator WIT;
+ WIT stit = str.lower_bound(this->m_win);
+ WIT head = stit;
+ WIT stet = str.upper_bound(this->m_win);
+ for( ; stet != stit; ++stit )
+ {
+ delete (*stit).second;
+ //str.erase(stit);
+ }
+ str.erase( head, stet );
+ // /KLUDGE
}
- str.erase( head, stet );
- // /KLUDGE
- // KLUDGE #2: remove data bound via nc_set_userdata()
- typedef ::ape::jsval_t JT;
- JT * j = ::ape::bind::get_native<JT>( this->js_context(), this->js_value() );
- if( j )
{
- ::ape::bind::unbind_native<JT>( this->js_context(), this->js_value(), j );
- delete j;
- j = 0;
+ // KLUDGE #2: remove data bound via nc_set_userdata()
+ typedef ::ape::jsval_t JT;
+ JT * j = ::ape::bind::get_native<JT>( this->js_context(), this->js_value() );
+ if( j )
+ {
+ ::ape::bind::unbind_native<JT>( this->js_context(), this->js_value(), j );
+ delete j;
+ j = 0;
+ }
+ // /KLUDGE #2
}
- // /KLUDGE #2
-
- this->parent( 0 );
BinderList lcp(this->m_ch); // need a copy to avoid modifying original while we're deleting.
BinderList::iterator it = lcp.begin();
- BinderList::iterator et = lcp.end();
- for( ; et != it; ++it )
+ for( ; lcp.end() != it; ++it )
{
- if(0) CERR << "Deleting child WINDOW " << std::hex << (*it)->window()
+ if(1) CERR << "Deleting child WINDOW " << std::hex << (*it)->window()
<< ", JSObject " << std::hex << jsval_to_cstring( this->js_context(), (*it)->js_value() )
<< '\n';
delete *it;
}
- ::ape::bind::unbind_native<JWBinder>( this->m_cx, this->m_v, this );
+ if( stdscr && this->m_win )
+ {
+ if( this->m_win != stdscr )
+ {
+ werase(this->m_win);
+ delwin( this->m_win );
+ }
+ }
this->free_panel();
- ::ape::bind::unbind_native<WINDOW>( this->m_cx, this->m_v, this->m_win );
- if( this->m_win )
+ }
+
+ void JWBinder::endwin_cleanup()
+ {
+ CERR << "JWBinder::endwin_cleanup()...\n";
+
{
- if( this->m_win == stdscr )
+ // Kludge: remove stream-to-window redirects:
+ using namespace Private;
+ WindowStreamMap str( captured_streams() );
+ captured_streams().clear();
+ typedef WindowStreamMap::iterator WIT;
+ WIT stit = str.begin();
+ WIT head = stit;
+ for( ; str.end() != stit; ++stit )
{
- endwin();
- stdscr = 0;
+ delete (*stit).second;
+ //str.erase(stit);
}
- else
+ // /KLUDGE
+ }
+#if 0
+ /**
+ We walk the list of all binders and make a deletion
+ queue for items WITHOUT parents (those with parents
+ will be deleted by their parents). We use
+ reverse_iterators because stdscr will be the first
+ binder and we need it to be alive the whole time to
+ avoid a segfault later on.
+ */
+ BinderList them;
+ BinderList & bl = JWBinder::all_binders();
+ BinderList::reverse_iterator rit = bl.rbegin();
+ JWBinder * cur = 0;
+ for( ; bl.rend() != rit; ++rit )
+ {
+ cur = *rit;
+ if( cur && (!cur->parent()) )
{
- werase(this->m_win);
- delwin( this->m_win );
+ them.push_back(cur);
+ // We only erase non-parented items
+ // because items with parents will be
+ // deleted by the parent.
}
}
+ BinderList::iterator it = them.begin();
+ for( ; them.end() != it; ++it )
+ {
+ delete *it;
+ }
+#endif
}
+ JWBinder::BinderList & JWBinder::all_binders()
+ {
+ static BinderList bob;
+ return bob;
+ }
+
int JWBinder::free_panel()
{
- if( ! this->m_pnl ) return ERR;
+ if( !stdscr || !this->m_pnl ) return ERR;
::ape::bind::unbind_native<PANEL>( this->m_cx, this->m_v, this->m_pnl );
int ret = del_panel( this->m_pnl );
this->m_pnl = 0;
@@ -207,8 +245,8 @@
JWBinder * b = get_binder(cx,jv);
if( ! b )
{
- throw ::ape::exception( cx, "JWBinder::assert_binder(0x%x,jsval) failed. msg=[%s]",
- cx, (msg ? msg : "none") );
+ throw ::ape::exception( cx, "JWBinder::assert_binder(0x%x,js=%s) failed. msg=[%s]",
+ cx, jsval_to_cstring(cx,jv), (msg ? msg : "none") );
}
return b;
}
@@ -219,12 +257,13 @@
return b ? b->window() : 0;
}
- WINDOW * JWBinder::assert_window( JSContext * cx, jsval jv )
+ WINDOW * JWBinder::assert_window( JSContext * cx, jsval jv, char const * msg )
{
WINDOW * w = get_window(cx,jv);
if( ! w )
{
- throw ::ape::exception( cx, "JWBinder::assert_window(cx=%x,jv=%s) failed", cx, jsval_to_cstring(cx,jv) );
+ throw ::ape::exception( cx, "JWBinder::assert_window(cx=%x,jv=%s) failed. msg=[%s]",
+ cx, jsval_to_cstring(cx,jv), (msg ? msg : "none") );
}
return w;
}
Modified: plugins/ncurses/binder.hpp
===================================================================
--- plugins/ncurses/binder.hpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/binder.hpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -15,19 +15,17 @@
INTERNAL type for binding WINDOWs to JSObjects.
The internals of the ncurses/JS bindings use this,
but you should not.
+
+ This type is used extensively by the code in ncwrapper.cpp
+ and panels.cpp, but no other code should try to make use of
+ it.
*/
class JWBinder
{
public:
typedef std::list<JWBinder *> BinderList;
- enum Flags {
- NoFlags = 0x00000000,
- StdScreen = 0x1000000
- };
private:
- static int m_counter;
JSContext * m_cx;
- //JSObject * m_obj;
WINDOW * m_win;
PANEL * m_pnl;
jsval m_v;
@@ -35,13 +33,9 @@
JWBinder * m_parent;
BinderList m_ch;
void init();
- typedef std::map<WINDOW *,JWBinder *> WinMap;
- static WinMap & windowmap()
- {
- static WinMap m;
- return m;
- }
+ static BinderList & all_binders();
+
/** Adds ch to this object's children(). */
void link_child( JWBinder * ch );
@@ -55,16 +49,19 @@
this->js_value().
*/
JWBinder(JSContext *cx, WINDOW * w, jsval jv = 0 );
+ /**
+ Binds p to jv. If jv == 0 then an arbitrary jsval
+ is generated, which can be fetched via
+ this->js_value().
+ */
JWBinder(JSContext *cx, PANEL *p, jsval jv = 0 );
-// /** Returns the binder associated with w. */
-// static JWBinder * binder_for( WINDOW * w );
~JWBinder();
/** Returns the jsval bound to this->window(). */
jsval js_value() const;
- /** Returns internal flags. */
- unsigned long flags() const;
- /** Sets internal flags, returning old state. */
- unsigned long flags( unsigned long f );
+// /** Returns internal flags. */
+// unsigned long flags() const;
+// /** Sets internal flags, returning old state. */
+// unsigned long flags( unsigned long f );
/** Returns this object's JSContext. */
JSContext * js_context();
/** Returns this object's bound WINDOW. */
@@ -95,18 +92,27 @@
/** Returns binder associated with cx/jv. */
static JWBinder * get_binder( JSContext * cx, jsval jv );
+
/** Like get_binder(), but throws if no binding is found. */
static JWBinder * assert_binder( JSContext * cx, jsval jv, char const * msg = 0 );
+
/** Returns WINDOW associated with cx/jv. */
static WINDOW * get_window( JSContext * cx, jsval jv );
+
/** Like get_window(), but throws if no binding is found. */
- static WINDOW * assert_window( JSContext * cx, jsval jv );
+ static WINDOW * assert_window( JSContext * cx, jsval jv, char const * msg = 0 );
/** Returns PANEL associated with cx/jv. */
static PANEL * get_panel( JSContext * cx, jsval jv );
+
/** Like get_panel(), but throws if no binding is found. */
static PANEL * assert_panel( JSContext * cx, jsval jv );
+ /** Only to be called by nc_endwin()! Destroys all WINDOWs/PANELs/PADs
+ allocated by the framework.
+ */
+ static void endwin_cleanup();
+
};
Modified: plugins/ncurses/ncwrapper.cpp
===================================================================
--- plugins/ncurses/ncwrapper.cpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/ncwrapper.cpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -77,6 +77,31 @@
} \
ASSERTNC(FUNCNAME,CX)
+// WINDOW_OR_NCERR() checks an arg to ensure it's a WINDOW, else it sets rval to NCJS_ERR and returns.
+#define WINDOW_OR_NCERR(JSARG,VARNAME) \
+ WINDOW * VARNAME = JWBinder::get_window(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = NCJS_ERR; \
+ return JS_TRUE; \
+ }
+
+// WINDOW_OR_NCERR() checks an arg to ensure it's a WINDOW, else it sets rval to JSVAL_NULL and returns.
+#define WINDOW_OR_JSNULL(JSARG,VARNAME) \
+ WINDOW * VARNAME = JWBinder::get_window(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = JSVAL_NULL; \
+ return JS_TRUE; \
+ }
+
+
+// WINDOW_OR_JSTHROW() checks an arg to ensure it's a WINDOW, else it sets a pending exception.
+#define WINDOW_OR_JSTHROW(FUNCNAME,JSARG,VARNAME) \
+ WINDOW * VARNAME = JWBinder::get_window(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = NCJS_ERR; \
+ return ape::set_pending_exception(cx,"%s() requires a WINDOW argument!",FUNCNAME); \
+ }
+
int screen_width()
{
return stdscr ? stdscr->_maxx+1 : 0;
@@ -86,10 +111,43 @@
return stdscr ? stdscr->_maxy+1 : 0;
}
- static const jsval NCJS_ERR = int_to_jsval(-1);
- static const jsval NCJS_OK = int_to_jsval(0);
+// typedef std::list<JWBinder *> BinderList;
+// BinderList & jwbinders()
+// {
+// static BinderList bob;
+// return bob;
+// }
+// /**
+// Internal use only. Only add top-level (non-parented)
+// binders here.
+// */
+// JWBinder * add_binder( JWBinder * b )
+// {
+// jwbinders().push_back(b);
+// return b;
+// }
+
+// void cleanup_binder( JWBinder * b )
+// {
+// if( ! b ) return;
+// jwbinders().remove(b);
+// delete b;
+// }
+
+// void cleanup_binders()
+// {
+// BinderList cp( jwbinders() );
+// BinderList::reverse_iterator rit = cp.begin();
+// for( ; rit != cp.rend(); ++rit )
+// {
+// cleanup_binder( *rit );
+// }
+// }
+
+
+
/**
Weird behaviour vis-a-vis ncurses' chtype
and to_jsval():
@@ -166,7 +224,7 @@
JSObject * obj = JS_GetGlobalObject( context );
binders()[rp] = new JWBinder( context, w );
jsval argv[] = {
- ::ape::to_jsval<WINDOW*>( context, w ),
+ WINDOW_to_jsval( context, w ),
int_to_jsval(l)
};
jsval rval;
@@ -242,7 +300,8 @@
scriptable nc( cx, jsval_to_object( jv ) );
std::ostringstream os;
- os
+ os << "this['ERR'] = " << ERR << ';'
+ << "this['OK'] = "<<OK<<';'
<< "this['TAB'] = 9;\n"
<< "this['\\t'] = 'TAB';\n"
<< "this[9] = 'TAB'; // key conflicts with ASCII 59/char '9'!\n"
@@ -559,6 +618,7 @@
{"nc_wmaxy", nc_wmaxy, 0},
{"nc_wmove", nc_wmove, 0},
{"nc_wnoutrefresh", nc_wnoutrefresh, 0},
+ {"nc_wprint", nc_wprint, 0},
{"nc_wredrawln", nc_wredrawln, 0},
{"nc_wrefresh", nc_wrefresh, 0},
{"nc_wresize", nc_wresize, 0},
@@ -679,17 +739,22 @@
return JS_TRUE;
}
-
JS_FUNC(nc_initscr)
{
JSObject * globobj = JS_GetGlobalObject(cx);
- jsval globv = OBJECT_TO_JSVAL(globobj);
- JWBinder * bin = JWBinder::get_binder( cx, globv ); //OBJECT_TO_JSVAL(obj) );
- if( bin )
- { // already initialized.
- *rval = bin->js_value();
+// jsval globv = OBJECT_TO_JSVAL(globobj);
+// JWBinder * bin = JWBinder::get_binder( cx, globv ); //OBJECT_TO_JSVAL(obj) );
+// if( bin )
+// { // already initialized.
+// *rval = bin->js_value();
+// return JS_TRUE;
+// }
+ jsval jvscr = ape::bind::get_jsval<WINDOW*>( cx, stdscr );
+ if( JSVAL_VOID != jvscr )
+ {
+ *rval = jvscr;
return JS_TRUE;
- }
+ }
WINDOW * std = initscr();
if( ! std )
{
@@ -714,7 +779,8 @@
::start_color();
install_full_palette();
}
- JWBinder * b = new JWBinder( cx, std, globv );
+ //JWBinder * b = new JWBinder( cx, std, globv );
+ JWBinder * b = new JWBinder( cx, std );
*rval = b->js_value();
JS_DefineProperty(cx, globobj, "stdscr", *rval, NULL, NULL, 0);
return JS_TRUE;
@@ -727,19 +793,17 @@
*rval = NCJS_ERR;
return JS_TRUE;
}
- JWBinder * b = JWBinder::get_binder(cx,OBJECT_TO_JSVAL(obj));
- if( ! b )
- {
- *rval = NCJS_ERR;
- return JS_TRUE; // assume endwin() already called.
- }
- ripoff::reset();
+ ripoff::reset(); // must come before JWBinder::endwin_cleanup()!!!
+ //CERR << "Freeing stdscr property...\n";
+ JS_DeleteProperty(cx, obj, "stdscr");
+ //CERR << "Freed stdscr property.\n";
+ CERR << "FIXME: nc_endwin cleanup: need to nuke all window resources!\n";
+ JWBinder::endwin_cleanup();
+ //CERR << "DONE: endwin_cleanup()!\n";
int rc = endwin();
- JS_DeleteProperty(cx, obj, "stdscr");
- if( ! rc )
+ if( 0 != rc )
{
stdscr = 0;
- delete b;
}
*rval = int_to_jsval( cx, rc );
return JS_TRUE;
@@ -882,24 +946,14 @@
JS_FUNC(nc_waddvstr)
{
ASSERTARGC("nc_waddvstr",cx,(2==argc));
- WINDOW * w = JWBinder::get_window( cx, argv[0] );
- if( ! w )
- {
- *rval = NCJS_ERR;
- return JS_TRUE;
- }
+ WINDOW_OR_NCERR(argv[0],w);
std::string s( jsval_to_std_string(cx, argv[1] ) );
return nc_addvstr_impl( w, getcury(w), getcurx(w), s, -1, rval );
}
JS_FUNC(nc_waddvnstr)
{
ASSERTARGC("nc_waddvnstr",cx,(3==argc));
- WINDOW * w = JWBinder::get_window( cx, *(argv++) );
- if( ! w )
- {
- *rval = NCJS_ERR;
- return JS_TRUE;
- }
+ WINDOW_OR_NCERR(*(argv++),w);
std::string s = jsval_to_std_string( cx, *(argv++) );
int n = jsval_to_int( *(argv++) );
return nc_addvstr_impl( w, getcury(w), getcurx(w), s, n, rval );
@@ -908,12 +962,7 @@
JS_FUNC(nc_mvwaddvstr)
{
ASSERTARGC("nc_mvwaddvstr",cx,(4==argc));
- WINDOW * w = JWBinder::get_window( cx, *(argv++) );
- if( ! w )
- {
- *rval = NCJS_ERR;
- return JS_TRUE;
- }
+ WINDOW_OR_NCERR(*(argv++),w);
int y = jsval_to_int( *(argv++) );
int x = jsval_to_int( *(argv++) );
std::string s( jsval_to_std_string(cx, *(argv++) ) );
@@ -923,12 +972,7 @@
JS_FUNC(nc_mvwaddvnstr)
{
ASSERTARGC("nc_mvwaddvnstr",cx,(5==argc));
- WINDOW * w = JWBinder::get_window( cx, *(argv++) );
- if( ! w )
- {
- *rval = NCJS_ERR;
- return JS_TRUE;
- }
+ WINDOW_OR_NCERR(*(argv++),w);
int y = jsval_to_int( *(argv++) );
int x = jsval_to_int( *(argv++) );
std::string s( jsval_to_std_string(cx, *(argv++) ) );
@@ -961,7 +1005,7 @@
JS_FUNC(nc_wbkgd)
{
ASSERTARGC("nc_wbkgd",cx,(2==argc));
- WINDOW * w = jsval_to<WINDOW>(cx,*(argv++));
+ WINDOW * w = jsval_to_WINDOW(cx,*(argv++));
if( ! w )
{
JS_ReportWarning(cx,"nc_wbkgd(WINDOW,int): first arg must be a WINDOW handle.");
@@ -973,6 +1017,33 @@
return JS_TRUE;
}
+ JS_FUNC(nc_wprint)
+ {
+ ASSERTARGC("nc_wbkgd",cx,(0<argc));
+ WINDOW * w = jsval_to_WINDOW(cx,argv[0]);
+ if( ! w )
+ {
+ JS_ReportWarning(cx,"nc_print(WINDOW,...): first arg must be a WINDOW handle.");
+ *rval = NCJS_ERR;
+ return JS_TRUE;
+ }
+ for( uint32 i = 1; i < argc; ++i )
+ {
+ char const * s = jsval_to_cstring(cx,argv[i]);
+ ::waddstr( w, s );
+ if( i < (argc-1) )
+ {
+ waddch(w,' ');
+ }
+ }
+ waddch(w,'\n');
+ // We do the following in case w is associated with a panel, because
+ // nc_wrefresh() handles that case:
+ jsval av[1] = { argv[0] };
+ nc_wrefresh(cx,obj,1,av,rval);
+ *rval = JSVAL_NULL;
+ return JS_TRUE;
+ }
JS_FUNC(nc_wrefresh)
@@ -988,7 +1059,8 @@
bin = JWBinder::get_binder(cx,argv[i]);
if( ! bin )
{
- JS_ReportWarning(cx,"nc_wrefresh(): failed to get binder for arg #%d: %s",i,jsval_to_cstring(cx,argv[i]));
+ //JS_ReportWarning(cx,"nc_wrefresh(): failed to get binder for arg #%d: %s",i,jsval_to_cstring(cx,argv[i]));
+ return ape::set_pending_exception(cx,"nc_wrefresh(): failed to get binder for arg #%d: %s",i,jsval_to_cstring(cx,argv[i]));
return JS_TRUE;
}
w = bin->window();
@@ -1000,8 +1072,10 @@
}
else if( bin->panel() )
{
- *rval = int_to_jsval( wnoutrefresh(w) );
+ //*rval = int_to_jsval( wnoutrefresh(w) );
+ touchwin(w);
update_panels();
+ *rval = int_to_jsval( doupdate() );
return JS_TRUE;
}
else if( ERR == wrefresh(w) )
@@ -1320,7 +1394,7 @@
JS_FUNC(nc_getpary)
{
ASSERTARGC("nc_getpary",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getpary()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = -1;
int x = -1;
getparyx( w, y, x );
@@ -1331,7 +1405,7 @@
JS_FUNC(nc_getparx)
{
ASSERTARGC("nc_getparx",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getparx()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = -1;
int x = -1;
getparyx( w, y, x );
@@ -1343,7 +1417,7 @@
JS_FUNC(nc_getparyx)
{
ASSERTARGC("nc_getparyx",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getparyx()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = -1;
int x = -1;
getparyx( w, y, x );
@@ -1357,7 +1431,7 @@
JS_FUNC(nc_getcuryx)
{
ASSERTARGC("nc_getcuryx",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getcuryx()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = getcury( w );
int x = getcurx( w );
::ape::js_simple_object quasi( cx );
@@ -1370,7 +1444,7 @@
JS_FUNC(nc_getbegyx)
{
ASSERTARGC("nc_getbegyx",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getbegyx()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = -1;
int x = -1;
getbegyx( w, y, x );
@@ -1384,7 +1458,7 @@
JS_FUNC(nc_getmaxyx)
{
ASSERTARGC("nc_getmaxyx",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv), "nc_getmaxyx()" );
+ WINDOW_OR_JSNULL(*argv,w);
int y = -1;
int x = -1;
getmaxyx( w, y, x );
@@ -1486,14 +1560,7 @@
{
ASSERTARGC("nc_is_pad",cx,(1==argc));
WINDOW * w = JWBinder::get_window( cx, *argv );
- if( ! w )
- {
- *rval = bool_to_jsval( false );
- }
- else
- {
- *rval = bool_to_jsval( WIN_IS_PAD(w) );
- }
+ *rval = bool_to_jsval( w ? (WIN_IS_PAD(w)) : false );
return JS_TRUE;
}
@@ -1522,7 +1589,7 @@
nc_capture_stream( std::ostream & os, JSContext *cx, JSObject *obj, uint32 argc, jsval * argv, jsval * rval )
{
ASSERTARGC("nc_capture_cout/cerr",cx,((argc>0) && (argc<3)));
- WINDOW * w = JWBinder::assert_window(cx,argv[0], "nc_capture_stream()" );
+ WINDOW_OR_JSTHROW("nc_capture_stream",argv[0],w);
long attr = (argc>1) ? jsval_to_int(argv[1]) : 0;
Private::captured_streams().insert( ::std::make_pair( w, new nc_window_streambuf(w,os,attr) ) );
*rval = JSVAL_VOID;
@@ -1541,8 +1608,8 @@
JS_FUNC(nc_capture_end)
{
- ASSERTARGC("nc_end_capture_cout/cerr",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window(cx,argv[0], "nc_capture_end()");
+ ASSERTARGC("nc_capture_end",cx,(1==argc));
+ WINDOW_OR_JSTHROW("nc_capture_end",argv[0],w);
using namespace Private;
WindowStreamMap & str = captured_streams();
typedef WindowStreamMap::iterator WIT;
@@ -1638,7 +1705,7 @@
JS_FUNC(nc_box)
{
ASSERTARGC("nc_box",cx,((argc>=1) && (argc<=3)));
- WINDOW * w = JWBinder::assert_window(cx,*argv,"nc_box()");
+ WINDOW_OR_NCERR(*argv,w);
chtype vch = (argc>1) ? jsval_to_chtype(cx,argv[1]) : 0;
chtype hch = (argc>2) ? jsval_to_chtype(cx,argv[2]) : 0;
*rval = int_to_jsval( cx, box( w, vch, hch ) );
@@ -1924,7 +1991,7 @@
JS_FUNC(nc_getcury)
{
ASSERTARGC("nc_getcury",cx,(1==argc));
- WINDOW * w = JWBinder::get_window(cx,*argv);
+ WINDOW_OR_NCERR(argv[0],w);
*rval = int_to_jsval( w ? getcury(w) : -1 );
return JS_TRUE;
}
@@ -1932,7 +1999,7 @@
JS_FUNC(nc_getcurx)
{
ASSERTARGC("nc_getcurx",cx,(1==argc));
- WINDOW * w = JWBinder::get_window(cx,*argv);
+ WINDOW_OR_NCERR(argv[0],w);
*rval = int_to_jsval( w ? getcurx(w) : -1 );
return JS_TRUE;
}
@@ -1952,7 +2019,8 @@
JS_FUNC(nc_winch)
{
ASSERTARGC("nc_winch",cx,(1==argc));
- *rval = to_jsval<chtype>( cx, winch( JWBinder::assert_window(cx,*argv,"nc_winch()") ) );
+ WINDOW_OR_NCERR(*argv,w);
+ *rval = to_jsval<chtype>( cx, winch( w ) );
return JS_TRUE;
}
@@ -1973,7 +2041,7 @@
JS_FUNC(nc_mvwchgat)
{
ASSERTARGC("nc_mvwchgat",cx,(6==argc));
- WINDOW * w = JWBinder::assert_window( cx, *(argv++),"nc_mvwchgat()" );
+ WINDOW_OR_NCERR(*(argv++),w);
int y = jsval_to_int(*(argv++));
int x = jsval_to_int(*(argv++));
int n = jsval_to_int(*(argv++));
@@ -1993,6 +2061,11 @@
#else
::ape::argv_wrapper av(cx,argc,argv);
WINDOW * w = av++.to<WINDOW *>();
+ if( ! w )
+ {
+ *rval = NCJS_ERR;
+ return JS_TRUE;
+ }
int n = av++.to<int>();
int attr = av++.to<int>();
short color = av++.to<short>();
Modified: plugins/ncurses/ncwrapper.hpp
===================================================================
--- plugins/ncurses/ncwrapper.hpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/ncwrapper.hpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -13,6 +13,7 @@
#include <sf.net/ape/conversion.hpp>
extern "C" {
# include <ncurses.h>
+# include <panel.h>
}
#include <map>
namespace ape {
@@ -66,15 +67,20 @@
*/
typedef long chtype; // from ncurses
+ static const jsval NCJS_ERR = ape::int_to_jsval(-1);
+ static const jsval NCJS_OK = ape::int_to_jsval(0);
+
+
static const ape::to_jsval_f<chtype> chtype_to_jsval = ape::to_jsval_f<chtype>();
static const ape::jsval_to_f<chtype> jsval_to_chtype = ape::jsval_to_f<chtype>();
+ static const ape::to_jsval_f<WINDOW*> WINDOW_to_jsval = ape::to_jsval_f<WINDOW*>();
+ static const ape::jsval_to_f<WINDOW*> jsval_to_WINDOW = ape::jsval_to_f<WINDOW*>();
+ static const ape::to_jsval_f<PANEL*> PANEL_to_jsval = ape::to_jsval_f<PANEL*>();
+ static const ape::jsval_to_f<PANEL*> jsval_to_PANEL = ape::jsval_to_f<PANEL*>();
- static const ape::to_jsval_f<WINDOW> WINDOW_to_jsval = ape::to_jsval_f<WINDOW>();
- static const ape::jsval_to_f<WINDOW> jsval_to_WINDOW = ape::jsval_to_f<WINDOW>();
-
// NC_WRAPPER_FUNC() is only to simplify browsing of the bound
// functions list, by (a) removing all of the syntactic noise
// brought on by the function signature and (b) making the
@@ -207,7 +213,12 @@
NC_WRAPPER_FUNC(wmove);
NC_WRAPPER_FUNC(redrawwin);
NC_WRAPPER_FUNC(wredrawln);
- /** Accepts 1 or more WINDOW arguments. */
+ /** Accepts 1 or more WINDOW or PANEL arguments. For PANELs
+ it does the update technique appropriate for PANELs (or at
+ least it does what *it thinks* is appropriate for PANELs).
+ If you pass it a PAD then it will silently fail without
+ crashing.
+ */
NC_WRAPPER_FUNC(wrefresh);
/** Read the native docs before using this. It's not
quite as useful as it sounds, due to curses' lack of
@@ -397,7 +408,8 @@
It might be interesting to know that nc_delwin() also works
on PANEL handles, whereas the native delwin() should not be
- used on panels.
+ used on panels. The difference with nc_delwin() is that it will
+ delete the PANEL *and* the associated WINDOW.
*/
NC_WRAPPER_FUNC(del_panel);
NC_WRAPPER_FUNC(hide_panel);
@@ -625,7 +637,21 @@
*/
NC_WRAPPER_FUNC(wgeometry);
+ /**
+ Works similarly to print(), but assumes that its first
+ argument is a WINDOW. The remaining args are
+ space-separated and added to the WINDOW using addstr() and
+ a trailing '\n' is then added. Unlike addstr(), this
+ function DOES call refresh() when it is done (this
+ simplifies its usage). If you are operating on PADs then
+ nc_addstr() is recommended, because refresh() is not legal
+ for PADs.
+ JS usage: nc_wprint(myWin,...);
+ */
+ NC_WRAPPER_FUNC(wprint);
+
+
#undef NC_WRAPPER_FUNC
} } // namespace ape::nc
Modified: plugins/ncurses/panel.cpp
===================================================================
--- plugins/ncurses/panel.cpp 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/panel.cpp 2007-09-28 03:44:42 UTC (rev 42)
@@ -4,8 +4,6 @@
#include <sf.net/ape/spiderape.hpp>
#include <sf.net/ape/debuggering_macros.hpp> // CERR
#include <sf.net/ape/fwd_to_func.hpp>
-#include <ncurses.h>
-#include <panel.h>
#include "binder.hpp"
#include "ncwrapper.hpp"
namespace ape {
@@ -30,6 +28,31 @@
} \
ASSERTNC(FUNCNAME,CX)
+// WINDOW_OR_JSTHROW() checks an arg to ensure it's a WINDOW, else it sets a pending exception.
+#define WINDOW_OR_JSTHROW(FUNCNAME,JSARG,VARNAME) \
+ WINDOW * VARNAME = JWBinder::get_window(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = NCJS_ERR; \
+ return ape::set_pending_exception(cx,"%s() requires a WINDOW argument!",FUNCNAME); \
+ }
+
+// PANEL_OR_NCERR() checks an arg to ensure it's a PANEL, else it sets rval to NCJS_ERR and returns.
+#define PANEL_OR_NCERR(JSARG,VARNAME) \
+ PANEL * VARNAME = JWBinder::get_panel(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = NCJS_ERR; \
+ return JS_TRUE; \
+ }
+
+// PANEL_OR_JSTHROW() checks an arg to ensure it's a PANEL, else it sets a pending exception.
+#define PANEL_OR_JSTHROW(FUNCNAME,JSARG,VARNAME) \
+ PANEL * VARNAME = JWBinder::get_panel(cx,JSARG); \
+ if( ! VARNAME ) { \
+ *rval = NCJS_ERR; \
+ return ape::set_pending_exception(cx,"%s() requires a PANEL argument!",FUNCNAME); \
+ }
+
+
JS_FUNC(nc_bottom_panel)
{
ASSERTARGC("nc_bottom_panel",cx,(1==argc));
@@ -40,10 +63,14 @@
JS_FUNC(nc_del_panel)
{
ASSERTARGC("nc_del_panel",cx,(1==argc));
- JWBinder * b = JWBinder::assert_binder( cx, *argv );
- *rval = bool_to_jsval( b->free_panel() );
- //return nc_delwin( cx, obj, argc, argv, rval );
- // ^^^ delwin() works identically to del_panel() here because
+ JWBinder * b = JWBinder::get_binder( cx, *argv );
+ if( ! b )
+ {
+ *rval = ape::int_to_jsval(-1);
+ return JSVAL_TRUE;
+ }
+ *rval = ape::int_to_jsval( b->free_panel() );
+ // ^^^ nc_delwin() works like del_panel() here because
// of the way our JWBinder cleanup works.
return JS_TRUE;
}
@@ -71,11 +98,11 @@
JS_FUNC(nc_new_panel)
{
ASSERTARGC("nc_new_panel",cx,(1==argc));
- WINDOW * w = JWBinder::assert_window( cx, *argv );
+ WINDOW_OR_JSTHROW("nc_new_panel",*argv,w);
PANEL * p = new_panel(w);
if( ! p )
{
- JS_ReportWarning(cx,"nc_new_panel(): new_panel() failed!");
+ //JS_ReportWarning(cx,"nc_new_panel(): new_panel() failed!");
*rval = JSVAL_NULL;
return JS_TRUE;
}
@@ -86,43 +113,41 @@
JS_FUNC(nc_panel_above)
{
ASSERTARGC("nc_panel_above",cx,(1==argc));
- *rval = to_jsval<PANEL*>( cx, ::ape::fwd_to_func1<PANEL*,const PANEL *>( panel_above, cx, obj, argc, argv ) );
+ *rval = PANEL_to_jsval( cx, ::ape::fwd_to_func1<PANEL*,const PANEL *>( panel_above, cx, obj, argc, argv ) );
return JS_TRUE;
}
JS_FUNC(nc_panel_below)
{
ASSERTARGC("nc_panel_below",cx,(1==argc));
- *rval = to_jsval<PANEL*>( cx, ::ape::fwd_to_func1<PANEL*,const PANEL *>( panel_below, cx, obj, argc, argv ) );
+ *rval = PANEL_to_jsval( cx, ::ape::fwd_to_func1<PANEL*,const PANEL *>( panel_below, cx, obj, argc, argv ) );
return JS_TRUE;
}
JS_FUNC(nc_panel_hidden)
{
ASSERTARGC("nc_panel_hidden",cx,(1==argc));
- PANEL * p = JWBinder::get_panel( cx, *argv );
- if( ! p )
- {
- JS_ReportWarning( cx, "nc_panel_hidden() expects a single PANEL argument." );
- *rval = int_to_jsval(-1);
- return JS_TRUE;
- }
+ PANEL_OR_NCERR(argv[0],p);
*rval = int_to_jsval( panel_hidden(p) );
- //::ape::int_to_jsval(::ape::fwd_to_func1<int,const PANEL *>( panel_hidden, cx, obj, argc, argv ) );
return JS_TRUE;
}
JS_FUNC(nc_panel_window)
{
ASSERTARGC("nc_panel_window",cx,(1==argc));
- *rval = to_jsval<WINDOW*>( cx, ::ape::fwd_to_func1<WINDOW*,const PANEL *>( panel_window, cx, obj, argc, argv ) );
+ *rval = WINDOW_to_jsval( cx, ::ape::fwd_to_func1<WINDOW*,const PANEL *>( panel_window, cx, obj, argc, argv ) );
return JS_TRUE;
}
JS_FUNC(nc_set_userdata)
{
ASSERTARGC("nc_set_userdata",cx,(2==argc));
- JWBinder::assert_binder( cx, *argv );
+ JWBinder * b = JWBinder::get_binder( cx, *argv );
// ^^^ we only really require this so we know we can clean up
// all entries via that JWBinder::~JWBinder().
+ if( ! b )
+ {
+ *rval = JSVAL_VOID;
+ return JS_TRUE;
+ }
typedef ::ape::jsval_t JT;
JT * j = ::ape::bind::get_native< JT >( cx, argv[0] );
if( j )
@@ -138,7 +163,7 @@
else
{
JT * j = new JT(argv[1]); // We must clean these up in ~JWBinder
- ::ape::bind::bind_native<JT>( cx, argv[0], j );
+ ::ape::bind::bind_native<JT>( cx, b->js_value(), j );
*rval = *j;
}
return JS_TRUE;
@@ -204,7 +229,7 @@
ASSERTARGC("nc_replace_panel",cx,(2==argc));
CHECKBINDER("nc_replace_panel",argv[0]);
PANEL * p = bin->panel();
- WINDOW * w = jsval_to<WINDOW>( cx, argv[1] );
+ WINDOW * w = jsval_to_WINDOW( cx, argv[1] );
if( (! p) || (!w) )
{
JS_ReportWarning(cx,"nc_replace_panel() requires arguments (PANEL,WINDOW).");
Modified: plugins/ncurses/plugin.make
===================================================================
--- plugins/ncurses/plugin.make 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/plugin.make 2007-09-28 03:44:42 UTC (rev 42)
@@ -40,7 +40,7 @@
PACKAGE_VERSION = $(APE.PLUGIN.VERSION)
prefix = $(APE.CONFIG.PREFIX)
# CPPFLAGS +=
-CXXFLAGS += -Wall -fPIC -pipe
+CXXFLAGS += -Wall -fPIC -pipe -g
LDFLAGS += -fPIC -pipe
#
########################################################################
Modified: plugins/ncurses/scripts/JCWindow.inc.js
===================================================================
--- plugins/ncurses/scripts/JCWindow.inc.js 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/scripts/JCWindow.inc.js 2007-09-28 03:44:42 UTC (rev 42)
@@ -4,7 +4,7 @@
if( ! is_defined( 'ncurses' ) )
{
- var dll = 'nc';
+ var dll = '../ncurses.so';
if( ! open_dll(dll) ) {
throw new Error("JSWindow could not load plugin '"+dll+"'.");
}
@@ -196,7 +196,8 @@
self.window = nc_newwin.apply(self,JCWindow.copyargs(arguments));
if( self.window )
{
- self.panel = nc_new_panel.apply(self.window);
+ self.panel = //nc_new_panel.apply(self.window);
+ nc_new_panel(self.window);
}
}
@@ -679,10 +680,10 @@
throw new Error("JCPad() unhandled ctor arguments. Read the docs." );
}
- this.vheight = function() { return nc_wheight( self.viewport ); };
- this.vwidth = function() { return nc_wwidth( self.viewport );};
- this.pheight = function() { return nc_wheight( self.pad ); };
- this.pwidth = function() { return nc_wwidth( self.pad ); };
+// this.vheight = function() { return nc_wheight( self.viewport ); };
+// this.vwidth = function() { return nc_wwidth( self.viewport );};
+// this.pheight = function() { return nc_wheight( self.pad ); };
+// this.pwidth = function() { return nc_wwidth( self.pad ); };
this.signals.scrollto = new Signal();
return self;
@@ -691,6 +692,11 @@
JCScroller.inherits( JCWindow );
+ JCScroller.prototype.vheight = function() { return nc_wheight( this.viewport ); };
+ JCScroller.prototype.vwidth = function() { return nc_wwidth( this.viewport );};
+ JCScroller.prototype.pheight = function() { return nc_wheight( this.pad ); };
+ JCScroller.prototype.pwidth = function() { return nc_wwidth( this.pad ); };
+
/**
Draws this.pad to the viewport window. If y and x are
passed, the top/left position of the viewport will be that
@@ -1173,12 +1179,12 @@
this.nc_wrender = function(win) {
// var old = nc_winch(win);
// var attr = this.selected
-// ? (ncurses.UNDERLINE | ncurses.BOLD | ncurses.REVERSE)
+// ? (ncurses.A_UNDERLINE | ncurses.A_BOLD | ncurses.A_REVERSE)
// : old;
// Weird: when i use nc_winch() and nc_wattrset(), all of the
// alpha chars in this.value get lowercased! curses!
var attr = this.selected
- ? (ncurses.UNDERLINE | ncurses.BOLD | ncurses.REVERSE)
+ ? (ncurses.A_UNDERLINE | ncurses.A_BOLD | ncurses.A_REVERSE)
: 0;
nc_wattron(win, attr);
nc_wrender(win,this.value);
Modified: plugins/ncurses/scripts/ncpad.js
===================================================================
--- plugins/ncurses/scripts/ncpad.js 2007-09-28 02:50:44 UTC (rev 41)
+++ plugins/ncurses/scripts/ncpad.js 2007-09-28 03:44:42 UTC (rev 42)
@@ -4,13 +4,13 @@
var sht = root.height();
var swt = root.width();
root.console = new JCWindow(root,sht/3*2,swt-2,1,1); //,sht/2,swt-2,1, 1);
-root.background(nc_color_pair("yellow","cyan") | ncurses.BOLD);
+root.background(nc_color_pair("yellow","cyan") | ncurses.A_BOLD);
root.border();
root.addstr(0,2,'ncpad test/demo');
root.refresh();
-root.console.background(nc_color_pair("white","black")|ncurses.BOLD);
+root.console.background(nc_color_pair("white","black")|ncurses.A_BOLD);
nc_capture_cout(root.console.window);
-//nc_capture_cerr(root.console.window,nc_color_pair("red","black")|ncurses.BOLD);
+//nc_capture_cerr(root.console.window,nc_color_pair("red","black")|ncurses.A_BOLD);
root.console.scrollok(true);
if( 0 ) {
@@ -22,7 +22,7 @@
root.console.scroller = new JCScroller( Pad, root.console );
root.signals.refresh.connect( root.console.scroller.refresh );
- //Pad.background(nc_color_pair('white','blue')|ncurses.BOLD);
+ //Pad.background(nc_color_pair('white','blue')|ncurses.A_BOLD);
for( var i = 0; i < Pad.height(); ++i )
{
print("Pad line #"+i);
@@ -52,7 +52,7 @@
nc_scrollok(Pad.pad,false);
var ht = ph/3;
var Win = root.SWindow = new JCWindow( root, ht, 30, ph+2, 1 );
- //Pad.background(nc_color_pair('white','blue')|ncurses.BOLD);
+ //Pad.background(nc_color_pair('white','blue')|ncurses.A_BOLD);
var SP = root.Scroller = new JCScroller( Pad, Win );
root.signals.refresh.connect( root.Scroller.refresh );
@@ -92,14 +92,14 @@
var km = new Object();
var thescroller = SP; //root.console.scroller;
var pageinc = thescroller.vheight();
- km[ncurses.UP] = function() { thescroller.scrollby(-1,0); };
- km[ncurses.DOWN] = function() { thescroller.scrollby(+1,0); };
- km[ncurses.RIGHT] = function() { thescroller.scrollby(0,+1); };
- km[ncurses.LEFT] = function() { thescroller.scrollby(0,-1); };
- km[ncurses.PGUP] = function() { thescroller.scrollby(-pageinc,0); };
- km[ncurses.PGDN] = function() { thescroller.scrollby(+pageinc,0); };
- km[ncurses.HOME] = function() { thescroller.scrollto(0,0); };
- km[ncurses.END] = function() { thescroller.scrollto(thescroller.pheight(),0); };
+ km[ncurses.KEY_UP] = function() { thescroller.scrollby(-1,0); };
+ km[ncurses.KEY_DOWN] = function() { thescroller.scrollby(+1,0); };
+ km[ncurses.KEY_RIGHT] = function() { thescroller.scrollby(0,+1); };
+ km[ncurses.KEY_LEFT] = function() { thescroller.scrollby(0,-1); };
+ km[ncurses.KEY_PPAGE] = function() { thescroller.scrollby(-pageinc,0); };
+ km[ncurses.KEY_NPAGE] = function() { thescroller.scrollby(+pageinc,0); };
+ km[ncurses.KEY_HOME] = function() { thescroller.scrollto(0,0); };
+ km[ncurses.KEY_END] = function() { thescroller.scrollto(thescroller.pheight(),0); };
km['q'] = function() { SP.keep_looping = false; };
Modified: plugins/ncurses/scripts/ncpanel.js
================================================================...
[truncated message content] |
|
From: <sg...@us...> - 2007-09-28 02:50:46
|
Revision: 41
http://spiderape.svn.sourceforge.net/spiderape/?rev=41&view=rev
Author: sgbeal
Date: 2007-09-27 19:50:44 -0700 (Thu, 27 Sep 2007)
Log Message:
-----------
corrected missing return
Modified Paths:
--------------
trunk/src/ape/ape.cpp
Modified: trunk/src/ape/ape.cpp
===================================================================
--- trunk/src/ape/ape.cpp 2007-09-28 00:59:17 UTC (rev 40)
+++ trunk/src/ape/ape.cpp 2007-09-28 02:50:44 UTC (rev 41)
@@ -710,8 +710,8 @@
bool js_simple_object::set( std::string const & key, jsval val )
{
- JS_SetProperty( this->js_context(), this->js_object(),
- key.c_str(), &val );
+ return JS_SetProperty( this->js_context(), this->js_object(),
+ key.c_str(), &val );
}
js_simple_object::js_simple_object( JSContext * cx )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|