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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd9ba71376053a01 X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: how to put cursor at X,Y Date: 1996/11/01 Message-ID: <55e9td$s1n@felix.seas.gwu.edu>#1/1 X-Deja-AN: 193824508 references: <3270BBC4.5480@univ-orleans.fr> <556euh$opl@felix.seas.gwu.edu> <1996Oct30.074712.1@corning.com> organization: George Washington University newsgroups: comp.lang.ada Date: 1996-11-01T00:00:00+00:00 List-Id: In article <1996Oct30.074712.1@corning.com>, whiting_ms@corning.com (Matt Whiting) wrote: >In article <556euh$opl@felix.seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes: >> Ada.Text_IO.Put (Item => ASCII.ESC); >> Ada.Text_IO.Put ("["); >> Ada.Integer_Text_IO.Put (Item => To.Row, Width => 1); >> Ada.Text_IO.Put (Item => ';'); >> Ada.Integer_Text_IO.Put (Item => To.Column, Width => 1); >> Ada.Text_IO.Put (Item => 'f'); >This is off the subject, but how do typical Ada compilers (or GNAT if >specificity is required) handle the above list of I/O statements? I'm >thinking back to my FORTRAN days when I would typically use a single FORTRAN >WRITE/FORMAT statement combination to print out entire escape sequences with >"one" command. Does the Ada compiler aggregate the above statements into one >buffer for issuance to the serial port or the ANSI driver? Or does it >literally send seven separate I/O commands? And what, if any, execution >efficiency is lost if the latter is true? Good questions. I'll let the implementers answer specifically, but propose another solution. One could contemplate bundling it all up in one output statement by concatenating the strings together with the string images, as follows: Ada.Text_IO.Put(Item => ASCII.ESC & [ & Integer'Image(To.Row) & ';' Integer'Image(To.Column) & 'f'); This would be splendid except for one little problem. Unfortunately, Integer'Image returns the string with a leading blank (or a minus if the integer is negative), and the escape sequence can't have embedded blanks. So one would have to find another way of computing the string image of row and column without getting the leading blank. I'll leave that as an exercise.:-) Yet another (maybe more interesting) possibility is to use the Put-into-string form of all the Put statements. This is what Fortran calls (or called) an "internal file". The string could then be sent to the terminal with one final Put. 'Course then one would have to know just how long the actual string was; the string length could vary from 6 to 8 characters (why?). Implementers: what are the performance tradeoffs here? > >Matt Mike Feldman