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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ff34bb99bda04ad7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-08 19:29:27 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!swrinde!pipex!uunet!gwu.edu!gwu.edu!not-for-mail From: mfeldman@seas.gwu.edu (Michael Feldman) Newsgroups: comp.lang.ada Subject: Re: GOTOXY in Ada ? Date: 8 Dec 1994 21:59:32 -0500 Organization: George Washington University Message-ID: <3c8h6k$da7@felix.seas.gwu.edu> References: <3c4a9a$1lts@obelix.uni-muenster.de> NNTP-Posting-Host: 128.164.9.3 Date: 1994-12-08T21:59:32-05:00 List-Id: In article <3c4a9a$1lts@obelix.uni-muenster.de>, Jan Ahlers wrote: >Hi all ! > >I know this is a rather simple question, but I'll ask it anyways ;-) > >Is there an equivalent in Ada to the gotoxy command in Pascal (-> put the >cursor at column x, row y) ? Answers would be greatly appreciated ! gotoxy is in no way a Pascal command. Some implementers (e.g. Borland) put it in as a predefined procedure, but it is certainly not part of the language. It is also not part of Ada, but it's quite easy to do with a small package. This package assumes a vt100-ish terminal, such as ansi.sys on your PC. This package will get you started; you can add terminal capabilities as you choose. Mike Feldman --- cut here --- -- spec PACKAGE Screen IS -- Procedures for drawing pictures on ANSI Terminal Screen -- Michael Feldman, The George Washington University, Washington, DC ScreenHeight : CONSTANT Integer := 24; ScreenWidth : CONSTANT Integer := 80; SUBTYPE Height IS Integer RANGE 1..ScreenHeight; SUBTYPE Width IS Integer RANGE 1..ScreenWidth; TYPE Position IS RECORD Row : Height := 1; Column: Width := 1; END RECORD; PROCEDURE Beep; -- Pre: none -- Post: the terminal beeps once PROCEDURE ClearScreen; -- Pre: none -- Post: the terminal screen is cleared PROCEDURE MoveCursor (To: IN Position); -- Pre: To is defined -- Post: the terminal cursor is moved to the given position END Screen; -- body WITH Text_IO; PACKAGE BODY Screen IS -- Michael Feldman, The George Washington University, Washington, DC PACKAGE My_Int_IO IS NEW Text_IO.Integer_IO (Num => Integer); -- Procedures for drawing pictures on ANSI Terminal Screen -- These procedures will work correctly only if the actual -- terminal is ANSI compatible. ANSI.SYS on a DOS machine -- will suffice. PROCEDURE Beep IS BEGIN Text_IO.Put (Item => ASCII.BEL); END Beep; PROCEDURE ClearScreen IS BEGIN Text_IO.Put (Item => ASCII.ESC); Text_IO.Put (Item => "[2J"); END ClearScreen; PROCEDURE MoveCursor (To: IN Position) IS BEGIN Text_IO.New_Line; -- this avoids OS terminal buffer overflow Text_IO.Put (Item => ASCII.ESC); Text_IO.Put ("["); My_Int_IO.Put (Item => To.Row, Width => 1); Text_IO.Put (Item => ';'); My_Int_IO.Put (Item => To.Column, Width => 1); Text_IO.Put (Item => 'f'); END MoveCursor; END Screen;