Accessing The Command Line

Liste des GroupesRevenir à cl ada 
Sujet : Accessing The Command Line
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.ada
Date : 04. Jul 2024, 02:08:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v64p6n$2dviq$1@dont-email.me>
User-Agent : Pan/0.158 (Avdiivka; )
with Ada.Command_Line;
with Ada.Text_IO;

procedure Echo is

    package cli renames Ada.Command_Line;
    package tio renames Ada.Text_IO;
    package int_io is new tio.Integer_IO(Num => Integer);

begin
    tio.put("my name: ");
    tio.put(cli.Command_name);
    tio.Put_Line("");
    tio.Put("nr args: ");
    int_io.Put(cli.Argument_Count, width => 1);
    tio.Put_Line("");
    for i in 1 .. cli.Argument_Count loop
        tio.put("[");
        int_io.put(i, width => 1);
        tio.put("]: ");
        tio.put(cli.argument(i));
        tio.put_line("");
    end loop;
end Echo;

----

Comments:

Ada, like Python, offers the convenience of being able to specify
local “nicknames” for imported packages, to save some typing.

Having become used to the convenience of printf-style formatting in C
and other languages that have adopted it (including Lisp and Python),
I don’t miss the tedium of having to format and output one item at a
time. Though I recognize that there is no way to do printf style in a
type-safe fashion, short of going to a fully-dynamic language.

Being able to access the POSIX command line via some globally-defined
entity instead of arguments to a “mainline” procedure is something
that just about every decent language offers. C is notably absent from
this list.

Date Sujet#  Auteur
4 Jul 24 * Accessing The Command Line11Lawrence D'Oliveiro
4 Jul 24 +* Re: Accessing The Command Line4Paul Rubin
4 Jul 24 i`* Re: Accessing The Command Line3Lawrence D'Oliveiro
4 Jul 24 i +- Re: Accessing The Command Line1Rod Kay
4 Jul 24 i `- Re: Accessing The Command Line1Dmitry A. Kazakov
4 Jul 24 +* Re: Accessing The Command Line3Jeffrey R.Carter
5 Jul 24 i`* Re: Accessing The Command Line2Lawrence D'Oliveiro
5 Jul 24 i `- Re: Accessing The Command Line1J-P. Rosen
4 Jul 24 +- Re: Accessing The Command Line1Dmitry A. Kazakov
4 Jul 24 `* Re: Accessing The Command Line2Ben Bacarisse
5 Jul 24  `- Re: Accessing The Command Line1Paul Rubin

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal