[comp.lang.c] to "OR" or not to "OR"

tmjones@eos.ncsu.edu (TOMMIE MILES JONES) (05/29/91)

Ok folks this is a real stupid problem.
I have a (don't laugh, I'm a poor broke college student) tandy 1000sx
it is IBM compatible (suprise!) and run quick C ver 2.5 academic ver.
(only $45 I told you I was cheap)
this peice of sh-- will not allow me to write the OR symbol "|"
it is on key 4 on the numeric key pad.  I tried all different combinations
of numlock and shift.  it will just move the cursor or highlight the text.
I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 
I read somewhere that C has taken into consideration that some machines do
not have all the funky symbols and there are ways to get around.


help me please

grover@brownie.cs.unlv.edu (Kevin Grover) (05/29/91)

In article <1991May28.191122.15749@ncsu.edu>, tmjones@eos.ncsu.edu (TOMMIE MILES JONES) writes:
) Ok folks this is a real stupid problem.
) I have a (don't laugh, I'm a poor broke college student) tandy 1000sx
) it is IBM compatible (suprise!) and run quick C ver 2.5 academic ver.
) (only $45 I told you I was cheap)
) this peice of sh-- will not allow me to write the OR symbol "|"
) it is on key 4 on the numeric key pad.  I tried all different combinations
) of numlock and shift.  it will just move the cursor or highlight the text.
) I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 
) I read somewhere that C has taken into consideration that some machines do
) not have all the funky symbols and there are ways to get around.
) 
) 
) help me please

This is not a problem with C, it is a problem with your machine.  If it is IBM
compatible, you should be able to get that symbol by holding the ALT key and
typing the number 124 (the ASCII value for a | symbol), then releasing the
ALT key.  If all else fails, and your manauls don't help, contact Tandy.

-- 
  +-------------------------------------------------+----------------------+
  | Kevin Grover             UNLV Computer Science  |     Home of the      |
  | grover@cs.unlv.edu       Las Vegas, Nevada      |    Running REBELS    |
  +-------------------------------------------------+----------------------+

jlg@cochiti.lanl.gov (Jim Giles) (05/29/91)

In article <1991May28.191122.15749@ncsu.edu>, tmjones@eos.ncsu.edu (TOMMIE MILES JONES) writes:
|> Ok folks this is a real stupid problem.
|> I have a (don't laugh, I'm a poor broke college student) tandy 1000sx
|> it is IBM compatible (suprise!) and run quick C ver 2.5 academic ver.
|> (only $45 I told you I was cheap)
|> this peice of sh-- will not allow me to write the OR symbol "|"
|> it is on key 4 on the numeric key pad.  I tried all different combinations
|> of numlock and shift.  it will just move the cursor or highlight the text.
|> I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 
|> I read somewhere that C has taken into consideration that some machines do
|> not have all the funky symbols and there are ways to get around.

The problem is with your editor.  The only way it could be _failing_ to
get the vertical bar (and the circumflex "^", and whatever else is on the
Tandy number pad) is if it is bypassing the normal terminal input and
reading the key codes itself.  Try using the arrow keys (shifted and
unshifted), sometimes those are interpreted as the missing keys (vterm
does that on Tandys).  If all else fails, write a code to convert @ to
| and write all your other codes using @.

J. Giles

bliss@sp64.csrd.uiuc.edu (Brian Bliss) (05/29/91)

If your compiler accepts trigraph sequences as defined by K&RII,
then,

??! 

is equivalent to 

|

which brings up the question:  what if I want to use the
sequence "??!" within a string?

bb

rogue@cellar.UUCP (Rache McGregor) (05/29/91)

tmjones@eos.ncsu.edu (TOMMIE MILES JONES) writes:

> Ok folks this is a real stupid problem.
> I have a (don't laugh, I'm a poor broke college student) tandy 1000sx
> it is IBM compatible (suprise!) and run quick C ver 2.5 academic ver.
> (only $45 I told you I was cheap)
> this peice of sh-- will not allow me to write the OR symbol "|"
> it is on key 4 on the numeric key pad.  I tried all different combinations
> of numlock and shift.  it will just move the cursor or highlight the text.
> I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 
> I read somewhere that C has taken into consideration that some machines do
> not have all the funky symbols and there are ways to get around.
> 
> 
> help me please

Don't feel too badly, I'm also using Academic QuickC, and I had to pay $52 
for it!

According to The_Waite_Group's_Essential_Guide_to_ANSI_C, the trigraph 
sequence to represent | is ??!.  I haven't tried using them myself (and can't 
at the moment,, or I'd check), but I'd expect the trigraphs to work in 2.5, 
since it was released after the ANSI standard.

Reference: [title above], Naba Barkakati, 1988.  ISBN 0-672-22673-1

Rogue Winter       | "The truth knocks on the door and you say, 
rogue@cellar.uucp  | "Go away, I'm looking for the truth," and so
uunet!cellar!rogue | it goes away.  Puzzling."
Cellar 215/3369503 |  -Robert Pirsig (quoted in Zen_To_Go, Jon Winokur)

richard@iesd.auc.dk (Richard Flamsholt S0rensen) (05/29/91)

>>>>> On 28 May 91 23:12:53 GMT, bliss@sp64.csrd.uiuc.edu (Brian Bliss) said:

> What if I want to use the sequence "??!" within a string?

  puts("Too bad - it is impossible to use ??""! in a string  :-)");

  Richard



--
Richard Flamsholt
richard@iesd.auc.dk

hymowitz@jhunix.HCF.JHU.EDU (Eric B. Hymowitz) (05/30/91)

>In article <1991May28.191122.15749@ncsu.edu>, tmjones@eos.ncsu.edu (TOMMIE MILES JONES) writes:

>) I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 

sounds like you either need to
(a) manage to do it once, and then #define or |
or
(b) #define on another machine and then port it to yours.

btw, isn't demorgan's law a|b = !(!a & !b)?

a b !a !b a|b !a&!b! (!a&!b) a&b !(a&b)
T T F  F  T   F      T       T   F
T F F  T  T   F      T       F   T
F T T  F  T   F       T      F   T
F F T  T  F   T        F     F   T

--hymie

no sig yet - give me a few days.

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (05/30/91)

In article <RICHARD.91May29092137@lambda.iesd.auc.dk>, richard@iesd.auc.dk (Richard Flamsholt S0rensen) writes:
> >>>>> On 28 May 91 23:12:53 GMT, bliss@sp64.csrd.uiuc.edu (Brian Bliss) said:
> > What if I want to use the sequence "??!" within a string?
>   puts("Too bad - it is impossible to use ??""! in a string  :-)");

One method is to use string pasting:
	printf("Puzzled?" "?!  You don't need to be!\n");
That's also useful for terminating hex escapes.

-- 
Should you ever intend to dull the wits of a young man and to
incapacitate his brains for any kind of thought whatever, then
you cannot do better than give him Hegel to read.  -- Schopenhauer.

worley@compass.com (Dale Worley) (05/31/91)

Various posters say:

   >) I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 

   btw, isn't demorgan's law a|b = !(!a & !b)?

In this case, it's: a|b == ~(~a & ~b) and a||b == !(!a && !b).
Remember that |, &, and ~ are bitwise operators, while ||, &&, and !
are logical operators.

Dale Worley		Compass, Inc.			worley@compass.com
--
I don't have to take this abuse from you -- I've got hundreds of
people waiting to abuse me. -- Bill Murray, "Ghostbusters"

egnilges@phoenix.Princeton.EDU (Ed Nilges) (05/31/91)

In article <WORLEY.91May31100843@sn1987a.compass.com> worley@compass.com (Dale Worley) writes:
>Various posters say:
>
>   >) I'm tired of Demorgan's law (a | b= !(a & b)) isnt there a way to get around 
>
Boy, that's one for the books.  Yeah, I'm sick of the law of excluded
middle, Planck's constant, the speed of light, the law of comparative
advantage, and Heisenberg's uncertainty principle.  Dale, was this for
real?  First this jerk announces that he's tired of DeMorgan's law and
then gets it wrong.  I'm tired of working with people like him (and 
trying to teach C to students who cannot program in Cobol.)
Whatthehell, who cares, ah gots mah 486 and ah'll invade Iraq when the
going gets tough.
>   btw, isn't demorgan's law a|b = !(!a & !b)?
>
>In this case, it's: a|b == ~(~a & ~b) and a||b == !(!a && !b).
>Remember that |, &, and ~ are bitwise operators, while ||, &&, and !
>are logical operators.

Thank you very much, there's hope for mankind, you know what you're
talking about.  
>
>Dale Worley		Compass, Inc.			worley@compass.com
>--
>I don't have to take this abuse from you -- I've got hundreds of
>people waiting to abuse me. -- Bill Murray, "Ghostbusters"