| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- program t82_setin;
- { t82 -- `in' with a RUN-TIME element.
- CALC.INC's Clear loop is `until Upcase(Ch) in ['Y','N']': the element is a
- value in AX, not a compile-time constant, so the bit test has to run. The
- set may be an inline literal (code-resident), a typed constant (also
- code-resident) or a data set (a record field): the address is chosen
- accordingly, then byte = (e - base) DIV 8 and bit = (e - base) MOD 8.
- Also covers `Ch in ['a'..'z']' (a range in a literal) and an enumerated data
- set with both a present and an absent element. }
- const
- Digits : set of Char = ['0'..'9'];
- type
- Attr = (Constant, Formula, Txt, OverWritten, Locked, Calculated);
- Cell = record
- S : set of Attr;
- N : integer;
- end;
- var
- c : char;
- i : integer;
- sh : array [1..2, 1..3] of Cell;
- begin
- c := 'Y';
- if Upcase (c) in ['Y', 'N'] then writeln ('yes') else writeln ('no');
- c := 'x';
- if Upcase (c) in ['Y', 'N'] then writeln ('yes') else writeln ('no');
- c := 'a';
- if c in ['a'..'z'] then writeln ('lower') else writeln ('not');
- c := 'A';
- if c in ['a'..'z'] then writeln ('lower') else writeln ('not');
- sh[1,1].S := [Locked];
- i := 1;
- if i in sh[1,1].S then writeln ('locked') else writeln ('not-locked');
- i := 4;
- if i in sh[1,1].S then writeln ('locked') else writeln ('not-locked');
- c := '7';
- if c in Digits then writeln ('digit') else writeln ('not');
- c := 'x';
- if c in Digits then writeln ('digit') else writeln ('not')
- end.
|