> Am 02.03.2011 21:21, schrieb Benoît Minisini: > >> I do not have that much idea of how that works under C, so that's why I > >> ask here. > >> > >> In the ncurses library, there are macros. One of them is needed to get > >> the dimensions of the "window". But when I define it > >> > >> EXTERN getmaxyx(... > >> > >> when my program starts, there is merely the error "cannot find symbol > >> getmaxyx in library ncurses". > >> > >> So what can I do here? > >> > >> Regards > >> Rolf > > > > A macro is not a function. It is some code replaced by some other code at > > compilation time. The "getmaxyx" identifier does not exist in the > > executable. > > > > You must read the C header file to see what the getmaxyx() macro actually > > does. > > > > The gcc compiler has the "-E" option that can help you, by writing to the > > standard output the real code that will be compiled once all macros have > > been expanded. > > > > Regards, > > Thanks for the tip. I am aware of what a macro in general does, but I do > not understand the result of this thing: > > getmaxyx(stdscr, y, x); > > becomes > > (y = ((stdscr)?((stdscr)->_maxy + 1):(-1)), x = > ((stdscr)?((stdscr)->_maxx + 1):(-1))); > > and I do not know what "?", "->" and ":" are good for... I guess, the > basic functions are called maxy and maxx, but why with "_" etc...?
"x ? y : z" is an expression that returns "z" if "x" is zero, and returns "y" otherwise. (stdscr)->_maxy is the value of the "_maxy" field of the structure pointed by stdscr. So you must declare a structure equivalent to what stdscr points at, to be able to access its _maxy field, as that macro does. Of course, a ncurses component written in C would be simpler! Regards, -- Benoît Minisini ------------------------------------------------------------------------------ What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
