Discussion:
converting ncurses.h to gm2
(too old to reply)
rob solomon
2011-02-23 22:24:20 UTC
Permalink
I'm trying to learn to translate C header file info to gm2. The
following is from ncurses.def on an Ubuntu system.

typedef unsigned char NCURSES_BOOL;
typedef unsigned short wchar_t;
typedef unsigned int wint_t;
#define NCURSES_SIZE_T short
typedef unsigned long chtype;
typedef unsigned long mmask_t;
typedef unsigned short wchar_t;
typedef unsigned int wint_t;

So far I've done this. Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.

TYPE
WINDOW = ADDRESS ;
chtype = LONGCARD ;
chstring = ADDRESS ;
ATTRIBUTE = chtype ;
COLORPAIR = SHORTCARD ;
mmask_t = LONGCARD ;
wchar_t = CARDINAL;
wint_t = CARDINAL;
attr_t = CARDINAL;

Thanks for any help.
--rob
Gaius Mulley
2011-02-24 11:39:50 UTC
Permalink
I'm trying to learn to translate C header file info to gm2.  The
following is from ncurses.def on an Ubuntu system.
   typedef unsigned char NCURSES_BOOL;
   typedef unsigned short wchar_t;
   typedef unsigned int wint_t;
   #define      NCURSES_SIZE_T short
   typedef unsigned long chtype;
   typedef unsigned long mmask_t;
   typedef unsigned short wchar_t;
   typedef unsigned int wint_t;
So far I've done this.  Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
   WINDOW = ADDRESS ;
   chtype = LONGCARD ;
   chstring = ADDRESS ;
   ATTRIBUTE = chtype ;
   COLORPAIR = SHORTCARD ;
   mmask_t = LONGCARD ;
   wchar_t = CARDINAL;
   wint_t = CARDINAL;
   attr_t = CARDINAL;
Thanks for any help.
--rob
Hi,

apologies if this is a duplicate reply.

I think you are on the correct path, it might be worth examining:

http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/ncurses.def?root=gm2

for some ideas,

regards,
Gaius
Gaius Mulley
2011-02-24 11:22:58 UTC
Permalink
I'm trying to learn to translate C header file info to gm2.  The
following is from ncurses.def on an Ubuntu system.
   typedef unsigned char NCURSES_BOOL;
   typedef unsigned short wchar_t;
   typedef unsigned int wint_t;
   #define      NCURSES_SIZE_T short
   typedef unsigned long chtype;
   typedef unsigned long mmask_t;
   typedef unsigned short wchar_t;
   typedef unsigned int wint_t;
So far I've done this.  Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
   WINDOW = ADDRESS ;
   chtype = LONGCARD ;
   chstring = ADDRESS ;
   ATTRIBUTE = chtype ;
   COLORPAIR = SHORTCARD ;
   mmask_t = LONGCARD ;
   wchar_t = CARDINAL;
   wint_t = CARDINAL;
   attr_t = CARDINAL;
Thanks for any help.
--rob
Hi Rob,

this looks like a reasonable approach. It might be worth examining:

http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/ncurses.def?root=gm2

for some ideas

regards,
Gaius
Bartholomew
2011-02-24 15:14:56 UTC
Permalink
Post by Gaius Mulley
Post by rob solomon
I'm trying to learn to translate C header file info to gm2. The
following is from ncurses.def on an Ubuntu system.
typedef unsigned char NCURSES_BOOL;
[...]
Post by Gaius Mulley
Post by rob solomon
So far I've done this. Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
WINDOW = ADDRESS ;
[...]
Post by Gaius Mulley
Post by rob solomon
Thanks for any help.
--rob
Hi Rob,
http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/ncurses.def?root=gm2
for some ideas
regards,
Gaius
Another matter is whether you want to call the lib(n)curses functions
directly or have a shim layer. (There are arguments on both sides.)
rob solomon
2011-03-01 02:00:57 UTC
Permalink
Post by Bartholomew
Post by Gaius Mulley
Post by rob solomon
I'm trying to learn to translate C header file info to gm2. The
following is from ncurses.def on an Ubuntu system.
typedef unsigned char NCURSES_BOOL;
[...]
Post by Gaius Mulley
Post by rob solomon
So far I've done this. Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
WINDOW = ADDRESS ;
[...]
Post by Gaius Mulley
Post by rob solomon
Thanks for any help.
--rob
Hi Rob,
http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/ncurses.def?root=gm2
for some ideas
regards,
Gaius
Another matter is whether you want to call the lib(n)curses functions
directly or have a shim layer. (There are arguments on both sides.)
Doesn't matter for me since I cannot do either, yet.

I looked at the DEFINITION MODULE FOR "C" ncurses that seems to come w/
gm2. I'm at a loss as how to get eveh the hello world program done. I
cannot find a way to write a char or a string.

ch is a chtype, not a char. And I don't know how variadic functions
like printw are converted into gm2.

From what I can tell, the MOCKA instructions don't help me since it's
not very compatible w/ gm2 and I installed gm2.

As interested as I am, I cannot understand how to get anything done at
all.
Martin Brown
2011-03-01 08:49:57 UTC
Permalink
Post by rob solomon
Post by Bartholomew
Post by Gaius Mulley
Post by rob solomon
I'm trying to learn to translate C header file info to gm2. The
following is from ncurses.def on an Ubuntu system.
typedef unsigned char NCURSES_BOOL;
[...]
Post by Gaius Mulley
Post by rob solomon
So far I've done this. Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
WINDOW = ADDRESS ;
[...]
Post by Gaius Mulley
Post by rob solomon
Thanks for any help.
--rob
Hi Rob,
http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/ncurses.def?root=gm2
for some ideas
regards,
Gaius
Another matter is whether you want to call the lib(n)curses functions
directly or have a shim layer. (There are arguments on both sides.)
Doesn't matter for me since I cannot do either, yet.
I looked at the DEFINITION MODULE FOR "C" ncurses that seems to come w/
gm2. I'm at a loss as how to get eveh the hello world program done. I
cannot find a way to write a char or a string.
Isn't it TextIO Put in NCurses.
Post by rob solomon
ch is a chtype, not a char. And I don't know how variadic functions
like printw are converted into gm2.
Although Topspeed extensions allowed support for varadic functions I
don't think you need them for either NCurses or Windows bindings.

If you need varadic bindings then it is possible that XDS will do them
when the TopSpeed compatibility extensions are enabled but I have never
tried to do it so I don't know.
Post by rob solomon
From what I can tell, the MOCKA instructions don't help me since it's
not very compatible w/ gm2 and I installed gm2.
As interested as I am, I cannot understand how to get anything done at
all.
You might find it useful for ideas to look at the bindings for Ada95
which are also for a strongly typed language (though some other
differences). I cannot vouch for their accuracy - never used them.

http://invisible-island.net/ncurses/ada/terminal_interface-curses-text_io__ads.htm

You are right to try and do a Hello World program that can handle simple
IO and the quit command to get started. I suggest you ignore printw etc
in favour of the underlying primitives.

Regards,
Martin Brown
Gaius Mulley
2011-03-04 23:58:43 UTC
Permalink
Post by rob solomon
Post by Bartholomew
Post by Gaius Mulley
I'm trying to learn to translate C header file info to gm2.  The
following is from ncurses.def on an Ubuntu system.
    typedef unsigned char NCURSES_BOOL;
[...]
Post by Gaius Mulley
So far I've done this.  Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
    WINDOW = ADDRESS ;
[...]
Post by Gaius Mulley
Thanks for any help.
--rob
Hi Rob,
http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/ncurses/nc...
for some ideas
regards,
Gaius
Another matter is whether you want to call the lib(n)curses functions
directly or have a shim layer.  (There are arguments on both sides.)
Doesn't matter for me since I cannot do either, yet.
I looked at the DEFINITION MODULE FOR "C" ncurses that seems to come w/
gm2.  I'm at a loss as how to get eveh the hello world program done.  I
cannot find a way to write a char or a string.  
ch is a chtype, not a char.  And I don't know how variadic functions
like printw are converted into gm2.
From what I can tell, the MOCKA instructions don't help me since it's
not very compatible w/ gm2 and I installed gm2.
As interested as I am, I cannot understand how to get anything done at
all.
Hi,

it might be worth looking at this test module:

http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/gm2/examples/ncurses/testmove.mod

which shows how to place colourised characters on the screen using
ncurses.def

regards,
Gaius

aaaaaaaaaaaaaaaaaaaaaaaaaa
2011-02-25 18:32:55 UTC
Permalink
Post by rob solomon
I'm trying to learn to translate C header file info to gm2. The
following is from ncurses.def on an Ubuntu system.
typedef unsigned char NCURSES_BOOL;
typedef unsigned short wchar_t;
typedef unsigned int wint_t;
#define NCURSES_SIZE_T short
typedef unsigned long chtype;
typedef unsigned long mmask_t;
typedef unsigned short wchar_t;
typedef unsigned int wint_t;
So far I've done this. Am I in the right direction or am I way off?
BTW, I don't make my living in IT, so this is just a hobby for me.
TYPE
WINDOW = ADDRESS ;
chtype = LONGCARD ;
chstring = ADDRESS ;
ATTRIBUTE = chtype ;
COLORPAIR = SHORTCARD ;
mmask_t = LONGCARD ;
wchar_t = CARDINAL;
wint_t = CARDINAL;
attr_t = CARDINAL;
Thanks for any help.
--rob
As Bartholomew proposed, you may try the foreign module approach:
http://fruttenboel.verhoeven272.nl/mocka/svgalib.html
Loading...