comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Problem with 'get_immediate'
Date: 1999/03/02
Date: 1999-03-02T00:00:00+00:00	[thread overview]
Message-ID: <$GeN64KZ#GA.154@pet.hiwaay.net> (raw)
In-Reply-To: 36db1f5f.0@silver.truman.edu

Josh Highley wrote in message <36db1f5f.0@silver.truman.edu>...
>  In several programs I'm working on, I'm using 'get_immediate' to get
>user input based on a menu.  However, the input is echoed in the
>next 'get' statement that is executed quickly after the user inputs the
>menu command.  For example:
>
>This is part of a menu I output to the screen:
>
>---------------------------
>L - Load and Process a File
>E - Exit
>
>Command:
>
>
>-- After "Command:", I use a 'get_immediate' and then a 'put' to echo
>the user's input after "Command".  When the user enters 'L', I then
>immediately give a prompt along with a 'get_line' so the user can input
>the name of the file.  The problem is that the 'L' is also echoed after
>the prompt for the filename. So this appears on the screen without the
>user typing anything after the initial 'L':
>
>Enter name of file: L
>
>-- The user then has to backspace over the 'L' assuming he/she realizes
>it, and it's annoying.  Hoping, I tried removing the 'put' following
>the 'get_immediate' but it didn't help.  Is there some way I can keep
>this unwanted echo from occuring?  I am using GNAT 3.11, AdaGIDE 6.21,
>and Win95.
>
>Thanks for your help,


Here is a little program I used to get the key sequences returned by
function keys.  It does not echo -- either on WinNT or Win95.

I compiled it on WinNT, as I do not have a gnat development on Win95.  I
suppose it's possible that one of these three things might make a
difference, viz.:

   1.  I am using the line
       DEVICEHIGH=C:\WIN95\COMMAND\ANSI.SYS
       in my c:\CONFIG.SYS file, as I want
       ANSI color attributes, etc.

   2.  Compiling and linking under Win95,
       instead of  WinNT makes a difference.

   3.  I have the cygwin b20-1 environment
       on my NT machine.

-- begin source code --
with Ada.Text_Io;
with Interfaces.C;
procedure Tgi is
   Item : Character;
