[an error occurred while processing this directive]
WIK - ProTERM Macros: Hex
Hex Library
Hexadecimal, bitwise, and miscellaneous functions for ProTERM 1.2.
Current version is 1.2.3 (GESTALT(wik_hex) == "010203").
Resident User Hex is distributed with ProTERM, in the ":Macros:Contributed:Boo's Goodies:" folder.
Conversion Functions
- hch2num(STR hex, INT pos)
Convert hexadecimal digit (0-F) to base ten (0-15)
- hex2asc(STR hex)
Convert hexadecimal pairs to ASCII characters
(similar to, but slightly different behavior from STR_FROMHEX)
- asc2hex(STR ascii)
Convert ASCII string to hexadecimal pairs (obsoleted by STR_TOHEX)
- hex2int(STR hex)
Convert hexadecimal to integer
- asc2int(STR ascii) -- same as NUM_LONG
Convert ASCII string to integer (included for completeness)
- int2asc(INT num) -- same as STR_LONG
Convert integer to ASCII string (included for completeness)
- int2hex(INT num)
Convert integer to hexadecimal (maxint: 2,147,483,647)
- intclen(INT num)
Returns # of ascii chars available in integer
(maxint: 2,147,483,647)
- BIT_GET(INT num, INT bitnum)
Get a bit from a numerical longword
- HEX2BIT(STR hex, INT pos, INT bitnum)
Get a bit from one digit of a hex string
- SBYT(INT num)
Convert unsigned byte (0-255) to signed (-128 to 127)
- UBYT(INT num)
Convert signed byte (-128 to 127) to unsigned (0-255)
- SWRD(INT num)
Convert unsigned word (0-65535) to signed (-32768 to 32767)
- UWRD(INT num)
Convert signed word (-32768 to 32767) to unsigned (0-65535)
- SCALE(number,from_scale,to_scale)
Convert a number from one scale to another. You can use it to change
16-bit colors to 8-bit colors, both decimal and hex. Maximum input is
65535.
- POWER(INT base, INT power)
Raise number to power
Decision Functions
- CHOOSE(INT index, value_1, value_2 [, ...])
Select from a list of values
- IIF(INT bool, value_if_true, value_if_false)
Immediate IF function, for compactness
Information Functions
- IS_ODD(INT num)
Return true if number is odd
- SYS_GESTALT(STR selector [, STR format | INT flag])
Returns system gestalt values in 7 different formats
Progress Window
- STA_CREATE(STR title, STR msg1, STR msg2)
Create status window. Use STA_UPDATE() to update the window
and check for the Stop button, and D_CLOSE() to close the window
- STA_UPDATE(INT win, INT percent, STR msg1, STR msg2)
Update status window
Obsolete Functions
- GET_NAME(STR itemname)
Get value of NameFlag, or list of NameFlags. Probably obsoleted by
my PrefsLib functions, and will definitely be obsoleted by my
forthcoming ASA library.
- SET_NAME(STR itemname, INT value)
Set value of NameFlag. Probably obsoleted by my PrefsLib functions,
and will definitely be obsoleted by my forthcoming
ASA library.
(wik, April 18, 1997)
[an error occurred while processing this directive] visits since 97.04.18