comp.lang.ada
 help / color / mirror / Atom feed
  • * Re: constant string array
           [not found] <910u3p$v9j$1@nnrp1.deja.com>
           [not found] ` <slrn9383g6.coa.randhol+abuse@kiuk0156.chembio.ntnu.no>
    @ 2000-12-11 21:41 ` Pascal Obry
      2000-12-12  2:54   ` Robert Dewar
      2000-12-12  2:56   ` Robert Dewar
           [not found] ` <3A3445A8.8FC404D5@acm.org>
      2000-12-15 18:41 ` constant string array Freelancer
      3 siblings, 2 replies; 40+ messages in thread
    From: Pascal Obry @ 2000-12-11 21:41 UTC (permalink / raw)
    
    
    bjoern_h@my-deja.com writes:
    
    > Hi,
    > 
    > I want to store constant strings (keywords of
    > Ada) of different
    > length in an array like that:
    
    Since you have asked for constant string and nobody have proposed a solution
    without Unbounded_String here is my own way to do this:
    
    (cut & past from Ada Web Server implementation)
    
    -------------------------------------------------------------------------
    
    package body AWS.Messages is
    
       type String_Access is access constant String;
    
       subtype Status_Code_Image is String (1 .. 3);
    
       S100_Message : aliased constant String := "Continue";
       S101_Message : aliased constant String := "Switching Protocols";
       S200_Message : aliased constant String := "OK";
       S201_Message : aliased constant String := "Create";
       S202_Message : aliased constant String := "Accepted";
       S203_Message : aliased constant String := "Non-Authoritative Information";
       S204_Message : aliased constant String := "No Content";
       S205_Message : aliased constant String := "Reset Content";
       S206_Message : aliased constant String := "Partial Content";
       S300_Message : aliased constant String := "Multiple Choices";
       ...
    
       type Status_Data is record
          Code          : Status_Code_Image;
          Reason_Phrase : String_Access;
       end record;
    
       Status_Messages : array (Status_Code) of Status_Data
         := (S100 => ("100", S100_Message'Access),
             S101 => ("101", S101_Message'Access),
             S200 => ("200", S200_Message'Access),
             S201 => ("201", S201_Message'Access),
             S202 => ("202", S202_Message'Access),
             S203 => ("203", S203_Message'Access),
       ...
    
    -------------------------------------------------------------------------
    
    Pascal.
    
    -- 
    
    --|------------------------------------------------------
    --| Pascal Obry                           Team-Ada Member
    --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
    --|------------------------------------------------------
    --|         http://perso.wanadoo.fr/pascal.obry
    --|
    --| "The best way to travel is by means of imagination"
    
    
    
    ^ permalink raw reply	[flat|nested] 40+ messages in thread
  • [parent not found: <3A3445A8.8FC404D5@acm.org>]
  • * Re: constant string array
           [not found] <910u3p$v9j$1@nnrp1.deja.com>
                       ` (2 preceding siblings ...)
           [not found] ` <3A3445A8.8FC404D5@acm.org>
    @ 2000-12-15 18:41 ` Freelancer
      3 siblings, 0 replies; 40+ messages in thread
    From: Freelancer @ 2000-12-15 18:41 UTC (permalink / raw)
    
    
    
    We went from constant string array to a debate on parens.
    
    Interesting.
    
    The use of unnecessary parens is a biohazard to everyone!!
    (Kill the junk) or else (its putrid state will gather foul bacteria in thy
    nose!)
    
    
    Personally I think that a good comment should precede a complicated
    statement. That should be enough for the reader. The rest is more of a
    preference varying from one programmer to the other. So the reader should
    have the ability to adapt himself. (Always to a certain extent)...
    
    
    What's your extent?
    
    
    
    
    
    
    ^ permalink raw reply	[flat|nested] 40+ messages in thread

  • end of thread, other threads:[~2000-12-17  8:24 UTC | newest]
    
    Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <910u3p$v9j$1@nnrp1.deja.com>
         [not found] ` <slrn9383g6.coa.randhol+abuse@kiuk0156.chembio.ntnu.no>
         [not found]   ` <9138e5$o6a$1@nnrp1.deja.com>
    2000-12-11 19:34     ` constant string array Robert Dewar
    2000-12-11 21:41 ` Pascal Obry
    2000-12-12  2:54   ` Robert Dewar
    2000-12-12  2:56   ` Robert Dewar
         [not found] ` <3A3445A8.8FC404D5@acm.org>
         [not found]   ` <912ut9$fga$1@nnrp1.deja.com>
         [not found]     ` <9132ng$j10$1@nnrp1.deja.com>
    2000-12-11 19:39       ` Robert Dewar
    2000-12-12  2:31     ` Ken Garlington
    2000-12-12  2:53       ` Robert Dewar
    2000-12-12  4:39         ` Ken Garlington
    2000-12-12  4:56     ` Jeff Carter
    2000-12-12 20:57       ` Beard, Frank
    2000-12-12 23:05         ` Jeff Carter
    2000-12-13  0:37           ` Robert Dewar
    2000-12-13  0:36         ` Robert Dewar
    2000-12-13  0:39         ` Robert Dewar
    2000-12-13  2:02           ` Beard, Frank
    2000-12-13  2:33             ` Robert Dewar
    2000-12-13  2:55               ` Beard, Frank
    2000-12-13  4:00                 ` Ken Garlington
    2000-12-13 13:38                   ` Bad coding standards Marc A. Criley
    2000-12-13 13:54                     ` Ken Garlington
    2000-12-13 20:55                     ` David Emery
    2000-12-14 13:07                       ` Robert Dewar
    2000-12-14 14:21                         ` Ken Garlington
    2000-12-15  0:08                           ` Wayne Magor
    2000-12-15  1:40                             ` Ken Garlington
    2000-12-15  3:18                         ` DuckE
    2000-12-15  4:45                           ` Ed Falis
    2000-12-15 15:44                           ` Robert C. Leif, Ph.D.
    2000-12-15 16:34                             ` Ted Dennison
    2000-12-16  6:08                               ` Robert C. Leif, Ph.D.
    2000-12-16  1:16                             ` Robert Dewar
    2000-12-16  1:19                             ` Robert Dewar
    2000-12-17  5:49                               ` Robert C. Leif, Ph.D.
    2000-12-17  8:24                                 ` Robert Dewar
    2000-12-15 15:56                       ` Charles H. Sampson
    2000-12-15 20:43                         ` Wayne Lydecker
    2000-12-16  4:31                           ` Ken Garlington
    2000-12-16 11:36                           ` Robert Dewar
    2000-12-15 21:36                         ` tmoran
    2000-12-15 18:41 ` constant string array Freelancer
    

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