This is primarily used to add routines to an internal list so that w32start.ew can automatically find event handlers. However it can be used to link and text string to a routine_id, and later you can use w32routine_id() to retrieve the routine_id given the text string.
Example:
registerRoutine("Click_BigButton", routine_id("Click_BigButton")) registerRoutine("MainAction", routine_id("Click_BigButton"))rid = w32routine_id("MainAction") if rid != -1 then call_proc(rid, { . . . }) -- This calls Click_BigButton procedure. end if
See Also: w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Example
sequence s atom aa = w32abs(-1) -- = 1 s = w32abs({-2,-1,{-1,0,1},1,2}) -- = {2,1,{1,0,1},1,2}
See Also: registerRoutine, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
pChar is a single character.
pSet is either a single CharType code or a set of codes.
See w32SetCType for a complete list of valid CharType codes.
Example:
if w32CType( text[i], Alpha_CT) then ... process an alphabetic char elsif w32CType( text[i], Digit_CT) then ... process an digit char end if
See Also: registerRoutine, w32abs, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
This creates a one way hash based on the values of PlainText, Mask and Size.
PlainText is usually a password entered in by a user.
Mask is anything your application wishes to use to ensure that two identical
PlainText values will generate different outputs. For example if this is
used for passwords, the Mask could be the user's ID. Thus two people that
just happen to have the same password cannot know that just by looking at the
output of this function.
Size is the number of encoded characters you wish returned. This can be
any positive integer. The larger the Size the less chance that two different
PlainText - Mask combinations will generate the same output. Values
from 16 to 64 would be sufficient in nearly all cases.
Example:
sequence lCode lCode = w32Encode(PasswordText, UserID, 16)
See Also: registerRoutine, w32abs, w32CType, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
The list must be a sequence of sequences. That is, each element in list must be a sequence containing at least one element. The key is the first element in each sub-sequence of list.
Example:
-- find a value from a list constant aList = { {"red", 17}, {"blue", 10}, {"orange", 299}, {"black", 0} } integer at at = w32findKey( "orange", aList ) -- 'at' should now equal 3. at = w32findKey( "white", aList ) -- 'at' should now equal 0.
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
The element parameter specifies which sub-elements are to be inspected.
Example:
-- find a value from a list constant aList = { {"red", {17, 1, "ap"}}, {"blue", {10,3,"ef"}}, {"orange", {299, 9, "op"}}, {"black", {0,4, "yz"} } } integer at at = w32findKey( "op", aList, {2,3} ) -- 'at' should now equal 3. at = w32findKey( 10, aList, {2,1} ) -- 'at' should now equal 2. at = w32findKey( "gh", aList, {2,3} ) -- 'at' should now equal 0.
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
pChar can either be a single character or a sequence of characters.
Example:
object lRC -- Returns an integer containing the CharType Codes for 'a' lRC = w32GetCType('a') -- Returns a sequence containing the CharType Codes for 'a', '1' and '$' lRC = w32GetCType("a1$")
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Typically used to extract which bits have been set on in a flag.
Example:
-- combine flags integer flags sequence codes codes = w32get_bits( origflag ) if find(WS_EX_CLIENTEDGE, codes) then setText(statusarea, "Client Edge has been specified") end if
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Example:
integer y y = w32hi_word( bigval )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Example
msg = sprintf("%s: %s", { w32iff(ErrType = 'E', "Fatal error", "Warning"), errortext } )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
The new element becomes the pos
This routine also handles positions less than 1. If pos < 1 then it will be changed to length(list)+pos+1, meaning that a value of 0 will add to the end of the list, -1 just before the end, etc... If the recalculated pos is less than 1 then the element is added to the front of the list.
Example
-- Insert the name 'fred' before the 3rd element in the list. nameList = w32insertElement(nameList, 3 , "fred")
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
This searches pSource for pItem and if found, it returns the
corresponding element from pTarget.
If pItem is not found in pSource, then what is returned depends
on a few things.
If pTarget is longer than pSource then the last element in
pTarget is returned. This implements a way to return a default
value of your choosing.
If pTarget is not longer than pSource then if the first element
of pTarget is an atom then zero is returned otherwise an empty
sequence is returned.
Examples:
x = w32lookup('a', "cat", "dog") --> 'o' x = w32lookup('d', "cat", "dogx") --> 'x' x = w32lookup('d', "cat", "dog") --> 0 x = w32lookup("ape", {"ant","bear","cat"}, {"spider","seal","dog"}) --> "" x = w32lookup("ant", {"ant","bear","cat"}, {"spider","seal","dog"}) --> "spider"
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Example:
integer y y = w32lo_word( bigval )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
example:
atom flags flags = w32or_all({WS_CHILD, WS_VISIBLE, WS_BORDER})
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Typically used to encode a message parameter into a 32 bit word.
Example:
-- pack min and max into parameter integer y lParam = w32pack_word( min, max )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
If index is greater than the list length, the list is returned intact. If index is less than 1, it represents the end of the list PLUS the index. So an index of '-1' means the second-last element.
Example:
-- Remove the 4th element from the Name List nameList = w32removeIndex( 4, nameList ) -- Remove the last element. nameList = w32removeIndex( 0, nameList )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Example
-- Remove the name 'fred' from the list. nameList = w32removeItem("fred", nameList)--------------------------------------------------------------------------
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Note this routine will not do recursive replacements. That is, if pNew contains pOld, it doesn't go into a never-ending loop.
Example:
sequence lRes lRes = w32replaceItem("a;b;c;d;e", ";", " ; ") -- gives "a ; b ; c ; d ; e" lRes = w32replaceItem("The ^^ word is correct", "^^", "third") -- gives "The third word is correct"
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
This can only find routines that have been registered via registerRoutine() and is used by w32Start.ew to automatically set handlers based on the standard naming convention for even handlers.
Example:
integer id id = w32routine_id( EventType & "_" & ControlName )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
pChar is the character(s) to set. This can take the form of a single
character such as 'A', a list of characters such as "1234567890", or
a range of characters such as {"a", "z"}.
pSet is either a single CharType code or a list of CharType codes.
The valid CharType codes are ...
Example:
w32SetCType( 255, User1_CT) -- Single char w32SetCType( {"n","z"}, User3_CT ) -- Range of chars w32SetCType( "13579", User2_CT ) -- List of chars
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Typically used to decode Win32 message values
Example:
-- Mouse Position sequence hilo, x, y hilo = upack_word( lParam ) x = w32shortInt(hilo[2]) y = w32shortInt(hilo[1])
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
Typically used to decode Win32 message values when several values are packed into a single number.
Example:
-- extract the low portion from lParam integer x x = w32signed_word( lParam )
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right
pSource is the sequence from which to extract the substrings.
pDelim is the delimiter character, delimiter string, or a set of
single character delimiters.
Note 1 - if pDelim is an atom and not equal to '{' then sections
of text enclosed in matching '{' and '}' are not scanned.
Note 2 - if pDelim is a single string inside a sequence, then
it is considered to be a set of delimiter characters and any one of
them can delimiter the pSource. The results in this case are that
each delimitered text is followed by the sequence containing the
character that caused the delimitation. A final empty sequence means
that no delimiter was found to end the pSource text.
Example:
sequence result result = w32split("if abc = def then xyz()", ' ') ? result -- Should be {"if","abc","=","def","then","xyz()"}------------------------------------------------------ Example of embedded delimiter... result = w32split("event=Click,font={Courier,12}", ',') ? result -- Should be {"event=Click","font={Courier,12}"}
-- Example of delimiter set... result = w32split("event=Click,font={Courier,12}", {"=,{}"}) ? result -- Should be {"event","=","Click",",","font","=","","{","Courier",",","12","}"}
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32TextToNumber, w32trim, w32trim_left, w32trim_right
If the text contains invalid characters, zero is returned.
Note 1: You can supply Hexadecimal values if the value is preceded by a '#' character, Octal values if the value is preceded by a '@' character, and Binary values if the value is preceded by a '!' character. With hexadecimal values, the case of the digits 'A' - 'F' is not important. Also, any period character embedded in the number is used with the correct base.
Note 2: Any underscore or comma characters, that are embedded in the text number are ignored. These can be used to help visual clarity for long numbers.
Note 3: You can supply a leading or trailing, minus or plus sign.
Note 4: You can supply trailing percentage sign(s). Each one present causes the resulting value to be divided by 100.
Note 5: Any single currency symbol to the left of the first digit is ignored.
This function can optionally return information about invalid numbers. If text has the form of {sequence, integer} then if the integer is nonzero, a sequence is returned. The first element is the value converted, and the second is the position in the text where conversion stopped. If no errors were found then this is zero.
sequence rc atom val rc = w32TextToNumber({"12.34a", 1}) -- rc ---> {12.34, 6} -- Error at position 6 rc = w32TextToNumber({"12.34", 1}) -- rc ---> {12.34, 0} -- No errors.val = w32TextToNumber("12.34a") -- val ---> 0
val = w32TextToNumber("#f80c") --> 63500 val = w32TextToNumber("#f80c.7aa") --> 63500.47900390625 val = w32TextToNumber("@1703") --> 963 val = w32TextToNumber("!101101") --> 45 val = w32TextToNumber("12_583_891") --> 12583891 val = w32TextToNumber("12_583_891%") --> 125838.91 val = w32TextToNumber("12,583,891%%") --> 1258.3891
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32trim, w32trim_left, w32trim_right
pSource is the sequence from which to remove whitespace.
If pSource is enclosed in quotes (single or double) they are
removed. This is a way to force leading and/or trailing whitespace
Example:
sequence result result = w32trim(" abc def ") ? result -- Should display "abc def" result = w32trim("\" abc def \"") ? result -- Should display " abc def "----------------------------------------------------
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim_left, w32trim_right
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = w32trim_left(" abc def ") ? result -- Should display "abc def "
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_right
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = w32trim_right(" abc def ") ? result -- Should display " abc def"
See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left