From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c6842d1c8d79ec39,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-09 10:27:44 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: wjr17@attbi.com (Bill) Newsgroups: comp.lang.ada Subject: Line and Column size Date: 9 Feb 2004 10:27:44 -0800 Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 130.49.113.160 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1076351264 27095 127.0.0.1 (9 Feb 2004 18:27:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 Feb 2004 18:27:44 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:5370 Date: 2004-02-09T10:27:44-08:00 List-Id: I'm working on a project for school and I have created a very nice looking TUI window library in ADA95. I thought as an added extra it would be nice to be able to scale the TUI window to the size of the current users terminal window. I have looked into using the $LINES and $COLUMNS term variables, be they wont work since they need to be exported. Therefore this would not be a safe method of getting the lines/columns, since not all systems have the variables exported. Another thing I have tried is to use the curses library. I wrote a small C library using curses. It goes as follows: code:-------------------------------------------------------------------------------- #include struct scr { int LINES; int COLUMNS; }; struct scr GetScreen(void) { struct scr Scr = {0,0}; initscr(); Scr.LINES = LINES; Scr.COLUMNS = COLS; endwin(); return Scr; } -------------------------------------------------------------------------------- I can import the function fine into ADA95 by doing on of these: code:-------------------------------------------------------------------------------- TYPE scrsize IS RECORD LINES : INTEGER := 0; COLUMNS : INTEGER := 0; END RECORD; FUNCTION GetSize Return scrsize IS Function GetScreen Return scrsize; pragma Import(C,GetScreen,"GetScreen"); BEGIN -- GetSize RETURN GetScreen; END GetSize; -------------------------------------------------------------------------------- Then to compile the code you do a gcc -c myc_Lib.c gnatmake main_prog.adb -largs -lcurses myc_lib.o Now the C code returns the line and column numbers perfectly. However it seems that when curses runs, it changes the screen, or does something, because my TUI code no longer displays properly. The terminal window seems to act wierd after my program exits. So I was wondering if anyone knew what might be wrong or I'm not doing that I should be in the C code, or if there is a better way to go about doing what I'm doing. Maybe there is a library package for ADA95 that already does what I want it to, but I have just not found it yet. Thanks for the help. - Bill