S
Simon Strandgaard
My program (aeditor) works ok on my setup (ruby-1.8.1, linux).
However when installing on another box (ruby-1.8.2, linux), then the
following crash happens.
[shevegen] I, [2005-01-23T18:10:35.392024 #3970] INFO -- : program begin.
[shevegen] F, [2005-01-23T18:10:35.420153 #3970] FATAL -- : uncaught
exception occured
[shevegen] DL:LTypeError unexpected type 'N'
[shevegen] struct.rb | 114 | in `sizeof'
[shevegen] struct.rb | 114 | in `parse'
[shevegen] struct.rb | 74 | in `initialize'
[shevegen] struct.rb | 11 | in `new'
[shevegen] struct.rb | 11 | in `struct'
[shevegen] ncursesw.rb | 74 |
[shevegen] main_tui.rb | 46 | in `require'
[shevegen] main_tui.rb | 46 | in `run'
[shevegen] main_tui.rb | 358 |
[shevegen] I, [2005-01-23T18:10:35.420424 #3970] INFO -- : program end.
The wrapper code goes like this:
require 'dl/import'
require 'dl/struct'
module Curses
extend DL::Importable
dlload 'libncursesw.so'
typealias 'NCURSES_SIZE_T', 'short'
typealias 'chtype', 'unsigned long'
typealias 'attr_t', 'chtype'
typealias 'bool', 'int'
WINDOW = struct [
# current cursor position
'NCURSES_SIZE_T cury',
'NCURSES_SIZE_T curx',
# window location and size
# maximums of x and y, NOT window size
'NCURSES_SIZE_T maxy',
'NCURSES_SIZE_T maxx',
# screen coords of upper-left-hand corner
'NCURSES_SIZE_T begy',
'NCURSES_SIZE_T begx',
# window state flags
'short flags',
# attribute tracking
'attr_t attrs', # current attribute for non-space character
'chtype bkgd', # current background char/attribute pair
# option values set by user
'bool notimeout', # no time out on function-key entry?
'bool clear', # consider all data in the window invalid?
'bool leaveok', # OK to not reset cursor on exit?
'bool scroll', # OK to scroll this window?
'bool idlok', # OK to use insert/delete line?
'bool idcok', # OK to use insert/delete char?
'bool immed', # window in immed mode? (not yet used)
'bool sync', # window in sync mode?
'bool use_keypad', # process function keys into KEY_ symbols?
'int delay', # 0 = nodelay, <0 = blocking, >0 = delay
# the actual line data
'void *line', # TODO: ldat is used.. but what is ldat?
# global screen state
'NCURSES_SIZE_T regtop', # top line of scrolling region
'NCURSES_SIZE_T regbottom', # bottom line of scrolling region
# these are used only if this is a sub-window
'int parx', # x coordinate of this window in parent
'int pary', # y coordinate of this window in parent
# pointer to parent if a sub-window
'void *parent', # TODO: this is a struct window * pointer
# these are used only if this is a pad
'NCURSES_SIZE_T pad_y',
'NCURSES_SIZE_T pad_x',
'NCURSES_SIZE_T pad_top',
'NCURSES_SIZE_T pad_left',
'NCURSES_SIZE_T pad_bottom',
'NCURSES_SIZE_T pad_right',
# real begy is _begy + _yoffset
'NCURSES_SIZE_T yoffset'
]
# setup
extern 'void *initscr()'
extern 'int cbreak()'
extern 'int keypad(void *, bool)'
extern 'int noecho()'
extern 'int nonl()'
extern 'int raw()'
extern 'int meta(void *, bool)'
extern 'int nodelay(void *, bool)'
extern 'int keyok(int, bool)'
extern 'bool has_colors()'
extern 'int start_color()'
extern 'int init_pair(short, short, short)'
extern 'int wcolor_set(void*, short, void*)'
extern 'void wbkgdset(void *, chtype)'
extern 'int wattrset(void *, int)'
def self.has_colors?
(has_colors != 0)
end
# access global variables
Int = struct ["int value"]
COLORS_PTR = symbol 'COLORS'
ESCDELAY_PTR = symbol 'ESCDELAY'
def self.COLORS
Int.new(COLORS_PTR).value
end
def self.ESCDELAY
Int.new(ESCDELAY_PTR).value
end
# teardown
extern 'int endwin()'
# runtime
extern 'int clear()'
extern 'int addstr(const char *)'
#extern 'int add_wch(const cchar_t *)'
extern 'int getch()'
extern 'int refresh()'
extern 'int clrtoeol()'
extern 'int addnstr(const char *, int)'
extern 'int move(int, int)'
extern 'int refresh()'
end
I cannot figure out what the problem seems to be?
Maybe something is different in 1.8.2 ?
(maybe I should upgrade to 1.8.2)
However when installing on another box (ruby-1.8.2, linux), then the
following crash happens.
[shevegen] I, [2005-01-23T18:10:35.392024 #3970] INFO -- : program begin.
[shevegen] F, [2005-01-23T18:10:35.420153 #3970] FATAL -- : uncaught
exception occured
[shevegen] DL:LTypeError unexpected type 'N'
[shevegen] struct.rb | 114 | in `sizeof'
[shevegen] struct.rb | 114 | in `parse'
[shevegen] struct.rb | 74 | in `initialize'
[shevegen] struct.rb | 11 | in `new'
[shevegen] struct.rb | 11 | in `struct'
[shevegen] ncursesw.rb | 74 |
[shevegen] main_tui.rb | 46 | in `require'
[shevegen] main_tui.rb | 46 | in `run'
[shevegen] main_tui.rb | 358 |
[shevegen] I, [2005-01-23T18:10:35.420424 #3970] INFO -- : program end.
The wrapper code goes like this:
require 'dl/import'
require 'dl/struct'
module Curses
extend DL::Importable
dlload 'libncursesw.so'
typealias 'NCURSES_SIZE_T', 'short'
typealias 'chtype', 'unsigned long'
typealias 'attr_t', 'chtype'
typealias 'bool', 'int'
WINDOW = struct [
# current cursor position
'NCURSES_SIZE_T cury',
'NCURSES_SIZE_T curx',
# window location and size
# maximums of x and y, NOT window size
'NCURSES_SIZE_T maxy',
'NCURSES_SIZE_T maxx',
# screen coords of upper-left-hand corner
'NCURSES_SIZE_T begy',
'NCURSES_SIZE_T begx',
# window state flags
'short flags',
# attribute tracking
'attr_t attrs', # current attribute for non-space character
'chtype bkgd', # current background char/attribute pair
# option values set by user
'bool notimeout', # no time out on function-key entry?
'bool clear', # consider all data in the window invalid?
'bool leaveok', # OK to not reset cursor on exit?
'bool scroll', # OK to scroll this window?
'bool idlok', # OK to use insert/delete line?
'bool idcok', # OK to use insert/delete char?
'bool immed', # window in immed mode? (not yet used)
'bool sync', # window in sync mode?
'bool use_keypad', # process function keys into KEY_ symbols?
'int delay', # 0 = nodelay, <0 = blocking, >0 = delay
# the actual line data
'void *line', # TODO: ldat is used.. but what is ldat?
# global screen state
'NCURSES_SIZE_T regtop', # top line of scrolling region
'NCURSES_SIZE_T regbottom', # bottom line of scrolling region
# these are used only if this is a sub-window
'int parx', # x coordinate of this window in parent
'int pary', # y coordinate of this window in parent
# pointer to parent if a sub-window
'void *parent', # TODO: this is a struct window * pointer
# these are used only if this is a pad
'NCURSES_SIZE_T pad_y',
'NCURSES_SIZE_T pad_x',
'NCURSES_SIZE_T pad_top',
'NCURSES_SIZE_T pad_left',
'NCURSES_SIZE_T pad_bottom',
'NCURSES_SIZE_T pad_right',
# real begy is _begy + _yoffset
'NCURSES_SIZE_T yoffset'
]
# setup
extern 'void *initscr()'
extern 'int cbreak()'
extern 'int keypad(void *, bool)'
extern 'int noecho()'
extern 'int nonl()'
extern 'int raw()'
extern 'int meta(void *, bool)'
extern 'int nodelay(void *, bool)'
extern 'int keyok(int, bool)'
extern 'bool has_colors()'
extern 'int start_color()'
extern 'int init_pair(short, short, short)'
extern 'int wcolor_set(void*, short, void*)'
extern 'void wbkgdset(void *, chtype)'
extern 'int wattrset(void *, int)'
def self.has_colors?
(has_colors != 0)
end
# access global variables
Int = struct ["int value"]
COLORS_PTR = symbol 'COLORS'
ESCDELAY_PTR = symbol 'ESCDELAY'
def self.COLORS
Int.new(COLORS_PTR).value
end
def self.ESCDELAY
Int.new(ESCDELAY_PTR).value
end
# teardown
extern 'int endwin()'
# runtime
extern 'int clear()'
extern 'int addstr(const char *)'
#extern 'int add_wch(const cchar_t *)'
extern 'int getch()'
extern 'int refresh()'
extern 'int clrtoeol()'
extern 'int addnstr(const char *, int)'
extern 'int move(int, int)'
extern 'int refresh()'
end
I cannot figure out what the problem seems to be?
Maybe something is different in 1.8.2 ?
(maybe I should upgrade to 1.8.2)