[Spiderape-cvs] SF.net SVN: spiderape: [57] plugins/ncurses
Status: Beta
Brought to you by:
sgbeal
|
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.
|