comp.lang.ada
 help / color / mirror / Atom feed
* Re: how do i include 111111 in an enumaration type ?
       [not found]   ` <slrn80495c.2a2.aidan@skinner.demon.co.uk>
@ 1999-10-11  0:00     ` Keith Thompson
  0 siblings, 0 replies; 14+ messages in thread
From: Keith Thompson @ 1999-10-11  0:00 UTC (permalink / raw)


aidan@skinner.demon.co.uk (Aidan Skinner) writes:
> On Mon, 11 Oct 1999 13:05:39 -0400, Matthew Heaney
> <matthew_heaney@acm.org> wrote: 
> >The latter technique is preferred if you're tempted to use an
> >enumeration rep clause (don't use enum rep clauses).
> 
> Just out of curiosity, why not? I've had a couple of examples where an
> optional number of boolean parameters have been passed to a
> subprogram, and using an enumeration type would clarify things instead
> of having:
> 
>    foo (thingy, doodah => True, wotsit => False);
> 
> it would be 
> 
>    foo (thingy, doodah, no_wotsit);
> 
> obviously doodah and wotsit have default values.

Ok, no problem so far.  (Personally, I find "doodah => True, wotsit =>
False" clearer, but that's a matter of taste and style.  Also, the
default value for doodah doesn't do you any good if you want to pass a
non-default value for wotsit; you have to either specify both, or use
named notation.)

> It would then seem sensible to use a representation clause to turn the
> two value enumeration types to be 1 bit each (or whatever size your
> implementation of boolean or whatever is).

By "enumeration representation clause", we mean specifically the kind
of representation clause that specifies the internal representation of
each literal of an enumeration type.  See section 13.4 of the Ada 95
RM.  The problem is that the language provides no decent way to get at
the representation once you've defined it; the type has to work
(almost) as if the enumeration representation clause weren't there.
We discussed this here a few weeks ago; see deja.com (formerly known
as DejaNews) for details.

There's nothing wrong with using a size clause on an enumeration type:

    type doodah_type is (no_doodah, doodah);
    for doodah_type'size use 1;

if that's what you need.  On the other hand, for the suggested usage,
there's no reason for a size clause.  Let the compiler figure out how
best to represent a doodah_type object.  Specifying a 1-bit size for a
type doesn't mean that objects of that type will be allocated 1 bit --
which is fortunate, because byte-size or word-sized objects make for
much more efficient code.

Most of the time, it's best just to tell the compiler what you want as
clearly as possible, and let if figure out how best to give it to you.
That's its job.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
"Oh my gosh!  You are SO ahead of your time!" -- anon.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
       [not found] <7tsq3o$92p$1@minus.oleane.net>
       [not found] ` <38021792_4@news1.prserv.net>
@ 1999-10-12  0:00 ` Nick Roberts
  1999-10-14  0:00   ` Sybs ALHABSHI
  1 sibling, 1 reply; 14+ messages in thread
From: Nick Roberts @ 1999-10-12  0:00 UTC (permalink / raw)
  To: Sybs ALHABSHI

Sybs ALHABSHI wrote:
> In the enumaration type declaration, the string of caracters 000000 is taken
> as a numerical expression.
> 
> Can anyone explain how  I can get around this ?
> 
>         type webcolor is (FFFFFF, 000000);

Sybs,

I wonder if an enumeration type is what you are looking for here?  Take
a look at the following snippet of code.

   type Monochromatic_Level is mod 256; -- i.e. a byte

   type RGB_Color is
      record
         Red, Green, Blue: Monochromatic_Level;
      end record;

   Absolute_Black: constant RGB_Color := (16#00#, 16#00#, 16#00#);
   Absolute_White: constant RGB_Color := (16#FF#, 16#FF#, 16#FF#);

   function Hex_Image (Level: Monochromatic_Level) return String is
      Digit: constant array (Monochromatic_Level range 0..15) :=
         ('0', '1', '2', '3', '4', '5', '6', '7',
          '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
   begin
      return Digit(Level/16) & Digit(Level mod 16);
   end;

   function Hex_Image (RGB: RGB_Color) return String is
   begin
      return Hex_Image(RGB.Red) &
             Hex_Image(RGB.Green) &
             Hex_Image(RGB.Blue);
   end;

   ...

      Put(Web_File,"<BODY");
      Put(Web_File," bgcolor=#");
      Put(Web_File,Hex_Image(Background_Color));
      Put(Web_File," text=#");
      Put(Web_File,Hex_Image(Text_Color));
      ...

Hope this gives you a few ideas.

-- 
Nick Roberts
Computer Consultant (UK)
http://www.callnetuk.com/home/nickroberts
http://www.adapower.com/lab/adaos




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00   ` Sybs ALHABSHI
  1999-10-12  0:00     ` Lutz Donnerhacke
@ 1999-10-12  0:00     ` Matthew Heaney
  1999-10-12  0:00       ` Ehud Lamm
  1 sibling, 1 reply; 14+ messages in thread
From: Matthew Heaney @ 1999-10-12  0:00 UTC (permalink / raw)


In article <7ttuvt$ssb$1@minus.oleane.net> , "Sybs ALHABSHI" 
<sybs@htsavoie.com> wrote:

> Thanks for the hint. Yet I'll risk asking a ridiculous beginner's question :
> Can't I have ..sort of an array of strings  ?

Are you going to change the values?  If so, then you could do this:

  subtype VString_Length is Natural range 0 .. 81;

  type VString (Length : VString_Length) is
     record
       S : String (1 .. Length);
     end record;

  function "+" (S : String) return VString is
  begin
    return VString'(S'Length, S);
  end;

  type VString_Array is
    array (Positive range <>) of VString;

  -- Here's your "array of strings":
  Table : VString_Array (1 .. 10);


  Table(2) := +"hello";
  Table(5) := +"this is a string";



--
No statement which refers to a "reality" transcending the limits of all
possible sense-experience can possibly have any literal significance;
the labours of those who have striven to describe such a reality have
all been devoted to the production of nonsense.

Alfred Jules Ayer, "Language, Truth, and Logic"




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00   ` Sybs ALHABSHI
@ 1999-10-12  0:00     ` Lutz Donnerhacke
  1999-10-12  0:00       ` Matthew Heaney
  1999-10-12  0:00     ` Matthew Heaney
  1 sibling, 1 reply; 14+ messages in thread
From: Lutz Donnerhacke @ 1999-10-12  0:00 UTC (permalink / raw)


* Sybs ALHABSHI wrote:
> Thanks for the hint. Yet I'll risk asking a ridiculous beginner's question :
> Can't I have ..sort of an array of strings  ?

After some failtures to use Ada.Strings.Unbounded--I hate To_Unbound...--
I came up with code like this:

   type String_Ptr is access String;
   type String_Array is array (Positive range <>) of String_Ptr;

   function Empty_String_Array return String_Array is
   begin
     return String_Array(2..1);
   end;

   ... myarray := myarray & new String'(mystring); ...

   ... if mystring = myarray(i).all then ...





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00     ` Lutz Donnerhacke
@ 1999-10-12  0:00       ` Matthew Heaney
  1999-10-12  0:00         ` Lutz Donnerhacke
  0 siblings, 1 reply; 14+ messages in thread
From: Matthew Heaney @ 1999-10-12  0:00 UTC (permalink / raw)


In article <slrn80665t.1a5.lutz@taranis.iks-jena.de> , lutz@iks-jena.de 
(Lutz Donnerhacke) wrote:

> After some failtures to use Ada.Strings.Unbounded--I hate To_Unbound...--
> I came up with code like this:

Your code segment is completely wrong.  Do not use raw access types.
Use Unbounded_String, which does automatic garbage collection.

If To_Unbounded_String offends you, then just rename that function as an
operator:

  function "+" (S : String) return Unbounded_String renames
    To_Unbounded_String;

--
Why stop at evolution and cosmology, though? Let's make sure that the
schoolkids of Kansas get a really first-rate education by loosening up
the teaching standards for other so-called scientific ideas that are,
after all, just theories. The atomic theory, for example. The theory of
relativity. Heck, the Copernican theory--do we really know that the
universe doesn't revolve around the earth?

John Rennie, Scientific American, Oct 1999




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00       ` Matthew Heaney
@ 1999-10-12  0:00         ` Lutz Donnerhacke
  1999-10-12  0:00           ` Ted Dennison
  1999-10-12  0:00           ` Ted Dennison
  0 siblings, 2 replies; 14+ messages in thread
From: Lutz Donnerhacke @ 1999-10-12  0:00 UTC (permalink / raw)


* Matthew Heaney wrote:
>(Lutz Donnerhacke) wrote:
>> After some failtures to use Ada.Strings.Unbounded--I hate To_Unbound...--
>> I came up with code like this:
>
>Your code segment is completely wrong.  Do not use raw access types.
>Use Unbounded_String, which does automatic garbage collection.

I thougt (by reading the RM95), that only explizit calls of Unchecked_Access
or (Unchecked_)Free can cause a memory leakage. I assumed automatic garbage
collecting to every ordinary use of access and new.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00         ` Lutz Donnerhacke
  1999-10-12  0:00           ` Ted Dennison
@ 1999-10-12  0:00           ` Ted Dennison
  1 sibling, 0 replies; 14+ messages in thread
From: Ted Dennison @ 1999-10-12  0:00 UTC (permalink / raw)


In article <slrn806iq2.1nn.lutz@taranis.iks-jena.de>,
  lutz@iks-jena.de (Lutz Donnerhacke) wrote:
> * Matthew Heaney wrote:
> >Your code segment is completely wrong.  Do not use raw access types.
> >Use Unbounded_String, which does automatic garbage collection.
>
> I thougt (by reading the RM95), that only explizit calls of
> Unchecked_Access or (Unchecked_)Free can cause a memory leakage. I
> assumed automatic garbage collecting to every ordinary use of access
> and new.

Whoa! I don't nessecarily agree with Matt's sentiment in all cases, but
what you just answered with is completely wrong.

   o   The only way to get memory leaks is to *not* deallocate
allocated memory. Explicit deallocations can be dangerous, but they
cannot cause leaks.
   o   Almost no Ada compilers provide automatic garbage collection. I
don't know of *any* that do it that don't target the JVM.


--
T.E.D.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00         ` Lutz Donnerhacke
@ 1999-10-12  0:00           ` Ted Dennison
  1999-10-13  0:00             ` Lutz Donnerhacke
  1999-10-12  0:00           ` Ted Dennison
  1 sibling, 1 reply; 14+ messages in thread
From: Ted Dennison @ 1999-10-12  0:00 UTC (permalink / raw)


In article <slrn806iq2.1nn.lutz@taranis.iks-jena.de>,
  lutz@iks-jena.de (Lutz Donnerhacke) wrote:
> * Matthew Heaney wrote:
> >Your code segment is completely wrong.  Do not use raw access types.
> >Use Unbounded_String, which does automatic garbage collection.
>
> I thougt (by reading the RM95), that only explizit calls of
> Unchecked_Access or (Unchecked_)Free can cause a memory leakage. I
> assumed automatic garbage collecting to every ordinary use of access
> and new.

Whoa! I don't nessecarily agree with Matt's sentiment, but what you just
answered with is completely wrong.

   o   The only way to get memory leaks is to *not* deallocate allocated
memory. Explicit deallocations can be dangerous for other reasons, but
they cannot cause leaks.
   o   Almost no Ada compilers provide automatic garbage collection. I
don't know of *any* that do it that don't target the JVM.

Thus following your logic to avoid memory leaks is one sure way to give
yourself memory leaks!

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
       [not found] ` <38021792_4@news1.prserv.net>
       [not found]   ` <slrn80495c.2a2.aidan@skinner.demon.co.uk>
@ 1999-10-12  0:00   ` Sybs ALHABSHI
  1999-10-12  0:00     ` Lutz Donnerhacke
  1999-10-12  0:00     ` Matthew Heaney
  1 sibling, 2 replies; 14+ messages in thread
From: Sybs ALHABSHI @ 1999-10-12  0:00 UTC (permalink / raw)


Thanks for the hint. Yet I'll risk asking a ridiculous beginner's question :
Can't I have ..sort of an array of strings  ?

Sybs







^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00     ` Matthew Heaney
@ 1999-10-12  0:00       ` Ehud Lamm
  0 siblings, 0 replies; 14+ messages in thread
From: Ehud Lamm @ 1999-10-12  0:00 UTC (permalink / raw)


|In article <7ttuvt$ssb$1@minus.oleane.net> , "Sybs ALHABSHI" 
|<sybs@htsavoie.com> wrote:
|
|> Thanks for the hint. Yet I'll risk asking a ridiculous beginner's question :
|> Can't I have ..sort of an array of strings  ?
|

If I was a beginner, I'd learn to use the Ada.String packages. After that,
yuo can think of the desing decsions yourself. Ddecide if your strings are
going to be of fixed length (putting this in an array is of course
obvious), bounded or unbounded. Each of these types can be used inside
arrays etc.

(You may find my into to Ada.Strings useful, it is accessable from my Ada
page. I hope i this time, when I recommend it, it will not turn out that
some of the links are suddenly dead...)

Ehud Lamm mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <== My home on the web 
Check it out and subscribe to the E-List- for interesting essays and more!







^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00           ` Ted Dennison
@ 1999-10-13  0:00             ` Lutz Donnerhacke
  1999-10-13  0:00               ` Matthew Heaney
  0 siblings, 1 reply; 14+ messages in thread
From: Lutz Donnerhacke @ 1999-10-13  0:00 UTC (permalink / raw)


* Ted Dennison wrote:
>  lutz@iks-jena.de (Lutz Donnerhacke) wrote:
>> I thougt (by reading the RM95), that only explizit calls of
>> Unchecked_Access or (Unchecked_)Free can cause a memory leakage. I
>> assumed automatic garbage collecting to every ordinary use of access
>> and new.
>
>Whoa! I don't nessecarily agree with Matt's sentiment, but what you just
>answered with is completely wrong.

I tested it and found that the reverse operation of the reserved word 'new'
is given by the generic package Unchecked_Deallocation in RM-13.11.2.

Instantiating a Free procedure as given in RM-13.11.2(5) works and provides
the required function.

From reading the Rationale and Reference Manual, the novice (like me) can
not deduce, that this 'Unchecked_'-Package is required for normal usage.
Instead the longish discussions about accessibility rules lead me to the
belief, that access types are like smart pointers.

Sorry for that.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-13  0:00             ` Lutz Donnerhacke
@ 1999-10-13  0:00               ` Matthew Heaney
  1999-10-13  0:00                 ` Ted Dennison
  0 siblings, 1 reply; 14+ messages in thread
From: Matthew Heaney @ 1999-10-13  0:00 UTC (permalink / raw)


In article <slrn808j1s.o7.lutz@taranis.iks-jena.de> , lutz@iks-jena.de 
(Lutz Donnerhacke) wrote:

> From reading the Rationale and Reference Manual, the novice (like me) can
> not deduce, that this 'Unchecked_'-Package is required for normal usage.

Unchecked_Deallocation is not required for normal usage.

There are idioms for implementing abstractions that use the heap or some
form of indirection.  Basically, you want to hide all of that from the
client.

The type Unbounded_String is a good example of an abstraction that
internally uses heap, but hides this fact from the client.  This is how
a well-designed abstraction should be: it should hide information.

The problem is that many programmers come from a C or otherwise
non-object oriented background, and use raw pointers (really, heap
allocation) in the public part of the abstraction.  This is wrong.

The idiom for class-wide programming (in which indirection is necessary,
because a class-wide type is indefinite) is to declare the root type as
limited and indefinite, and let each specific type in the class export
its own constructor:

  package P is

    type Root_T (<>) is abstract tagged limited private;

    type Root_T_Access is access all Root_T;

    <ops>

    Free (O : in out Root_T_Access);
  ...
  end P;

  package P.C is

    type T is new Root_T with private;

    function New_T return Root_T_Access;

    <override ops>
  ...
  end P.C;


A client *never* calls "new" directly; he always goes through a
constructor.

In the example above, the client does however have to call a
deconstructor (Free) directly.  The deconstructor is implemented by
dispatching on a private primitive operation that returns the object to
the storage pool for the specific type.

Realize of course that indirection is not always required.  In the
observer pattern, for example, both object and subject are allocated
statically, without any heap or pointer use.


> Instead the longish discussions about accessibility rules lead me to the
> belief, that access types are like smart pointers.

It is possible to implement a smart pointer yourself, so that you don't
have to call Free manually.  See the smart pointer article in the design
patterns archive.

<http://www.acm.org/archives/patterns.html>

For other smart pointer examples, just search for "handle" or "do_free".

Matt

--
The new standards [for science curricula in Kansas] do not forbid the
teaching of evolution, but the subject will no longer be included in
statewide tests for evaluating students--a virtual guarantee, given the
realities of education, that this central concept of biology will be
diluted or eliminated, thus reducing courses to something like chemistry
without the periodic table, or American history without Lincoln.

Stephen Jay Gould, Time, 23 Aug 1999




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-13  0:00               ` Matthew Heaney
@ 1999-10-13  0:00                 ` Ted Dennison
  0 siblings, 0 replies; 14+ messages in thread
From: Ted Dennison @ 1999-10-13  0:00 UTC (permalink / raw)


In article <380485d2_1@news1.prserv.net>,
  "Matthew Heaney" <matthew_heaney@acm.org> wrote:
> In article <slrn808j1s.o7.lutz@taranis.iks-jena.de> , lutz@iks-jena.de
> (Lutz Donnerhacke) wrote:
>
> > From reading the Rationale and Reference Manual, the novice (like
> > me) can not deduce, that this 'Unchecked_'-Package is required for
> > normal usage.
>
> Unchecked_Deallocation is not required for normal usage.

Well, that depends on what you define as "normal".

> There are idioms for implementing abstractions that use the heap or
> some form of indirection.  Basically, you want to hide all of that
> from the client.

True. But you are talking perspective. That doesn't let Lutz off the
hook if he happens to be *writing* the code that "clients" are using.

My general idom for this is:
   o  Don't worry about it if the allocations only happen once and you
are only running on "heavy" OS's that clean up allocated memory when the
program exits (EG: Unix, Win32).

   o  If you allocate memory for temporary processing in a routine, make
sure to (unchecked_)deallocte it before you return.

   o  As a special case of the above, if you need to do a lot of
allocations in a routine that get cleaned up at the end, and know the
maximum total memory size you will ever need, consider creating an
access type in the routine and specifying a storage pool size for it.
All objects allocated into values of that access type will then get
automagicly deallocted when the routine ends.

   o  If you allocate memory for non-transient use in a routine, keep
track of it in some kind of "cookie" object (typically as part of
another private object that is already passed in), and provide a
"cleanup" routine to the user. Both routines should be copiously
commented as to when "cleanup" needs to be called.

   o As a speicial case of the above, if the allocation happens as part
of an initialization, consider using a controlled type (derived from
Ada.Finialization.Controlled and .Limited_Controled), as the calls to
initialize and cleanup will be made automaticly.

   o Avoid returning a pointer to allocted memory to the client, for
them to clean up manually themselves. (This was the whole of Matt's
point, I believe). That's a truly ugly interface. In fact it gives
"interface" a bad name.

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: how do i include 111111 in an enumaration type ?
  1999-10-12  0:00 ` Nick Roberts
@ 1999-10-14  0:00   ` Sybs ALHABSHI
  0 siblings, 0 replies; 14+ messages in thread
From: Sybs ALHABSHI @ 1999-10-14  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3974 bytes --]

