* How to get this space away? @ 2015-06-02 20:32 Laurent 2015-06-02 20:53 ` Simon Wright ` (3 more replies) 0 siblings, 4 replies; 20+ messages in thread From: Laurent @ 2015-06-02 20:32 UTC (permalink / raw) Hi My little program is slowly generating something which looks like the communication file I need. The only problem is that if the values I use are of the type integer I get a leading space I don't want/need. I have no idea where it comes from or how to get rid of it in this case. Standart Integer_IO would be Width=>0 and problem solved but here? rtAST-N237|rr 12345678|t1 1|o1strpne|ra|a1am|a3<=2|a4+| ^-------------^ The function which generates this string: -------------- -- To_BCI -- -------------- function To_BCI (Item : Carte) return V_String.Bounded_String is V_Antibiotiques : V_String.Bounded_String; V_Carte : V_String.Bounded_String; V_Germe : V_String.Bounded_String; use V_String; begin -- generates the |rr 12345678 par; Lot is a Positive V_Carte := ((+"|ta|rt") & (+Item.Code_SIL) & (+"|rr") & (+Item.Lot'Img)); -- generates the |t1 1|o1strpne part V_Germe := Germes.IO.To_BCI (Item.Germe); V_String.Append(Source => V_Carte,New_Item => V_Germe); for Counter in 1 .. Item.Anti_Counter loop V_Antibiotiques := Antibiotiques.IO.To_BCI (Item.Antibiotiques (Counter)); V_String.Append (Source => V_Carte, New_Item => V_Antibiotiques); end loop; return V_Carte; end To_BCI; Thanks Laurent ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 20:32 How to get this space away? Laurent @ 2015-06-02 20:53 ` Simon Wright 2015-06-03 18:59 ` Laurent 2015-06-02 22:28 ` Jeffrey R. Carter ` (2 subsequent siblings) 3 siblings, 1 reply; 20+ messages in thread From: Simon Wright @ 2015-06-02 20:53 UTC (permalink / raw) Laurent <daemon2@internet.lu> writes: > The only problem is that if the values I use are of the type integer I > get a leading space I don't want/need. I have no idea where it comes > from or how to get rid of it in this case. You've used Foo'Img, which here is the same as Integer'Image (Foo), and which always, unavoidably, provides a leading space for positive numbers. You've provided something like function "+" (R : String) return Bounded_String renames To_Bounded_String; and instead you need to provide something like function "+" (R : String) return Bounded_String is begin return To_Bounded_String (Ada.Strings.Fixed.Trim (R, Ada.Strings.Both)); end "+"; ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 20:53 ` Simon Wright @ 2015-06-03 18:59 ` Laurent 2015-06-03 19:30 ` Simon Wright 0 siblings, 1 reply; 20+ messages in thread From: Laurent @ 2015-06-03 18:59 UTC (permalink / raw) On Tuesday, June 2, 2015 at 10:53:30 PM UTC+2, Simon Wright wrote: > and instead you need to provide something like > > function "+" (R : String) return Bounded_String is > begin > return To_Bounded_String > (Ada.Strings.Fixed.Trim (R, Ada.Strings.Both)); > end "+"; Thanks that works. Just don't understand the detour via fixed strings and the Ada.Strings.Both Laurent ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 18:59 ` Laurent @ 2015-06-03 19:30 ` Simon Wright 0 siblings, 0 replies; 20+ messages in thread From: Simon Wright @ 2015-06-03 19:30 UTC (permalink / raw) Laurent <daemon2@internet.lu> writes: > On Tuesday, June 2, 2015 at 10:53:30 PM UTC+2, Simon Wright wrote: > >> and instead you need to provide something like >> >> function "+" (R : String) return Bounded_String is >> begin >> return To_Bounded_String >> (Ada.Strings.Fixed.Trim (R, Ada.Strings.Both)); >> end "+"; > > Thanks that works. Just don't understand the detour via fixed strings > and the Ada.Strings.Both R is a fixed-length string, so the corresponding string operations are in Ada.Strings.Fixed. For Ada.Strings.Fixed.Trim see ARM A.4.3(89) [1]. There are also Trims for Bounded and Unbounded strings, which is why Both is declared in Ada.Strings. I think trimming the fixed string R to start with may well be the more efficient, but I haven't checked. [1] http://www.ada-auth.org/standards/12rm/html/RM-A-4-3.html#p89 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 20:32 How to get this space away? Laurent 2015-06-02 20:53 ` Simon Wright @ 2015-06-02 22:28 ` Jeffrey R. Carter 2015-06-03 19:07 ` Laurent 2015-06-03 7:28 ` Dmitry A. Kazakov 2015-06-08 22:43 ` wowwomenonwheels205 3 siblings, 1 reply; 20+ messages in thread From: Jeffrey R. Carter @ 2015-06-02 22:28 UTC (permalink / raw) On 06/02/2015 01:32 PM, Laurent wrote: > > rtAST-N237|rr 12345678|t1 1|o1strpne|ra|a1am|a3<=2|a4+| > ^-------------^ > The function which generates this string: > > -------------- > -- To_BCI -- > -------------- > function To_BCI (Item : Carte) return V_String.Bounded_String is > V_Antibiotiques : V_String.Bounded_String; > V_Carte : V_String.Bounded_String; > V_Germe : V_String.Bounded_String; > use V_String; > begin > > -- generates the |rr 12345678 par; Lot is a Positive > V_Carte := ((+"|ta|rt") & (+Item.Code_SIL) & (+"|rr") & (+Item.Lot'Img)); 'Img is GNAT-specific attribute that is equivalent for T'Image (Object), where T is the type of Object. Since you say Lot is a Positive, that means Item.Lot'Img is equivalent to Integer'Image (Item.Lot). 'Image always adds a leading space for a non-negative value. Nobody seems to like it, but the ARG won't change it. You can get rid of the space yourself, or you could use something like PragmARC.Images that gives you control over width, base, and zero filling. The PragmAda Reusable Components are available from https://pragmada.x10hosting.com/pragmarc.htm -- Jeff Carter "Frankie Wolf, wanted by Federal authorities for dancing with a mailman." Take the Money and Run 143 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 22:28 ` Jeffrey R. Carter @ 2015-06-03 19:07 ` Laurent 2015-06-03 20:50 ` J-P. Rosen 0 siblings, 1 reply; 20+ messages in thread From: Laurent @ 2015-06-03 19:07 UTC (permalink / raw) On Wednesday, June 3, 2015 at 12:28:34 AM UTC+2, Jeffrey R. Carter wrote: >'Image always adds a leading space > for a non-negative value. Nobody seems to like it, but the ARG won't change it. Does the ARG give a reason for not wanting to change it? Does that mean that in the case of a negative value you have to add it yourself? Doesn't really make sense. > You can get rid of the space yourself, Hm no. Then I don't need to write a program. I could then as well murdoch the file from the analyzer's pc and toy around with it. But then I don't need to spend time trying to learn/understand programming. > or you could use something like > PragmARC.Images that gives you control over width, base, and zero filling. > > The PragmAda Reusable Components are available from > > https://pragmada.x10hosting.com/pragmarc.htm Thanks. I have downloaded it. Will take a look at it when time permits. Laurent ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 19:07 ` Laurent @ 2015-06-03 20:50 ` J-P. Rosen 2015-06-03 23:00 ` Randy Brukardt ` (2 more replies) 0 siblings, 3 replies; 20+ messages in thread From: J-P. Rosen @ 2015-06-03 20:50 UTC (permalink / raw) Le 03/06/2015 21:07, Laurent a écrit : > On Wednesday, June 3, 2015 at 12:28:34 AM UTC+2, Jeffrey R. Carter wrote: > >> >'Image always adds a leading space >> > for a non-negative value. Nobody seems to like it, but the ARG won't change it. > Does the ARG give a reason for not wanting to change it? Does that mean that in the > case of a negative value you have to add it yourself? Doesn't really make sense. > This dates back to Ada83. The initial idea was that a positive number and its opposite (negative) number should have the same number of characters. Forcing a '+' to all positive number would not have been pretty, so the design team chose to put a space for positive numbers (negative numbers just have an initial '-'). At first, it looked like a good idea, especially since 'Image was not intended to be used extensively, but just for debugging purposes. For IOs, people are supposed to use Text_IO, which provides all the desired formatting. In practice, it turned out to be a bad idea, and lots of programs have some functions to remove the initial space - and now, changing that would break all these programs. And the ARG is very picky about upward compatibility. The only possibility would be to define a new attribute. Small effort, small value. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 20:50 ` J-P. Rosen @ 2015-06-03 23:00 ` Randy Brukardt 2015-06-05 9:26 ` Stephen Davies 2015-06-08 12:33 ` Brad Moore 2015-06-04 9:37 ` Georg Bauhaus 2015-06-05 13:02 ` Laurent 2 siblings, 2 replies; 20+ messages in thread From: Randy Brukardt @ 2015-06-03 23:00 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2216 bytes --] "J-P. Rosen" <rosen@adalog.fr> wrote in message news:mknp7j$4s1$1@dont-email.me... > Le 03/06/2015 21:07, Laurent a écrit : >> On Wednesday, June 3, 2015 at 12:28:34 AM UTC+2, Jeffrey R. Carter wrote: >> >>> >'Image always adds a leading space >>> > for a non-negative value. Nobody seems to like it, but the ARG won't >>> > change it. >> Does the ARG give a reason for not wanting to change it? Does that mean >> that in the >> case of a negative value you have to add it yourself? Doesn't really make >> sense. >> > This dates back to Ada83. The initial idea was that a positive number > and its opposite (negative) number should have the same number of > characters. Forcing a '+' to all positive number would not have been > pretty, so the design team chose to put a space for positive numbers > (negative numbers just have an initial '-'). > > At first, it looked like a good idea, especially since 'Image was not > intended to be used extensively, but just for debugging purposes. For > IOs, people are supposed to use Text_IO, which provides all the desired > formatting. In practice, it turned out to be a bad idea, and lots of > programs have some functions to remove the initial space - and now, > changing that would break all these programs. And the ARG is very picky > about upward compatibility. "all these programs" should be "most of these programs". Programs using Trim, as Jeff suggested, won't break. But my code does a lot of this: declare Img : constant String := Natural'Image(Something); begin Log ("Something out of range; Something=" & Img(2..Img'Last)); end; and that would break horribly if the space was removed. The upcoming Corrigendum adds Obj'Image (The GNAT 'Img is used so much that it seems silly to not make it part of the standard); we spent a few minutes discussing that leading space, but eventually we decided that taking it out would be just as confusing (to experts) as leaving it in is (to novices). > The only possibility would be to define a new attribute. Small effort, > small value. Right, and the effort (in the Standard and especially for implementers) probably outweights the value. Randy. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 23:00 ` Randy Brukardt @ 2015-06-05 9:26 ` Stephen Davies 2015-06-08 12:33 ` Brad Moore 1 sibling, 0 replies; 20+ messages in thread From: Stephen Davies @ 2015-06-05 9:26 UTC (permalink / raw) On Thursday, 4 June 2015 00:00:56 UTC+1, Randy Brukardt wrote: > "J-P. Rosen" wrote in message > > This dates back to Ada83. The initial idea was that a positive number > > and its opposite (negative) number should have the same number of > > characters. Forcing a '+' to all positive number would not have been > > pretty, so the design team chose to put a space for positive numbers > > (negative numbers just have an initial '-'). > > > > At first, it looked like a good idea, especially since 'Image was not > > intended to be used extensively, but just for debugging purposes. For > > IOs, people are supposed to use Text_IO, which provides all the desired > > formatting. In practice, it turned out to be a bad idea, and lots of > > programs have some functions to remove the initial space - and now, > > changing that would break all these programs. And the ARG is very picky > > about upward compatibility. > > "all these programs" should be "most of these programs". Programs using > Trim, as Jeff suggested, won't break. > > But my code does a lot of this: > > declare > Img : constant String := Natural'Image(Something); > begin > Log ("Something out of range; Something=" & Img(2..Img'Last)); > end; > > and that would break horribly if the space was removed. > > The upcoming Corrigendum adds Obj'Image (The GNAT 'Img is used so much that > it seems silly to not make it part of the standard); we spent a few minutes > discussing that leading space, but eventually we decided that taking it out > would be just as confusing (to experts) as leaving it in is (to novices). > > > The only possibility would be to define a new attribute. Small effort, > > small value. > > Right, and the effort (in the Standard and especially for implementers) > probably outweights the value. I think that probably almost every Ada programmer has had to work around the leading space from 'Image at some point. Would it really be that hard to add one of the following to either overload or replace it, respectively? function S'Image (Arg : S'Base; Width : Natural) return String function S'Image (Arg : S'Base; Width : Integer := -1) return String ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 23:00 ` Randy Brukardt 2015-06-05 9:26 ` Stephen Davies @ 2015-06-08 12:33 ` Brad Moore 2015-06-08 19:47 ` Randy Brukardt 1 sibling, 1 reply; 20+ messages in thread From: Brad Moore @ 2015-06-08 12:33 UTC (permalink / raw) On 2015-06-03 05:00 PM, Randy Brukardt wrote: > "J-P. Rosen" <rosen@adalog.fr> wrote in message > news:mknp7j$4s1$1@dont-email.me... >> Le 03/06/2015 21:07, Laurent a écrit : >>> On Wednesday, June 3, 2015 at 12:28:34 AM UTC+2, Jeffrey R. Carter wrote: >>> >>>>> 'Image always adds a leading space >>>>> for a non-negative value. Nobody seems to like it, but the ARG won't >>>>> change it. >>> Does the ARG give a reason for not wanting to change it? Does that mean >>> that in the >>> case of a negative value you have to add it yourself? Doesn't really make >>> sense. >>> >> This dates back to Ada83. The initial idea was that a positive number >> and its opposite (negative) number should have the same number of >> characters. Forcing a '+' to all positive number would not have been >> pretty, so the design team chose to put a space for positive numbers >> (negative numbers just have an initial '-'). Note that this behaviour was further reinforced in Ada95, when modular types were introduced. However, in this case, the explanation doesn't quite work, since modular types are never negative, and thus also should rarely need to be seen with a '+' sign either. I suspect the leading space was kept for consistency with signed types in this case. >> >> At first, it looked like a good idea, especially since 'Image was not >> intended to be used extensively, but just for debugging purposes. For >> IOs, people are supposed to use Text_IO, which provides all the desired >> formatting. In practice, it turned out to be a bad idea, and lots of >> programs have some functions to remove the initial space - and now, >> changing that would break all these programs. And the ARG is very picky >> about upward compatibility. > > "all these programs" should be "most of these programs". Programs using > Trim, as Jeff suggested, won't break. > > But my code does a lot of this: > > declare > Img : constant String := Natural'Image(Something); > begin > Log ("Something out of range; Something=" & Img(2..Img'Last)); > end; > > and that would break horribly if the space was removed. > > The upcoming Corrigendum adds Obj'Image (The GNAT 'Img is used so much that > it seems silly to not make it part of the standard); we spent a few minutes > discussing that leading space, but eventually we decided that taking it out > would be just as confusing (to experts) as leaving it in is (to novices). > >> The only possibility would be to define a new attribute. Small effort, >> small value. I think another possibility would be to define an aspect which could be applied to a subtype. eg. subtype My_Positive is Positive with Short_Image; The implication would be that the Short_Image aspect cause 'Image to eliminate the leading space for that subtype. If this is workable, it strikes me as being easier to fit into the language than introducing another attribute. > > Right, and the effort (in the Standard and especially for implementers) > probably outweights the value. Try formatting 4 unsigned byte values as an quad dot IP address string, for example. Something that can be easily expressed in another language such as C in one line of code is very awkward and ugly to write in Ada. Brad ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-08 12:33 ` Brad Moore @ 2015-06-08 19:47 ` Randy Brukardt 2015-06-08 20:25 ` Jeffrey R. Carter 0 siblings, 1 reply; 20+ messages in thread From: Randy Brukardt @ 2015-06-08 19:47 UTC (permalink / raw) "Brad Moore" <brad.moore@shaw.ca> wrote in message news:BYfdx.40257$ic6.28837@fx17.iad... > On 2015-06-03 05:00 PM, Randy Brukardt wrote: ... >> Right, and the effort (in the Standard and especially for implementers) >> probably outweights the value. > > Try formatting 4 unsigned byte values as an quad dot IP address string, > for example. > Something that can be easily expressed in another language such as C in > one line of code is very awkward and ugly to write in Ada. It's not *that* awkward. Since 'Image has to return a string that 'First = 1, the following works fine (7 lines, well-formatted, could be less - assuming the parts are declared as bytes appropriately as they are in Claw.Sockets): declare A_Img : constant String := Byte'Image(IP.A); B_Img : constant String := Byte'Image(IP.B); C_Img : constant String := Byte'Image(IP.C); D_Img : constant String := Byte'Image(IP.D); begin Put (A_Img(2..A_Img'Last) & '.' & B_Img(2..B_Img'Last) & '.' & C_Img(2..C_Img'Last) & '.' & C_Img(2..C_Img'Last); end; And of course such a thing should be a subprogram (in any language) because you're going to use it enough (at least for debugging) that repeating it is silly. Now, if you prefer to have each part to take up three characters with leading zeros except for the first (so they're all the same length) -- that'll take a bit more than a handful of lines in Ada. Ada's formatting is primitive, except in the rarely thought of Annex F (does anyone use that?). Randy. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-08 19:47 ` Randy Brukardt @ 2015-06-08 20:25 ` Jeffrey R. Carter 2015-06-09 14:38 ` Brad Moore 0 siblings, 1 reply; 20+ messages in thread From: Jeffrey R. Carter @ 2015-06-08 20:25 UTC (permalink / raw) On 06/08/2015 12:47 PM, Randy Brukardt wrote: > > declare > A_Img : constant String := Byte'Image(IP.A); > B_Img : constant String := Byte'Image(IP.B); > C_Img : constant String := Byte'Image(IP.C); > D_Img : constant String := Byte'Image(IP.D); > begin > Put (A_Img(2..A_Img'Last) & '.' & B_Img(2..B_Img'Last) & '.' & > C_Img(2..C_Img'Last) & '.' & C_Img(2..C_Img'Last); > end; I think you have C_Img in there twice. > Now, if you prefer to have each part to take up three characters with > leading zeros except for the first (so they're all the same length) -- > that'll take a bit more than a handful of lines in Ada. Ada's formatting is > primitive, except in the rarely thought of Annex F (does anyone use that?). Presuming that "except for the first" means that IP.A should take up the minimum number of characters, as above: declare function Image is new PragmARC.Images.Modular_Image (Number => Byte); begin Put (Image (IP.A) & '.' & Image (IP.B, Width => 3, Zero_Filled => True) & '.' & Image (IP.C, Width => 3, Zero_Filled => True) & '.' & Image (IP.D, Width => 3, Zero_Filled => True) ); end; And if you want IP.A to be 3 characters, zero filled, that's easy, too. -- Jeff Carter "This scene's supposed to be in a saloon, but the censor cut it out. It'll play just as well this way." [in a soda fountain] Never Give a Sucker an Even Break 113 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-08 20:25 ` Jeffrey R. Carter @ 2015-06-09 14:38 ` Brad Moore 0 siblings, 0 replies; 20+ messages in thread From: Brad Moore @ 2015-06-09 14:38 UTC (permalink / raw) On 2015-06-08 02:25 PM, Jeffrey R. Carter wrote: > On 06/08/2015 12:47 PM, Randy Brukardt wrote: >> >> declare >> A_Img : constant String := Byte'Image(IP.A); >> B_Img : constant String := Byte'Image(IP.B); >> C_Img : constant String := Byte'Image(IP.C); >> D_Img : constant String := Byte'Image(IP.D); >> begin >> Put (A_Img(2..A_Img'Last) & '.' & B_Img(2..B_Img'Last) & '.' & >> C_Img(2..C_Img'Last) & '.' & C_Img(2..C_Img'Last); >> end; The version I was thinking of was Put (Strings.Fixed.Trim (Source => Byte'Image (IP(1)), Side => Strings.Left) & '.' & Strings.Fixed.Trim (Source => Byte'Image (IP(2)), Side => Strings.Left) & '.' & Strings.Fixed.Trim (Source => Byte'Image (IP(3)), Side => Strings.Left) & '.' & Strings.Fixed.Trim (Byte'Image (IP(4)), Side => Strings.Left)); Which is not that different in terms of readability. A difference is that Randy's version required 4 declarations, where this version can be written as an expression without any declarations. I agree that for an IP Address one would probably want to encapsulate the code in a library function. But for more general cases, sometimes you need to construct similar output on the fly, and it is awkward to have to write a function every time you want to do that. It would have been quite a bit nicer to be able to write: Put (Byte'Image (IP(1)) & '.' & Byte'Image (IP(2)) & '.' & Byte'Image (IP(3)) & '.' & Byte'Image (IP(4)); But then if one wants zero padding, perhaps extending Text_IO to add some sort of Text_IO control would be helpful, as in; Put (Byte'Image (IP(1)) & '.' & Text_IO.Pad('0') & Text_IO.Width(3) & Byte'Image (IP(2)) & '.' & Byte'Image (IP(3)) & '.' & Byte'Image (IP(4)); > > I think you have C_Img in there twice. > >> Now, if you prefer to have each part to take up three characters with >> leading zeros except for the first (so they're all the same length) -- >> that'll take a bit more than a handful of lines in Ada. Ada's formatting is >> primitive, except in the rarely thought of Annex F (does anyone use that?). > > Presuming that "except for the first" means that IP.A should take up the minimum > number of characters, as above: > > declare > function Image is new PragmARC.Images.Modular_Image (Number => Byte); > begin > Put (Image (IP.A) & '.' & > Image (IP.B, Width => 3, Zero_Filled => True) & '.' & > Image (IP.C, Width => 3, Zero_Filled => True) & '.' & > Image (IP.D, Width => 3, Zero_Filled => True) ); > end; > > And if you want IP.A to be 3 characters, zero filled, that's easy, too. > Yes, one could write their own routing or use a third party library such as this, but it strikes me that such a capability should be built into the language. Maybe the best answer is to standardize such a routine. I'm thinking it could fit nicely into Ada.Strings.Fixed. Brad ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 20:50 ` J-P. Rosen 2015-06-03 23:00 ` Randy Brukardt @ 2015-06-04 9:37 ` Georg Bauhaus 2015-06-04 12:32 ` Dmitry A. Kazakov 2015-06-05 13:02 ` Laurent 2 siblings, 1 reply; 20+ messages in thread From: Georg Bauhaus @ 2015-06-04 9:37 UTC (permalink / raw) On 03.06.15 22:50, J-P. Rosen wrote: > Le 03/06/2015 21:07, Laurent a écrit : >> On Wednesday, June 3, 2015 at 12:28:34 AM UTC+2, Jeffrey R. Carter wrote: >> >>>> 'Image always adds a leading space > > This dates back to Ada83. The initial idea was that a positive number > and its opposite (negative) number should have the same number of > characters. Since 'Image and 'Width go together, would there be a choice? > In practice, it turned out to be a bad idea, (...) > The only possibility would be to define a new attribute. Small effort, > small value. Ada could stop supporting 'Image entirely, and instead create Annex F.4, Edited Output for Integer Types If 'Image was intended for debugging purposes, It is quite obvious that 'Image keeps being misused. But: I/O is what we are payed for. I/O is the raison d'être of programming. So, please, stop helping programmers evade proper I/O. So many languages have made everyone suffer from poorly defined I/O facilities, in effect making everyone use I/O facilities developed "for teaching", or, in case of Ada, for debugging. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-04 9:37 ` Georg Bauhaus @ 2015-06-04 12:32 ` Dmitry A. Kazakov 0 siblings, 0 replies; 20+ messages in thread From: Dmitry A. Kazakov @ 2015-06-04 12:32 UTC (permalink / raw) On Thu, 04 Jun 2015 11:37:41 +0200, Georg Bauhaus wrote: > Ada could stop supporting 'Image entirely, and instead create > > Annex F.4, Edited Output for Integer Types > > If 'Image was intended for debugging purposes, It is quite obvious > that 'Image keeps being misused. But: > > I/O is what we are payed for. > I/O is the raison d'être of programming. > > So, please, stop helping programmers evade proper I/O. There are two use cases actually. Output is one, conversion is another. There must be always four operations: Get, Value, Put, Image Note also that there is a second important player here, the container type. When you compare 'Image with output you do apples and oranges. The container for 'Image is String. The container for Put is File_Type. They are not same. Granted 'Image returning a new file would be useless, but still. Output into a String is a hell how useful. BTW, the container for the 'Output attribute is a stream, and you would need one for Stream_Element_Array as well. As you see it is much more rich than you wrote. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 20:50 ` J-P. Rosen 2015-06-03 23:00 ` Randy Brukardt 2015-06-04 9:37 ` Georg Bauhaus @ 2015-06-05 13:02 ` Laurent 2015-06-06 0:02 ` Dennis Lee Bieber 2 siblings, 1 reply; 20+ messages in thread From: Laurent @ 2015-06-05 13:02 UTC (permalink / raw) On Wednesday, June 3, 2015 at 10:50:07 PM UTC+2, J-P. Rosen wrote: > This dates back to Ada83. The initial idea was that a positive number > and its opposite (negative) number should have the same number of > characters. Forcing a '+' to all positive number would not have been > pretty, so the design team chose to put a space for positive numbers > (negative numbers just have an initial '-'). I won't argue about the ARG's wisdom or their choices but for me it still doesn't make sense. If I want to display a number (positive or negative, int, float, or whatever) in a string I always want it to be separated by a space. But then using the I/O package I have the choice to do so. The 'img looks in this case only 1/2 finished. Remembers me the solutions that my boss and his followers develop: Don't solve the original problem, "just" add more crap around and have the personal get along with it. Oh your car has no breaks, well you "just"can use your feet to stop. I was actually using 'Img because it was rather convenient to do the output in one line. I have now added a procedure which written the results directly to the file. Prefer this way than reserving memory for something I don't need. Not that I need to pay attention to this but it simply doesn't feel right. Thanks Laurent ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-05 13:02 ` Laurent @ 2015-06-06 0:02 ` Dennis Lee Bieber 0 siblings, 0 replies; 20+ messages in thread From: Dennis Lee Bieber @ 2015-06-06 0:02 UTC (permalink / raw) On Fri, 5 Jun 2015 06:02:35 -0700 (PDT), Laurent <daemon2@internet.lu> declaimed the following: >On Wednesday, June 3, 2015 at 10:50:07 PM UTC+2, J-P. Rosen wrote: > >> This dates back to Ada83. The initial idea was that a positive number >> and its opposite (negative) number should have the same number of >> characters. Forcing a '+' to all positive number would not have been >> pretty, so the design team chose to put a space for positive numbers >> (negative numbers just have an initial '-'). > >I won't argue about the ARG's wisdom or their choices but for me it still >doesn't make sense. If I want to display a number (positive or negative, int, > float, or whatever) in a string I always want it to be separated by a space. I suspect it is a carryover from pretty much most of the ancestral languages. All the ones I learned on use one position for the sign, and tend to suppress the "+" by using a space character. Granted those were formatted output conversions, not generic "print" conversions. Nor where they modern scripting type languages. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/ ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 20:32 How to get this space away? Laurent 2015-06-02 20:53 ` Simon Wright 2015-06-02 22:28 ` Jeffrey R. Carter @ 2015-06-03 7:28 ` Dmitry A. Kazakov 2015-06-03 19:19 ` Laurent 2015-06-08 22:43 ` wowwomenonwheels205 3 siblings, 1 reply; 20+ messages in thread From: Dmitry A. Kazakov @ 2015-06-03 7:28 UTC (permalink / raw) On Tue, 2 Jun 2015 13:32:42 -0700 (PDT), Laurent wrote: > My little program is slowly generating something which looks like the > communication file I need. How long are the strings involved? Your code does a lot of shuffling strings here and there when strings are return values. GNAT wasn't very good at optimizations of this kind, last time I looked. That is increasingly inefficient with long strings. You could consider doing string formatting in-place. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-03 7:28 ` Dmitry A. Kazakov @ 2015-06-03 19:19 ` Laurent 0 siblings, 0 replies; 20+ messages in thread From: Laurent @ 2015-06-03 19:19 UTC (permalink / raw) On Wednesday, June 3, 2015 at 9:28:26 AM UTC+2, Dmitry A. Kazakov wrote: > My little program is slowly generating something which looks like the > communication file I need. With this sentence I actually tried to say that it took me quite some time/effort to get to the point that my program is doing what I want it to do. Not always a good idea to translate sentences from ones native language into someone else. > How long are the strings involved? Your code does a lot of shuffling > strings here and there when strings are return values. GNAT wasn't very > good at optimizations of this kind, last time I looked. That is > increasingly inefficient with long strings. You could consider doing string > formatting in-place. I had to increase the length of the V_String to 512 so that the desired final string fits. Just stupid that I use the same V_string to store the SIL_Code and a few other things which are only 6 chars long. Not very efficient. I could as well immediately write the values into the text file instead of glueing everything together and then writing it. The program itself is fast. After hitting enter in the terminal the result appears instantly. Before that it has to read the configuration from 3 different files, put it in the corresponding arrays and do some other operations before it actually generates the string with the result. Thanks Laurent ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: How to get this space away? 2015-06-02 20:32 How to get this space away? Laurent ` (2 preceding siblings ...) 2015-06-03 7:28 ` Dmitry A. Kazakov @ 2015-06-08 22:43 ` wowwomenonwheels205 3 siblings, 0 replies; 20+ messages in thread From: wowwomenonwheels205 @ 2015-06-08 22:43 UTC (permalink / raw) Postal Lottery: Turn $6 into $60,000 in 90 days, GUARANTEED I found this in a news group and decided to try it. A little while back, I was browsing through newsgroups, just like you are now and came across a message just like this that said you could make thousands of dollars within weeks with only an initial investment of $6.00!!! So I thought yeah right, this must be a scam!!! But like most of us, I was curious, so I kept reading. Anyway, it said that you send $1.00 to each of the 6 names and addresses stated in the message. You then place your own name and address at the bottom of the list at #6 and post the message in at least 200 news groups. (There are thousands to choose from). No catch, that was it. So after thinking it over, and talking to a few people first. I thought about trying it. I figured, what have I got to lose except 6 stamps and $6.00, right? So I invested the measly $6.00!!! Guess what? Within 7 days I started getting money in the mail!!! I was shocked!!! I figured it would end soon, but the money just kept coming in!!! In my first week, I had made about $25.00. By the end of the second week, I had made a total of over $1,000.00!!! In the third week, I had over $10,000.00 and it is still growing!!! This is now my fourth week and I have made a total of just over $42,000.00 and it is still coming in rapidly!!! It's certainly worth $6.00 and 6 stamps!!! I have spent more than that on the lottery!!! Let me tell you how this works and most importantly, why it works!!! Also, make sure you print a copy of this message now. So you can get the information off of it as you need it. I promise you that if you follow the directions exactly, that you will start making more money than you thought possible by doing something so easy!!! Suggestion: Read this entire message carefully!!! (Print it out or download it.) Follow the simple directions and watch the money come in!!! It's easy!!! It's legal!!! Your investment is only $6.00 (plus postage). IMPORTANT: This is not a rip-off!!! It is not illegal!!! ? It is almost entirely risk free and it really works!!! If all of the following instructions are adhered to, you will receive extraordinary dividends!!! Please note: Follow these directions EXACTLY, and $60,000.00 or more can be yours in 20 to 90 days!!! This program remains successful because of the honesty and the integrity of the participants!!! Please continue its success by carefully adhering to the instructions. You will now become part of the mail order business. In this business your product is not solid or tangible, it is a service. You are in the business of developing mailing lists. Many large corporations are happy to pay big bucks for quality lists. However, the money made from a mailing list is secondary to the income which is made from people like you and me asking to be included on your mailing list!!! Here are the 4 easy steps to success:- Step 1:- Get 6 separate pieces of paper and write the following on each piece of paper. PLEASE PUT ME ON YOUR MAILING LIST Now get 6 U.S. dollar bills and place ONE inside each of the 6 pieces of paper so the bills will not be seen through the envelopes (to prevent mail theft). Next, place one paper in each of the 6 envelopes and seal them, you should now have 6 sealed envelopes. Each with a piece of paper stating the above phrase, your name and address, and a $1.00 bill. THIS IS ABSOLUTELY LEGAL!!! YOU ARE REQUESTING A LEGITIMATE SERVICE AND YOU ARE PAYING FOR IT!!! Like most of us, I was a little skeptical and a little worried about the legal aspect of it all. So I checked it out with the U.S. Postal Service and they confirmed that it is indeed legal!!! Mail the 6 envelopes to the following addresses:- D. Kumar Room 2.36 Burkhardt House Oxford Place, Victoria Park M14 5RR Manchester ENGLAND T. Perce 11505 Headley Avenue Cleveland, Oh 44111 T. Beckers Rijksweg 46 6267AH Cadier en Keer The Netherlands J. Eddolls 144 Pursey Drive Bradley Stoke Bristol BS32 8DP United Kingdom Louis Joseph 1933 Highway 35, #104 Wall, NJ 07719 Jesse Quiroz 2845 Franklin #1001 Mesquite, Texas 75150 Step 2:- Now take the #1 name off the list that you see above, move the other names up (6 becomes 5, 5 becomes 4, etc.) and add your name as number 6 on the list. Step 3:- Change anything you need to, but try to keep this message as close to what you see as possible. Now, post your amended message to at least 200 news groups. I think there are close to 24,000 groups!!! All you need is 200, but remember, the more you post, the more money you make!!! This is perfectly legal!! If you have any doubts, refer to Title18 Sec. 1302 & 1341 of the postal lottery laws. Keep a copy of these steps for yourself and whenever you need money, you can use it again. Please remember that this program remains successful because of the honesty and the integrity of the participants and by their carefully adhering to the directions!!! Look at it this way. If you are of integrity, the program will continue and the money that so many others have received will come your way!!! Note: - You may want to retain every name and address sent to you, either on your computer or hard copy and keep the notes people send you. This verifies that you are truly providing a service. Also, it might be a good Idea to wrap the $1 bills in dark paper to reduce the risk of mail theft. So, as each post is downloaded and the directions carefully followed, six members will be reimbursed for their participation as a list developer with one dollar each. Your name will move up the list geometrically so that when your name reaches the #1 position, you will be receiving thousands of dollars in cash!!! What an opportunity for only $6.00!!! ($1.00 for each of the first six people listed above). Send it now, add your own name to the list and your in business!!! DIRECTIONS FOR HOW TO POST TO A NEWS GROUP!!! Step 1:- You do not need to re-type this entire message to do your own posting. Simply put your cursor at the beginning of this message and drag your cursor to the bottom of this message and select copy from the edit menu. This will copy the entire message into the computer memory. Step 2:- Open a blank note pad file and place your cursor at the top of the blank page. From the edit menu select paste. This will paste a copy of the message into notepad so that you can add your name to the list. Step 3:- Save your new notepad file as a txt file. If you want to do your posting in a different setting, you'll always have this file to go back to. Step 4:- Use Netscape or Internet Explorer and try searching for various news groups (on-line forums, message boards, chat sites, discussions, etc.) Step 5:- Visit these message boards and post this message as a new message by highlighting the text of this message from your notepad and selecting paste from the edit menu. Fill in the subject, this will be the header that everybody sees as they scroll through the list of postings in a particular group. Click the post message button. You've done your first one! Congratulations!!! All you have to do is jump to different news groups and post away, after you get the hang of it, it will take about 30 seconds for each news group! REMEMBER, THE MORE NEWS GROUPS YOU POST IN, THE MORE MONEY YOU WILL MAKE!!! (But you have to post a minimum of 200). That's it!!! You will begin receiving money from around the world within days!!! You may eventually want to rent a P.O. Box due to the large amount of mail you will receive. If you wish to stay anonymous, you can invent a name to use, as long as the postman will deliver it. JUST MAKE SURE ALL THE ADDRESSES ARE CORRECT!!! Now the why part. Out of 200 postings, say you receive only 5 replies (a very low example). So then you made $5.00 with your name at #6 on the letter. Now, each of the 5 persons who sent you $1.00 make the minimum 200 postings, each with your name at #5 and only 5 persons respond to each of the original 5, that is another $25.00 for you. Now those 25 each make 200 MINIMUM posts with your name at #4 and only 5 replies each, you will bring in an additional $125.00!!! Now, those 125 persons turn around and post the minimum 200 with your name at #3 and only receive 5 replies each, you will make an additional $625.00!!! OK, now here is the fun part, each of those 625 persons post a minimum 200 messages with your name at #2 and they each only receive 5 replies, that just made you $3,125.00!!! Those 3,125 persons will all deliver this message to 200 news groups. If just 5 more reply you will receive $15,625.00!!! All with an original investment of only $6.00!!! Amazing isn't it!!!! When your name is no longer on the list, you just take the latest posting in the news groups and send out another $6.00 to the names on the list, putting your name at number 6 again. You must realize that thousands of people all over the world are joining the internet and reading these messages every day!!! Just like you are now!!! So, can you afford $6.00 and see if it really works? I'm glad I did!!! People have said, "what if the plan is played out and no one sends you the money?" So what!!! What are the chances of that happening, when there are tons of new honest users and new honest people who are joining the internet and news groups everyday and are willing to give it a try? Estimates are at 20,000 to 50,000 new users, every day!!! REMEMBER PLAY HONESTLY AND FAIRLY AND THIS WILL REALLY WORK!!! -- Comments/Feedback (please post your feedback/experiences here) -- Not bad for 1 hr's work....made me around $5320 in roughly 35 days Anthony M - TX Hello, I rcvd 269 bucks in the post in 2 weeks. Dan Miami - FL I had to wait around 10 days before I had any results - $13,450 as of 3rd Jan 2003 to date (14th Feb 2003).Am gonna re-post it again for more money!! Del from Alberta - Canada Only received around 588 in the post the last 2 months since I started the program but I'd posted to approx. 100 newsgroups. James P - Manchester, UK Cool....didn't expect much out of this "scam" initially but I have pay my credit card bill Mustafa - Jordan For $6,I made $246 in 2 weeks ROMEO2326 - Little Rock, AR -US of A Hey, just droppin a line to say that after posting to well over 820 newsgroups on google and my ISP newsgroup server over a period of 4 1/2 months ,Ive raked in $54280 . Mucho dinero baby!!!! Peace Drew Dallas - TX ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2015-06-09 14:38 UTC | newest] Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-06-02 20:32 How to get this space away? Laurent 2015-06-02 20:53 ` Simon Wright 2015-06-03 18:59 ` Laurent 2015-06-03 19:30 ` Simon Wright 2015-06-02 22:28 ` Jeffrey R. Carter 2015-06-03 19:07 ` Laurent 2015-06-03 20:50 ` J-P. Rosen 2015-06-03 23:00 ` Randy Brukardt 2015-06-05 9:26 ` Stephen Davies 2015-06-08 12:33 ` Brad Moore 2015-06-08 19:47 ` Randy Brukardt 2015-06-08 20:25 ` Jeffrey R. Carter 2015-06-09 14:38 ` Brad Moore 2015-06-04 9:37 ` Georg Bauhaus 2015-06-04 12:32 ` Dmitry A. Kazakov 2015-06-05 13:02 ` Laurent 2015-06-06 0:02 ` Dennis Lee Bieber 2015-06-03 7:28 ` Dmitry A. Kazakov 2015-06-03 19:19 ` Laurent 2015-06-08 22:43 ` wowwomenonwheels205
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox