zsh-workers
 help / color / mirror / code / Atom feed
* Zle patch - termok change
@ 1997-03-07  7:23 gwing
  1997-03-07  9:43 ` Bart Schaefer
  1997-03-07 15:03 ` Zefram
  0 siblings, 2 replies; 6+ messages in thread
From: gwing @ 1997-03-07  7:23 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: application/pgp, Size: 16418 bytes --]

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

* Re: Zle patch - termok change
  1997-03-07  7:23 Zle patch - termok change gwing
@ 1997-03-07  9:43 ` Bart Schaefer
  1997-03-07 14:03   ` gwing
  1997-03-07 15:03 ` Zefram
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 1997-03-07  9:43 UTC (permalink / raw)
  To: gwing, zsh-workers

On Mar 7,  6:23pm, gwing@primenet.com.au wrote:
} Subject: Zle patch - termok change
}
} termok  now is flag based, not value based.
} termok == 0 indicates a `normal' working terminal - this is *opposite* to
}  the previous situation.

In that case, you should never use the form (!termok) because it reads as
if you mean the terminal is not OK.  Use (termok == 0) or make a new macro

#define nosetflag(X)	((X) == 0)

and then write (nosetflag(termok)).

} Flags for termok are defined and explained in zsh.h - currently TERM_NARROW
} is unused.

It looks like it is used in zlevarsetfn() ... you mean nobody explicitly
tests for it, but it is used in the sense that it makes termok != 0 ...

} If a terminal is evaluated as TERM_BAD then that status shouldn't go until
} $TERM is changed.

So that means that init_term() looks for TERM_BAD and doesn't change it?
Or what?

} Bart wrote:
} :Hmm.  Well, I dislike ..... because it presumes that init_term()
} :is independent of the values of "lines" and "columns".
} 
} I can't see why lines/columns should be any way connected to init_term() .

They don't need to be as long as init_term() doesn't reset TERM_SHORT or
TERM_NARROW.  If I do

TERM=vt100
LINES=3
COLUMNS=3
TERM=xterm

Then what happens to termok?  Am I going to get a crash because init_term()
has reset termok to zero?

BTW:

#define issetflag(X, Y)		((X & (Y)) == Y)
#define isanysetflag(X, Y)	(X & (Y))

Is it really necessary for these to be different?  Why risk evaluating Y
twice in issetflag?

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


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

* Re: Zle patch - termok change
  1997-03-07  9:43 ` Bart Schaefer
@ 1997-03-07 14:03   ` gwing
  1997-03-08  0:14     ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 6+ messages in thread
From: gwing @ 1997-03-07 14:03 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
:On Mar 7,  6:23pm, gwing@primenet.com.au wrote:
:} Subject: Zle patch - termok change
:} termok  now is flag based, not value based.
:} termok == 0 indicates a `normal' working terminal - this is *opposite* to
:}  the previous situation.
:In that case, you should never use the form (!termok) because it reads as
:if you mean the terminal is not OK.  Use (termok == 0) or make a new macro
:#define nosetflag(X)	((X) == 0)
:and then write (nosetflag(termok)).

Point taken, though I probably shouldn't be using !termok where I have, but
isanysetflag(termok, TERM_BAD | TERM_UNKNOWN | TERM_NOUP | TERM_SHORT)

:} Flags for termok are defined and explained in zsh.h - currently TERM_NARROW
:} is unused.
:It looks like it is used in zlevarsetfn() ... you mean nobody explicitly
:tests for it, but it is used in the sense that it makes termok != 0 ...

Yes, I meant explicitly, but also if I change as above, then it won't be
used yet.

:} If a terminal is evaluated as TERM_BAD then that status shouldn't go until
:} $TERM is changed.
:So that means that init_term() looks for TERM_BAD and doesn't change it?
:Or what?

Have no idea what I meant, but:
Until $TERM is changed, init_term() is not going to get called.  So your
terminal is TERM_BAD for one combination of $TERM/$TERMCAP/TERMCAP-file.
Yep, I don't know where I was going with this.  Don't worry about it.

:} I can't see why lines/columns should be any way connected to init_term() .
:They don't need to be as long as init_term() doesn't reset TERM_SHORT or
:TERM_NARROW.  If I do
:
:TERM=vt100
:LINES=3
:COLUMNS=3
:TERM=xterm
:
:Then what happens to termok?  Am I going to get a crash because init_term()
:has reset termok to zero?

No, init_term() doesn't touch TERM_SHORT or TERM_NARROW.  termok is flag
based and only set explicitly in  setupvals()

:BTW:
:#define issetflag(X, Y)		((X & (Y)) == Y)
:#define isanysetflag(X, Y)	(X & (Y))
:Is it really necessary for these to be different?  Why risk evaluating Y
:twice in issetflag?

There's no risk I can see or I would have put everything in parentheses.
You can't use the first form if you do something like my example above,
and the first form always evaluates to 1.  Hmmm,  you're right, I should
probably change it to:

#define issetflag(X, Y)		((X & (Y)) != 0)

And replace all isanysetflag()s with issetflag().  Good thinking.

-- 
Geoff Wing [mason@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


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

* Re: Zle patch - termok change
  1997-03-07  7:23 Zle patch - termok change gwing
  1997-03-07  9:43 ` Bart Schaefer
@ 1997-03-07 15:03 ` Zefram
  1 sibling, 0 replies; 6+ messages in thread
From: Zefram @ 1997-03-07 15:03 UTC (permalink / raw)
  To: gwing; +Cc: zsh-workers

gwing@primenet.com.au wrote:
>termok == 0 indicates a `normal' working terminal - this is *opposite* to
> the previous situation.

Perhaps it should be renamed to termbad then.

>+ /* flag defines */
>+ #define issetflag(X, Y)		((X & (Y)) == Y)
>+ #define isanysetflag(X, Y)	(X & (Y))
>+ #define setflag(X, Y)		X |= (Y)
>+ #define unsetflag(X, Y)		X &= ~(Y)

Yuck.  issetflag() evaluates Y twice, and there aren't enough parentheses.
The fully parenthesised forms are:

#define issetflag(X, Y)		(((X) & (Y)) == (Y))
#define isanysetflag(X, Y)	((X) & (Y))
#define setflag(X, Y)		((X) |= (Y))
#define unsetflag(X, Y)		((X) &= ~(Y))

But why bother with these macros anyway?  We've always been happy with
the (much clearer) plain bit operations anyway.

-zefram


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

* Re: Zle patch - termok change
  1997-03-07 14:03   ` gwing
@ 1997-03-08  0:14     ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 6+ messages in thread
From: Zoltan T. Hidvegi @ 1997-03-08  0:14 UTC (permalink / raw)
  To: gwing; +Cc: schaefer, zsh-workers

Here is a revised version of Geoff's termok patch.  Use this instead of the
patch in article 2970.  The *setflags() macros are removed from Geoff's
patch, and termok is renamed to termflags since the termok name was
misleading after the patch.  This is for zsh-3.0 and depends on patches
2865, 2956 and 2957.  I also have a 3.1 version of that patch.

Zoltan


begin 600 termok-patch.gz
M'XL(",B@(#,``V8`W5II<]M&$OW,_(J1DY5)&:(!$#P5.24KBJV*3+ITQ#G6
MJP+!(8D(!+#`0!05>W_[=L^!@P1U.))7M2PGPC$SZ.YYT_VZ9[:VML@P<3WF
M^G5GV^RTFMMFM]G"_[4K/T4N>6='A+2)T>J99L_H$*/;;7^SO;V=]2HT:V,S
MRQ3-MHH_O"=6H]G2K$;+)/P1X3_79\1/9AJQHXG#=N"I?!&37;(%#R]?O-CY
M9D.T'9/J!J/1++@@FYNDZL8Q9=7#_NG!\=[^Z>$O!S7RZ1/9<'V7G6.S:JU6
M@]$J$65)Y!-C1P[]<@N'8E-*XI`Z[MBE(X+M'3LD4SLF-DI$(]<AE[:74(V,
MW#CT[`5Q&=EZJ00'8:K0#L1D$\K@JAK7:F1CEVP;-?(7-Y32V")PM_V%&J-D
M8\^>Q&23@*;OSE_O_5B#]SFULL:KK<_Z/_<''_JUIV\QQ`A*LHK&TVDB8-8B
M1K-G6CVKG:%1=%F"HJ[WS.YZ*#:Z'<W2FWD@QLQF(+\SA3%0M6$R_L/4K<['
MG0IHCZHKA>'-F$9"KV^I/W+'.(<YB&YAR_P42<SNIO.7FW48//%A5LBU1[%[
M$KO^A%S'4W@\@L_0F>W$12-NQ"QR9B&?:XT\XRV>P<2A-81F[3S@'EPSF"O0
M+4/:I]T"U'9RFNL*G)\?1>-2-V,T-<MLJ;FM8/]5W'.8X_#7-(JJSQS;?\[(
MV/4S7+O^."#C("+_B)]I1'Q9K^',5:`+:@X3JN_<-LU<>4*]F(+9H*^8!IP#
M0S>MCQK9"D,^*/H%IN\(B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'B=^<S1XK3XD#E\*$;,ZW9U%O$4^C03H;^9NS&M93N`SVX5IXE.J
44*]POJ0"?WE'+?X+RV+TL<PV```Z
`
end


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

* Re: Zle patch - termok change
       [not found] <5fpbgb$lsm$1@coral.primenet.com.au>
@ 1997-03-08 12:19 ` G C Wing
  0 siblings, 0 replies; 6+ messages in thread
From: G C Wing @ 1997-03-08 12:19 UTC (permalink / raw)
  To: zsh-workers

Zefram <zefram@dcs.warwick.ac.uk> writes:
:gwing@primenet.com.au wrote:
:Yuck.  issetflag() evaluates Y twice, and there aren't enough parentheses.

Really, give me an non-extremely convoluted example where my macros would fail.

:But why bother with these macros anyway?  We've always been happy with
:the (much clearer) plain bit operations anyway.

Fine.  Zoltan's removed them anyway with his replacement patch.

Zoltan wrote:
:begin 600 termok-patch.gz

BTW, termok-patch.gz gunzips to a file ``f'', unless you turn original
names off.
Also, the line 

oxtabs = (SGTTYFLAG & SGTABTYPE);

needs to be changed to

oxtabs = ((SGTTYFLAG & SGTABTYPE) == SGTABTYPE);

There is absolutely no guarantee that SGTABTYPE contains unique bits.  On
my machine it's  0xc00 
-- 
Geoff Wing [mason@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


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

end of thread, other threads:[~1997-03-08 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-07  7:23 Zle patch - termok change gwing
1997-03-07  9:43 ` Bart Schaefer
1997-03-07 14:03   ` gwing
1997-03-08  0:14     ` Zoltan T. Hidvegi
1997-03-07 15:03 ` Zefram
     [not found] <5fpbgb$lsm$1@coral.primenet.com.au>
1997-03-08 12:19 ` G C Wing

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).