I'm impressed by all the discussion and hints in this thread. I'm lost.
It'll take me some time to understand what you're all taking about. Thank
you all. I've learned quite a bit.

I use ObjectAda 7.1 on NT4.0, and I've managed to built a function that
generates the hex color values in real time as well as text colors matching
the background through sliders in a simple interface created with
GuiBuilder. It works fine and it generates instantly the webpage with the
text in the matching colour with one button click.

But here, I'd like to attach names to these values, "AdaHome Green" for
exemple to color="#99ccbb" ( the background color of adahome.). In many
graphic applications, in fashion design etc, color names ( some of them
poetic and very beautiful) has a significant meaning. Fashion designers,
graphic artistes spend hours matching colours, and certain harmonies
patterns are such that you sometimes imagine colours that "aren't there".
There are so many palettes to consider, and ofcoarse, as a  web designer, I
figure it'll be okay if I can define a type 000000 to FFFFFF, then break
down to sub types of colors that may describe lifestyles, cultures, color
codes, fashion, industries, whatever, as this has become sort of an
international standard of defining colors, and an acceptable manner of
communicating colour schemes ( screen limitations apart  ). I also wonder if
I can find a much faster and convenient way of matching what I see on my
screen to the hardcopy printer's color scale or brushstroke without going
through all the complicated calibration systems, by say simply shifting the
values of a sub-type. Which means that the hex values defined in the subtype
may vary with the shift, but the names attached relatively to one another
may remain the same. So in fact, the names (Indian Red, Canyon Vermillion,
Sunset Orange) may refer to three values that can either be 4,5,6, or 5,6,7
or again 3,4,5. So many things I can do with this...

The other domaine in which I'd like to apply this, is the attachement of
town names to postal codes. In France, 75000 is Paris. 73370 is for " La
Chapelle du Mont du Chat". No shifting here...

But from what I undestand, 111111 cannot be in an enumeration type. Period.
Alas ! But maybe records has the solution...

Nick Roberts <nickroberts@callnetuk.com> a �crit dans le message :
3802C50A.A5565DDA@callnetuk.com...
> Sybs ALHABSHI wrote:
> > In the enumaration type declaration, the string of caracters 000000 is
taken
> > as a numerical expression.
> >
> > Can anyone explain how  I can get around this ?
> >
> >         type webcolor is (FFFFFF, 000000);
>
> Sybs,
>
> I wonder if an enumeration type is what you are looking for here?  Take
> a look at the following snippet of code.
>
>    type Monochromatic_Level is mod 256; -- i.e. a byte
>
>    type RGB_Color is
>       record
>          Red, Green, Blue: Monochromatic_Level;
>       end record;
>
>    Absolute_Black: constant RGB_Color := (16#00#, 16#00#, 16#00#);
>    Absolute_White: constant RGB_Color := (16#FF#, 16#FF#, 16#FF#);
>
>    function Hex_Image (Level: Monochromatic_Level) return String is
>       Digit: constant array (Monochromatic_Level range 0..15) :=
>          ('0', '1', '2', '3', '4', '5', '6', '7',
>           '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
>    begin
>       return Digit(Level/16) & Digit(Level mod 16);
>    end;
>
>    function Hex_Image (RGB: RGB_Color) return String is
>    begin
>       return Hex_Image(RGB.Red) &
>              Hex_Image(RGB.Green) &
>              Hex_Image(RGB.Blue);
>    end;
>
>    ...
>
>       Put(Web_File,"<BODY");
>       Put(Web_File," bgcolor=#");
>       Put(Web_File,Hex_Image(Background_Color));
>       Put(Web_File," text=#");
>       Put(Web_File,Hex_Image(Text_Color));
>       ...
>
> Hope this gives you a few ideas.
>
> --
> Nick Roberts
> Computer Consultant (UK)
> http://www.callnetuk.com/home/nickroberts
> http://www.adapower.com/lab/adaos






^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-10-14  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7tsq3o$92p$1@minus.oleane.net>
     [not found] ` <38021792_4@news1.prserv.net>
     [not found]   ` <slrn80495c.2a2.aidan@skinner.demon.co.uk>
1999-10-11  0:00     ` how do i include 111111 in an enumaration type ? Keith Thompson
1999-10-12  0:00   ` Sybs ALHABSHI
1999-10-12  0:00     ` Lutz Donnerhacke
1999-10-12  0:00       ` Matthew Heaney
1999-10-12  0:00         ` Lutz Donnerhacke
1999-10-12  0:00           ` Ted Dennison
1999-10-13  0:00             ` Lutz Donnerhacke
1999-10-13  0:00               ` Matthew Heaney
1999-10-13  0:00                 ` Ted Dennison
1999-10-12  0:00           ` Ted Dennison
1999-10-12  0:00     ` Matthew Heaney
1999-10-12  0:00       ` Ehud Lamm
1999-10-12  0:00 ` Nick Roberts
1999-10-14  0:00   ` Sybs ALHABSHI

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