begin
   loop
      Ada.Text_Io.Get_Immediate
        (Item => Item);
      Ada.Text_Io.Put_Line
        ("""" & Integer'Image (Character'Pos (Item)) & """");
      exit when Item = 'Z';
   end loop;
end Tgi;
-- end source code --

the command (issued by Emacs Ada-mode was:
gnatmake
:/gnat_examples/tgi -aI./ -aO./ -g -O2 -gnatqx -cargs  -bargs  -largs

Here's the resulting b_tgi.c file, which shows what libraries were linked:

extern int gnat_argc;
extern char **gnat_argv;
extern char **gnat_envp;
extern int gnat_exit_status;
void adafinal ();

void adainit ()
{
   __gnat_set_globals (
      -1,      /* Main_Priority              */
      -1,      /* Time_Slice_Value           */
      'b',     /* WC_Encoding                */
      ' ',     /* Locking_Policy             */
      ' ',     /* Queuing_Policy             */
      ' ',     /* Tasking_Dispatching_Policy */
      adafinal,/* Finalization routine address */
      0);      /* Unreserve_All_Interrupts */

/* ada___elabs (); */
/* gnat___elabs (); */
/* gnat__heap_sort_a___elabs (); */
/* gnat__heap_sort_a___elabb (); */
/* gnat__htable___elabs (); */
/* gnat__htable___elabb (); */
/* interfaces___elabs (); */
   system___elabs ();
/* system__img_int___elabs (); */
/* system__machine_code___elabs (); */
/* system__parameters___elabs (); */
/* system__parameters___elabb (); */
   interfaces__c_streams___elabs ();
/* interfaces__c_streams___elabb (); */
/* system__standard_library___elabs (); */
   ada__exceptions___elabs ();
/* system__exception_table___elabs (); */
   system__exception_table___elabb ();
   ada__io_exceptions___elabs ();
   interfaces__c___elabs ();
   system__exceptions___elabs ();
/* system__storage_elements___elabs (); */
/* system__storage_elements___elabb (); */
/* system__secondary_stack___elabs (); */
/* interfaces__c___elabb (); */
/* system__img_int___elabb (); */
   ada__tags___elabs ();
   ada__tags___elabb ();
   ada__streams___elabs ();
/* system__string_ops___elabs (); */
/* system__string_ops___elabb (); */
/* system__string_ops_concat_3___elabs (); */
/* system__string_ops_concat_3___elabb (); */
/* system__task_specific_data___elabs (); */
/* system__tasking_soft_links___elabs (); */
   system__tasking_soft_links___elabb ();
/* system__task_specific_data___elabb (); */
   system__secondary_stack___elabb ();
   ada__exceptions___elabb ();
/* system__standard_library___elabb (); */
/* system__unsigned_types___elabs (); */
/* system__stream_attributes___elabs (); */
/* system__stream_attributes___elabb (); */
   system__finalization_root___elabs ();
/* system__finalization_root___elabb (); */
   system__finalization_implementation___elabs ();
/* system__finalization_implementation___elabb (); */
   ada__finalization___elabs ();
/* ada__finalization___elabb (); */
   ada__finalization__list_controller___elabs ();
/* ada__finalization__list_controller___elabb (); */
   system__file_control_block___elabs ();
/* system__file_io___elabs (); */
   system__file_io___elabb ();
   ada__text_io___elabs ();
   ada__text_io___elabb ();
/* tgi___elabb (); */
}
void adafinal () {
   system__finalization_implementation__finalize_global_list ();
}
int main (argc, argv, envp)
    int argc;
    char **argv;
    char **envp;
{
   gnat_argc = argc;
   gnat_argv = argv;
   gnat_envp = envp;

   __gnat_initialize();
   adainit();
   __gnat_break_start();

   _ada_tgi ();

   adafinal();
   __gnat_finalize();
   exit (gnat_exit_status);
}
unsigned tgiB = 0x3C0F88BF;
unsigned system__standard_libraryB = 0x33424FDE;
unsigned system__standard_libraryS = 0x152C9C37;
unsigned adaS = 0x2359F9ED;
unsigned ada__exceptionsB = 0x5ACF99CA;
unsigned ada__exceptionsS = 0x0C874D54;
unsigned gnatS = 0x156A40CF;
unsigned gnat__heap_sort_aB = 0x0F7D6C6E;
unsigned gnat__heap_sort_aS = 0x403BD1B6;
unsigned systemS = 0x22396E4B;
unsigned system__exception_tableB = 0x7AAA368C;
unsigned system__exception_tableS = 0x5F9C9EC4;
unsigned gnat__htableB = 0x62D2B79D;
unsigned gnat__htableS = 0x2E865F1E;
unsigned system__exceptionsS = 0x6A709D1E;
unsigned system__machine_codeS = 0x5C77B51D;
unsigned system__secondary_stackB = 0x1DE75F3F;
unsigned system__secondary_stackS = 0x1C1F4975;
unsigned system__tasking_soft_linksB = 0x40C8010E;
unsigned system__tasking_soft_linksS = 0x3F0E78F7;
unsigned system__task_specific_dataB = 0x27FE5FE0;
unsigned system__task_specific_dataS = 0x0572485D;
unsigned system__storage_elementsB = 0x6FD7DF62;
unsigned system__storage_elementsS = 0x71ED4384;
unsigned ada__text_ioB = 0x6785D29D;
unsigned ada__text_ioS = 0x48D8BC51;
unsigned ada__streamsS = 0x7C25DE96;
unsigned ada__tagsB = 0x1DC290E7;
unsigned ada__tagsS = 0x6355E9DA;
unsigned interfacesS = 0x0357E00A;
unsigned interfaces__c_streamsB = 0x4D7A64CF;
unsigned interfaces__c_streamsS = 0x26BBBD2D;
unsigned system__parametersB = 0x6CE6B6FB;
unsigned system__parametersS = 0x74E82817;
unsigned system__file_ioB = 0x4FAFC42D;
unsigned system__file_ioS = 0x6C217188;
unsigned ada__finalizationB = 0x4F0184F2;
unsigned ada__finalizationS = 0x0A0669D8;
unsigned system__finalization_rootB = 0x26610831;
unsigned system__finalization_rootS = 0x34542091;
unsigned system__stream_attributesB = 0x3E43967C;
unsigned system__stream_attributesS = 0x1209E01F;
unsigned ada__io_exceptionsS = 0x34054F96;
unsigned system__unsigned_typesS = 0x5B21DEE0;
unsigned system__finalization_implementationB = 0x3C846AC8;
unsigned system__finalization_implementationS = 0x28743C9E;
unsigned system__string_ops_concat_3B = 0x1CBC39CD;
unsigned system__string_ops_concat_3S = 0x6B6FD656;
unsigned system__string_opsB = 0x03F36D98;
unsigned system__string_opsS = 0x1F83539E;
unsigned system__file_control_blockS = 0x51F944CF;
unsigned ada__finalization__list_controllerB = 0x0B97C6BF;
unsigned ada__finalization__list_controllerS = 0x34B32999;
unsigned interfaces__cB = 0x0AECCF6D;
unsigned interfaces__cS = 0x65716517;
unsigned system__img_intB = 0x79CE2327;
unsigned system__img_intS = 0x038CA57A;

/* BEGIN Object file/option list
./tgi.o
-L./
-L./
-LC:\win32ada\
-LC:\USR\lib\gcc-lib\pentium-mingw32msv\2.8.1\adalib\
-lgnat
   END Object file/option list */

















      reply	other threads:[~1999-03-02  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-01  0:00 Problem with 'get_immediate' Josh Highley
1999-03-02  0:00 ` David C. Hoos, Sr. [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox