ncurses interface change (was: silly question)

F

Ferenc Engard

Hi all,

Did the ncurses lib's interface was changed from 1.6.8 to 1.8.x? In the
1.6.8 version, all Ncurses ("global") functions or constants were
accessible after mixing Ncurses, so I could write something like:

class XXX
include Ncurses
def yyy
# ...
doupdate
# ...
end
# ...
end

In the 1.8.x, it only works like this:

......
Ncurses.doupdate # instead of simply doupdate
......

This is what I wanted to explain in my previous thread, that I want to
access singleton methods from another module _without modifying the
Ncurses module definition_.

Can I do something to not to go through my program and fix it in several
dozen places?

I was on holiday, that's why I respond with a few weeks delay.

Thanks:
Ferenc
 
H

Henry T. So Jr.

This is apparently a change in version 0.8 of the ncurses binding.

I don't know how much this will help in terms of not changing your
program, but I got this code snippet from Tobias Peters (the author of
the ncurses binding for Ruby. You would insert this wherever you
include Ncurses:

# include constants
include Ncurses

# include methods as toplevel methods
alias pre_ncurses_method_missing method_missing
def method_missing(name, *args)
if Ncurses.respond_to?(name)
Ncurses.send(name, *args)
else
pre_ncurses_method_missing(name, *args)
end
end

Regards,
Henry
 
F

Ferenc Engard

Henry T. So Jr. said:
This is apparently a change in version 0.8 of the ncurses binding.

I don't know how much this will help in terms of not changing your
program, but I got this code snippet from Tobias Peters (the author of
the ncurses binding for Ruby. You would insert this wherever you
include Ncurses:

# include constants
include Ncurses

# include methods as toplevel methods
alias pre_ncurses_method_missing method_missing
def method_missing(name, *args)
if Ncurses.respond_to?(name)
Ncurses.send(name, *args)
else
pre_ncurses_method_missing(name, *args)
end
end

This looks promising, thank you!

Ferenc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top