Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference

Logical Functions

Return to Main Page


BitAnd

Description

Performs a bitwise AND operation on two or more integer expressions and returns the result.

Syntax

FUNCTION BitAnd (VAL bits: INTEGER ...): INTEGER;

Argument Notes

Argument Name Description
bits An integer expression

Example

 IF BitAnd(winStyle, $WinTitle) <> 0 THEN
 -- The window style calls for a title bar.
 ...
 END;

See Also


BitNot

Description

Returns the bitwise inverse of the argument.

Syntax

FUNCTION BitNot (VAL bits: INTEGER): INTEGER;

Argument Notes

Argument Name Description
bits An integer of single bit values

Notes

BitNot changes every bit in its argument to its binary inverse: 0 becomes 1 and 1 becomes 0.

Example

WinCreate($Desktop, myWindow, MyHandler, 10, 10, 80, 25,
 'Example', BitAnd($WinDefaultStyle, BitNot
 ($WinSysMenu)));
-- myWindow is created with the all of the default window
-- styles except that it has no system menu.

See Also


BitOr

Description

Performs a bitwise OR operation on two or more integer expressions and returns the result.

Syntax

FUNCTION BitOr (VAL bits: INTEGER ...): INTEGER;

Argument Notes

Argument Name Description
bits An integer expression whose bits are to be combined with those in other expressions by using an OR operator.

Example

answer := WinMessageBox($Desktop, 'Error',
 BitOr($MBIconError,
 $MBAbortRetryIgnore,
 $MBDefButton2, $MBMoveable),
 'Operation Failed');

See Also


BitXOr

Description

Performs a bitwise exclusive Or (XOR) operation on the input integer expressions and returns the result. An exclusive Or operation returns 1 if the operands are different.

Syntax

FUNCTION BitXOr (VAL bits: INTEGER ...): INTEGER;

Argument Notes

Argument Name Description
bits An integer expression whose bits are to be combined with those of other integer expressions, using an XOR operator.

Example

PROCEDURE EncryptText (REF text: LIST OF STRING,
                       VAL mask: INTEGER)
IS
(* Encrypt the given text by XORing the mask over each
 character. While not very secure, it is simple
 and has the advantage that decryption is accomplished
 by calling EncryptText again with the same mask.*)
VARIABLES
 i: INTEGER;
ACTIONS
 FOR text DO
 FOR i := 1 TO StrLength(text[$CURRENT]) DO
 text[$CURRENT][i] :=
 Char(BitXOr(CharCode(text[$CURRENT][i]), mask));
 END;
 END;
END;

See Also


Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference

Return to Main Page

Copyright