* Re: case sensitivity
@ 1993-07-02 15:53 Robert I. Eachus
0 siblings, 0 replies; 15+ messages in thread
From: Robert I. Eachus @ 1993-07-02 15:53 UTC (permalink / raw)
In article <PAT.93Jul1160332@crl-sc2.nmsu.edu> pat@nmsu.edu (Pat Gioannini) wri
tes:
> Do any of the pretty printers out there use the capitalization
> of the first reference of an identifier? I have a probem with
> the pretty printer we use will either leave all identifiers alone,
> capitalize the first letter ( and the letter after each underscore ),
> make all identifiers uppercase or make all identifiers lower case.
This is in the "tough problem" category. Since finding the
correct declaration requires parsing the file and doing overload
resolution, it is only possible to do this for source files which are
correct compilable Ada. (And, of course, with reference to a
particular program library.)
The rule I have used for formatters which accept non-legal
programs is either to use the first appearance of an identifier in the
file OR to use a particular rule and have a file of personal
exceptions. What I keep intending to do is build a tool that takes a
file of starname style exceptions:
*_IO
ADAR_*
SPARC_*
...
hmmm...an easier case might be to treat underscores as separators:
IO
ADAR
SPARC
that would make a fairly simple standalone tool.
My plate is fairly full right now, but if anyone wants to work on
this, I'll be glad to help supply the easy 75%. (The pieces already
done of course. :-)
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
^ permalink raw reply [flat|nested] 15+ messages in thread
* Case Sensitivity
@ 2000-05-11 0:00 Cameron McShane
2000-05-11 0:00 ` Alfred Hilscher
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Cameron McShane @ 2000-05-11 0:00 UTC (permalink / raw)
Hey
I am doing a project for Uni, and am a bit stuck.
We need a menu that needs to be case-'in'sensitive. I am using an enumerated
data type for the 3 menu options ie:
type Menu_Options is (buy, read, done)
If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need to
make the data type
type Menu_Options is (buy, Buy, bUY, etc
or is there a way of converting user input to all lower case?
Any help Would be greatly appreciated.
Cheers
Cameron
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-11 0:00 Case Sensitivity Cameron McShane
@ 2000-05-11 0:00 ` Alfred Hilscher
2000-05-11 0:00 ` Ted Dennison
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Alfred Hilscher @ 2000-05-11 0:00 UTC (permalink / raw)
Cameron McShane wrote:
>
> type Menu_Options is (buy, read, done)
>
> If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need to
> make the data type
>
> type Menu_Options is (buy, Buy, bUY, etc
Why do you think that the way a user enters input (a string ?) does
affect your internal representaion (your set type).
> or is there a way of converting user input to all lower case?
Yes, this way exists. It was mentioned in another thread a few days ago.
(Hint: conversion to upper or to lower, have a look into the manual)
> Any help Would be greatly appreciated.
Is this enough help ? ;-)
> Cheers
> Cameron
Bye.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-11 0:00 Case Sensitivity Cameron McShane
2000-05-11 0:00 ` Alfred Hilscher
@ 2000-05-11 0:00 ` Ted Dennison
2000-05-11 0:00 ` Florian Weimer
` (2 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Ted Dennison @ 2000-05-11 0:00 UTC (permalink / raw)
In article <958056490.47876@hearts.q-net.net.au>,
"Cameron McShane" <cazza@aceonline.com.au> wrote:
> Hey
>
> I am doing a project for Uni, and am a bit stuck.
>
> We need a menu that needs to be case-'in'sensitive. I am using an
enumerated
> data type for the 3 menu options ie:
>
> type Menu_Options is (buy, read, done)
>
> If the user is to be allowed to enter Buy or BUY or bUy - etc, do I
need to
> make the data type
>
> type Menu_Options is (buy, Buy, bUY, etc
>
> or is there a way of converting user input to all lower case?
Yes.
In the Latin_1 character collating sequence, it just so happens that the
characters 'a' through 'z' all have the same relative position to each
other as the characters 'A' through 'Z'. The lower-case letters have a
larger value than the upper case letters. (See Ada.Characters.Latin_1)
So the traditional manual way to do this would be to find the difference
in the integer position of an upper case character from that of its
lower-case counterpart (eg: 'A' and 'a'). Then you can add that
difference to the integer position of every upper-case letter you
encounter. Then you just need to find the character value for that
resulting integer position. There are predefined attributes that you can
apply to characters to convert between their character value and their
integer position. (This reads pretty complicated, but the code's really
very simple).
But you don't have to do this manually (unless your teacher wants you
to). Take out your handy-dandy Ada LRM (if you don't have one, there's
one online at http://www.adapower.com ) and look through the routines in
the standard Ada library in Appendix A. There are a couple of sets of
packages in there that provide useful routines for doing this kind of
thing. There are packages for doing lots of other neat stuff too, so be
sure to look through them all.
While you're at it, do yourself a favor and read through appendix K
(Language Defined Attributes). There's lots of vital stuff in there to
make your life easier.
--
T.E.D.
http://www.telepath.com/~dennison/Ted/TED.html
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-11 0:00 Case Sensitivity Cameron McShane
2000-05-11 0:00 ` Alfred Hilscher
2000-05-11 0:00 ` Ted Dennison
@ 2000-05-11 0:00 ` Florian Weimer
2000-05-11 0:00 ` Gautier
2000-05-12 0:00 ` John English
4 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2000-05-11 0:00 UTC (permalink / raw)
"Cameron McShane" <cazza@aceonline.com.au> writes:
> We need a menu that needs to be case-'in'sensitive. I am using an enumerated
> data type for the 3 menu options ie:
>
> type Menu_Options is (buy, read, done)
>
> If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need to
> make the data type
>
> type Menu_Options is (buy, Buy, bUY, etc
>
> or is there a way of converting user input to all lower case?
If you use Menu_Options'Value to convert a string to the corresponding
enumeration value, you don't have to care about case at all. Or am I
missing something?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-11 0:00 Case Sensitivity Cameron McShane
` (2 preceding siblings ...)
2000-05-11 0:00 ` Florian Weimer
@ 2000-05-11 0:00 ` Gautier
2000-05-12 0:00 ` John English
4 siblings, 0 replies; 15+ messages in thread
From: Gautier @ 2000-05-11 0:00 UTC (permalink / raw)
Cameron McShane:
> If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need to
> make the data type
> type Menu_Options is (buy, Buy, bUY, etc
Wow: 2^n cases for one option worded with n letters! BTW, try it:
you might discover that Ada -fortunately- is case insensitive...
> or is there a way of converting user input to all lower case?
Yes! Check for a To_Lower function in some Ada.* package.
BTW, the To_Upper will be more useful to compare with "BUY" "READ"
"DONE" returned by the function Menu_Options'Image( option ).
Or better: Menu_Options'Value( a_string ) will return a value
of Menu_Options type, and is case already insensitive :-) !
HTH
______________________________________________________
Gautier -- http://members.xoom.com/gdemont/gsoft.htm
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-11 0:00 Case Sensitivity Cameron McShane
` (3 preceding siblings ...)
2000-05-11 0:00 ` Gautier
@ 2000-05-12 0:00 ` John English
2000-05-12 0:00 ` David C. Hoos, Sr.
4 siblings, 1 reply; 15+ messages in thread
From: John English @ 2000-05-12 0:00 UTC (permalink / raw)
Cameron McShane wrote:
> We need a menu that needs to be case-'in'sensitive. I am using an enumerated
> data type for the 3 menu options ie:
>
> type Menu_Options is (buy, read, done)
>
> If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need to
> make the data type
>
> type Menu_Options is (buy, Buy, bUY, etc
>
> or is there a way of converting user input to all lower case?
If you instantiate Ada.Text_IO.Enumeration_IO for your Menu_Options
type, the user will be able to enter any of the three names in any
case mixture and you will get back the corresponding Menu_Options
result. You will also be able to display the three values using
Put -- the default is all uppercase but you can also select output
in all lowercase. Enumeration_IO for input lets you forget about
case differences completely.
In other words, rather than reading a string, read a Menu_Options
value directly. If the user types anything other than one of your
three possible values, you'll get a Constraint_Error, so checking
for invalid input is simpler too.
-----------------------------------------------------------------
John English | mailto:je@brighton.ac.uk
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Case Sensitivity
2000-05-12 0:00 ` John English
@ 2000-05-12 0:00 ` David C. Hoos, Sr.
2000-05-15 0:00 ` John English
0 siblings, 1 reply; 15+ messages in thread
From: David C. Hoos, Sr. @ 2000-05-12 0:00 UTC (permalink / raw)
John --
Won't one get Data_Error instead of Constraint_Error
when using an instantiation of Enumeration_IO?
John English <je@bton.ac.uk> wrote in message
news:391BC9D0.F20E8D22@bton.ac.uk...
> Cameron McShane wrote:
> > We need a menu that needs to be case-'in'sensitive. I am using an
enumerated
> > data type for the 3 menu options ie:
> >
> > type Menu_Options is (buy, read, done)
> >
> > If the user is to be allowed to enter Buy or BUY or bUy - etc, do I need
to
> > make the data type
> >
> > type Menu_Options is (buy, Buy, bUY, etc
> >
> > or is there a way of converting user input to all lower case?
>
> If you instantiate Ada.Text_IO.Enumeration_IO for your Menu_Options
> type, the user will be able to enter any of the three names in any
> case mixture and you will get back the corresponding Menu_Options
> result. You will also be able to display the three values using
> Put -- the default is all uppercase but you can also select output
> in all lowercase. Enumeration_IO for input lets you forget about
> case differences completely.
>
> In other words, rather than reading a string, read a Menu_Options
> value directly. If the user types anything other than one of your
> three possible values, you'll get a Constraint_Error, so checking
> for invalid input is simpler too.
>
> -----------------------------------------------------------------
> John English | mailto:je@brighton.ac.uk
> Senior Lecturer | http://www.it.bton.ac.uk/staff/je
> Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
> University of Brighton | -- see http://burks.bton.ac.uk
> -----------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: case sensitivity
@ 1993-07-04 9:12 Erik Magnuson
0 siblings, 0 replies; 15+ messages in thread
From: Erik Magnuson @ 1993-07-04 9:12 UTC (permalink / raw)
In article <PAT.93Jul1160332@crl-sc2.nmsu.edu> pat@nmsu.edu (Pat Gioannini) wri
tes:
>
>Do any of the pretty printers out there use the capitalization
>of the first reference of an identifier?
A few years ago I added this to NAPP. It wasn't very hard. I even
supported a way to provide a "dictionary" of indentifier spellings to
use. (But I did not get around to implementing patterns.)
Unfortunately, those changes have been lost in the mists of time as I
was unable to fix some other aspects of NAPP's output. Oh, well. These
days I settle for post processing my vendor's pretty printer output with a
simple perl script.
--
Erik
^ permalink raw reply [flat|nested] 15+ messages in thread
* case sensitivity
@ 1993-07-01 23:03 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!darwin.
0 siblings, 0 replies; 15+ messages in thread
From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!darwin. @ 1993-07-01 23:03 UTC (permalink / raw)
Do any of the pretty printers out there use the capitalization
of the first reference of an identifier? I have a probem with
the pretty printer we use will either leave all identifiers alone,
capitalize the first letter ( and the letter after each underscore ),
make all identifiers uppercase or make all identifiers lower case.
I would much rather have the pretty printer use the case of the declaration
of each identifier through out the program. This would allow abbreviations
to be in all upper case.
For example,
type organization is record
....
end record
TLA : organization;
Three_Letter_Abbreviation : organization;
I would like all future reference to be either TLA or
Three_Letter_Abbreviation; not Tla and Three_Letter_Abbreviation, or
TLA and THREE_LETTER_ABBREVIATION.
pat
^ permalink raw reply [flat|nested] 15+ messages in thread
* case sensitivity
@ 1989-02-20 19:45 pse_papay
1989-02-21 8:18 ` Bruce Anderson
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: pse_papay @ 1989-02-20 19:45 UTC (permalink / raw)
In volume 89, issue 54 Bruce Anderson asked:
>
> ... does everyone think that the case-insensitivity of Ada is a positive
> feature and if so why?
>
The reason for Ada's case insensitivity is one of portability. Ada was designed
to be the common higher order programming language for the DoD. Since some of
the computers used by the DoD may not support upper and lower case characters,
Ada cannot be a case sensitive language.
Is this a positive feature of the language? When one takes into account the
issue of portability, I think it is a very positive feature. As for the
rest of the computer science community, I can only assume that a large number
of people feel the same way, as this feature was required by the "Steelman"
document.
One last comment: Its too bad that many people feel "forced" to use Ada,
as Mr. Anderson's company is. Why is it that when a group of C, or FORTRAN,
or Pascal programmers get together (at a conference, workshop, et al), they're
there because they _want_ to, while when a group of Ada programmers get
together, many are there because they _have_ to?
David F. Papay papayd@gtewd.arpa
GTE Government Systems Corp.
100 Ferguson Dr. (415)-694-1522
PO Box 7188 M/S 5G09
Mountain View, CA 94039
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: case sensitivity
1989-02-20 19:45 pse_papay
@ 1989-02-21 8:18 ` Bruce Anderson
1989-02-22 22:28 ` Steven D. Litvintchouk
1989-02-27 14:45 ` Dennis M. O'Connor
2 siblings, 0 replies; 15+ messages in thread
From: Bruce Anderson @ 1989-02-21 8:18 UTC (permalink / raw)
First off I appreciate the responses I have gotten on the case
sensitivity issue. I still don't agree with them but I can see
how others might.
On another subject, in one of the replies, David Papay comments:
>One last comment: Its too bad that many people feel "forced" to use Ada,
>as Mr. Anderson's company is. Why is it that when a group of C, or FORTRAN,
>or Pascal programmers get together (at a conference, workshop, et al), they're
>there because they _want_ to, while when a group of Ada programmers get
>together, many are there because they _have_ to?
I think that the primary reason people feel "forced" to use Ada is that
they _ARE_ forced to use Ada. I may be wrong, but I don't think that most
companies who go out and design a microwave oven which happens to have a
processor in it are using C or Fortran or Pascal because the customer
won't buy it if they don't. They use a particular language because it
suits their environment best and _they_ get to decide what fits best.
Converting to a new language (any new language) is an expensive task and
Ada is more expensive than most. Not only do you have an extensive
retraining process but a typical Ada cross compiler costs 10 to 15
times as much as a C cross compiler and the Ada compiler is very complex
and therefore requires more computer power for the same development
project. Because of this, many people do not see an economic reason
(and face it that's the real basis for decisions in a corporate
environment) to switch to Ada, if given a choice, particularly since
the payback is very difficult to quantify. Also many people (and as a
subclass programmers) get comfortable with what they know and _uncomfortable_
when they need to learn something new, especially when they need to learn
it not because they are interested in it but because they _have_ to use it.
Personally, I feel that it is probably a good idea to switch to Ada
or one of the other object oriented languages but I am enough of a
rebel that when someone says "You've gotta do it", I tend to dig in
my heels a little. My impression of the people who usually read
(or at least post to) this group is that they are strong proponents
of Ada (as they should be). What I've tried to do here is describe
what many people on the outside are feeling.
Bruce Anderson - Scientific Atlanta, Government Products Div
...!sagpd1!banderso
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: case sensitivity
1989-02-20 19:45 pse_papay
1989-02-21 8:18 ` Bruce Anderson
@ 1989-02-22 22:28 ` Steven D. Litvintchouk
1989-02-27 14:45 ` Dennis M. O'Connor
2 siblings, 0 replies; 15+ messages in thread
From: Steven D. Litvintchouk @ 1989-02-22 22:28 UTC (permalink / raw)
In article <8902201944.AA05264@ajpo.sei.cmu.edu> pse_papay@GTEWD.ARPA writes:
> One last comment: Its too bad that many people feel "forced" to use
> Ada, as Mr. Anderson's company is. Why is it that when a group of
> C, or FORTRAN, or Pascal programmers get together (at a conference,
> workshop, et al), they're there because they _want_ to, while when a
> group of Ada programmers get together, many are there because they
> _have_ to?
Do you believe that *your* company would routinely use Ada by choice, if
the DoD didn't require/force government contractors to use Ada?
Steven Litvintchouk
MITRE Corporation
Burlington Road
Bedford, MA 01730
Fone: (617)271-7753
ARPA: sdl@mitre-bedford.arpa
UUCP: ...{att,decvax,genrad,ll-xn,philabs,utzoo}!linus!sdl
"Those who will be able to conquer software will be able to
conquer the world." -- Tadahiro Sekimoto, president, NEC Corp.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: case sensitivity
1989-02-20 19:45 pse_papay
1989-02-21 8:18 ` Bruce Anderson
1989-02-22 22:28 ` Steven D. Litvintchouk
@ 1989-02-27 14:45 ` Dennis M. O'Connor
2 siblings, 0 replies; 15+ messages in thread
From: Dennis M. O'Connor @ 1989-02-27 14:45 UTC (permalink / raw)
An article by sdl@linus.UUCP (Steven D. Litvintchouk) says:
] Do you believe that *your* company would routinely use Ada by choice, if
] the DoD didn't require/force government contractors to use Ada?
Yes. Several non-aerospace portions of GE already do.
--
Dennis O'Connor oconnor%sungod@steinmetz.UUCP ARPA: OCONNORDM@ge-crd.arpa
"...the bastard got away. God always fights on the side of the bad man"
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2000-05-15 0:00 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-07-02 15:53 case sensitivity Robert I. Eachus
-- strict thread matches above, loose matches on Subject: below --
2000-05-11 0:00 Case Sensitivity Cameron McShane
2000-05-11 0:00 ` Alfred Hilscher
2000-05-11 0:00 ` Ted Dennison
2000-05-11 0:00 ` Florian Weimer
2000-05-11 0:00 ` Gautier
2000-05-12 0:00 ` John English
2000-05-12 0:00 ` David C. Hoos, Sr.
2000-05-15 0:00 ` John English
1993-07-04 9:12 case sensitivity Erik Magnuson
1993-07-01 23:03 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!darwin.
1989-02-20 19:45 pse_papay
1989-02-21 8:18 ` Bruce Anderson
1989-02-22 22:28 ` Steven D. Litvintchouk
1989-02-27 14:45 ` Dennis M. O'Connor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox