comp.lang.ada
 help / color / mirror / Atom feed
* RE: OCharacters with codes >= 128
@ 1987-09-02  2:35 colbert
  1987-09-05 20:43 ` Characters " sommar
  0 siblings, 1 reply; 2+ messages in thread
From: colbert @ 1987-09-02  2:35 UTC (permalink / raw)


You can create your own Character type by defining an enumeration type that
has character literals.

e.g.

	type Character_Type is (Nul, Del, ..., 'A', 'B', ...,
				Koo_Kai, Khoo_Khai, ....);


Where Koo_Kai and Khoo_Khai (etc) are the special characters in your language
(these letters are phonetic Thai characters).

You can then use an enumeration representation specification to map the enumer-
ation literals to the appropriate extended ASCII values.

Once you have this character type defined, you can create a string type by
defining an array of this character type:

e.g.

	type String_Type is array (positive <>) of Character_Type;

This allows you to use string literals such as the following:

	"This is a string of String_Type"  -- may require type qualification

However, you will have to use catenation to create string_type expressions that
contain your countries special characters (and of course non-printable
characters).

E.g.

	"This is a '" & Koo_Kai & "' while this is a '" & Khoo_Khai & "'"

As for the I/O of your language specific characters, you will need to create
a Thai_Text_IO (or something equivalent).  Ada does not say that Text_IO is
the ONLY text I/O package, only that it is the standard text I/O package.  In
this case you need something non-standard.

I hope this is of help.

Take care,

Ed Colbert
Absolute Software
4593 Orchid Dr
Los Angeles, CA 90043-3320
USA
(213) 293-0783
hermix!colbert@rand-unix.arpa			ARPA
(trwrb!, sesmo!, ...)hermix!colbert		UUCP


P.S.  See LRM Sections 2.6 (String Literals), 3.5.2 (Character Types),
		       3.6.3 (The Type String), 4.2 (Literals).

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

* Re: Characters with codes >= 128
  1987-09-02  2:35 OCharacters with codes >= 128 colbert
@ 1987-09-05 20:43 ` sommar
  0 siblings, 0 replies; 2+ messages in thread
From: sommar @ 1987-09-05 20:43 UTC (permalink / raw)


In a recent article colbert@hermix.UUCP writes:
 >You can create your own Character type by defining an enumeration type that
 >has character literals.
 >	type Character_Type is (Nul, Del, ..., 'A', 'B', ...,
 >				Koo_Kai, Khoo_Khai, ....);
 >...
 >Once you have this character type defined, you can create a string type by
 >defining an array of this character type:
 >
 >	type String_Type is array (positive <>) of Character_Type;
 >...
 >However, you will have to use catenation to create string_type expressions that
 >contain your countries special characters (and of course non-printable
 >characters).
 >...
 >As for the I/O of your language specific characters, you will need to create
 >a Thai_Text_IO (or something equivalent).  Ada does not say that Text_IO is
 >the ONLY text I/O package, only that it is the standard text I/O package.  In
 >this case you need something non-standard.

I think Martin Moore's solution was much more simple and elegant. It will
work on any Ada system that doesn't check character assignments for 
Constraint_error.
  This solution requires one hell lot of work and it isn't portable from
OS to another. Yes, I can write my own Text_IO, but guess how fun I find
that. And, I will have to write one Text_IO for each OS I want to work
with. Guess why there is a standard Text_IO. It gives you a standard 
interface.
  But even better, a change in the language definition would be the 
approriate. It's ridiculus that perfectly good letters are being 
regarded as illegal and unprintable.

-- 

Erland Sommarskog       
ENEA Data, Stockholm    
sommar@enea.UUCP        

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

end of thread, other threads:[~1987-09-05 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-09-02  2:35 OCharacters with codes >= 128 colbert
1987-09-05 20:43 ` Characters " sommar

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