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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5ca3d5098e21bb51 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: What are the limitations imposed by GNAT without runtime? Reply-To: anon@anon.org (anon) References: <1191947316.791605.8420@50g2000hsm.googlegroups.com> <1192010655.057857.9760@k79g2000hse.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Wed, 10 Oct 2007 17:51:40 GMT NNTP-Posting-Host: 12.64.228.176 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1192038700 12.64.228.176 (Wed, 10 Oct 2007 17:51:40 GMT) NNTP-Posting-Date: Wed, 10 Oct 2007 17:51:40 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:2413 Date: 2007-10-10T17:51:40+00:00 List-Id: Actually, the string names for the type Wah does not exist if you use the "pragma NO_RUN_TIME". The compiler does not generated the code. So in order to do a "type-to-string" conversion you will have to build a function. That actually replaces the function that is use for attribute "IMAGE". And in that function the string names will exist. Just like if you need the IMAGE attribute for a numeric object you will need to build a function to convert that numeric data to a string data. To test this type: "gnat compile kernel.adb -S" Then check the file: "kernel.s" You will see that without the "pragma NO_RUN_TIME" statement there is a data string of "ONETWO" which can be use by IMAGE attribute. But with the pragma the string "ONETWO" is removed as well as the code that uses the data string, so you have to build your own version. Now in my answer I provide an example function based on your type with two objects. If you had a type with more than a couple of objects, then you might want to use an array with the type value as part of the index algorithm to that array. This is one of the problems using the "pragma NO_RUN_TIME ;" statement! Which became obsolescent after GNAT 3.15P . >From the GNAT_RM 3.15P : Implementation Defined Pragmas ****************************** ... `pragma No_Run_Time' Syntax: pragma No_Run_Time; This is a configuration pragma that makes sure the user code does not use nor need anything from the GNAT run time. This is mostly useful in context where code certification is required. Please consult the `GNAT Pro High-Integrity Edition User's Guide' for additional information. Now, from the GCC 4.3 => GNAT_RM : Chapter 14: Obsolescent Features 211 14 Obsolescent Features This chapter describes features that are provided by GNAT, but are considered obsolescent since there are preferred ways of achieving the same effect. These features are provided solely for historical compatibility purposes. 14.1 pragma No Run Time The pragma No_Run_Time is used to achieve an affect similar to the use of the "Zero Foot Print" configurable run time, but without requiring a specially configured run time. The result of using this pragma, which must be used for all units in a partition, is to restrict the use of any language features requiring run-time support code. The preferred usage is to use an appropriately configured run-time that includes just those features that are to be made accessible. <1192010655.057857.9760@k79g2000hse.googlegroups.com>, Lucretia writes: >> procedure Kernel is >> >> type Wah is ( One, Two ) ; >> >> -- ------------------------------------------------ -- >> -- Simple function replaces the Image attribute for -- >> -- Wah type -- >> -- ------------------------------------------------ -- >> function Image_Wah ( V : Wah ) return String is >> >> begin -- Image_Wah >> >> if V = One then >> return "One" ; >> else >> return "Two" ; >> end if ; >> >> end Image_Wah ; > >This isn't much of an option as the compiler already creates the >strings for these in the data section. I'm not sure if these 2 other >strings would be created again or not. > >Luke. >