Documentation for Win32lib v0.70.18
Table of Contents

Support Routines

Miscellaneous 'generic' routines used by win32lib


These routines can be used by many applications as they are not specific to the Win32Lib library.

  • proc addToCType(object pChar,object pSet)   Adds characters to one or more sets.
  • func ansiLower(object Text)   Converts a 8-bit encoded string to lower case, using the current codepage.
  • func ansiUpper(object Text)   Converts a 8-bit encoded string to upper case, using the current codepage.
  • proc registerRoutine(sequence pRoutineName, integer pRoutineId)   Registers a text string with an associated routine_id.
  • proc removeFromCType(object pChar,object pSet)   Removes characters from one or more sets.
  • func setDecimalMark(integer new_mark)   Gets and possibly sets the decimal mark w32TextToNumner() is to recognise.
  • func w32abs( object a )   Absolute value.
  • func w32average(sequence data,object weight)    Computes the weighted average of data using the weight(s) weight.
  • func w32CType( object pChar, object pSet)   Tests a character to see if it 'belongs' to a specified CharType set.
  • func w32Encode(sequence PlainText, sequence Mask, integer Size)   This routine transforms a string into an encoded form
  • func w32extract_formats(sequence s)   Determines all substrings of i s which are format specifiers
  • func w32findKey( object key, sequence list )    Find the element in list that has key as its first element.
  • func w32findKeyEx( object key, sequence list, object element )   Find key in list using the depth indicated in element.
  • func w32GetCType( object pChar)   Gets the CharType for the specified character(s)
  • func w32get_bits( atom b32 )    Does the reverse of w32or_all() in that it gets all the bit values from an atom.
  • func w32hi_word( atom pData)    returns the high 16 bits of pData
  • func w32iff (atom test, object ifTrue, object ifFalse)   Used to embed an 'if' test inside an expression.
  • func w32index(sequence s)    Returns the list of positions of items in s.
  • func w32index_by(sequence s,integer field)    Indexes s using the field number field.
  • func w32insertElement( sequence list, integer pos, object item )    Inserts the object into the list at position pos
  • func w32join(sequence substrings,object delimiter,integer flag)   Builds a string by concatenating itmes in substrings, separated by delimiters.
  • func w32lookup(object pItem, sequence pSource, sequence pTarget)   Returns the corresponding element.
  • func w32lo_word( atom pData)    returns the low-16 bits of pData
  • func w32ordered_find(object x,sequence s,integer verif)    Uses a binary tree search to find x in s, possibly
  • func w32or_all( object pData )    Calculates a binary OR against each element in pData
  • func w32pack_word( integer low, integer high )   Packs values into word.
  • func w32rectangle_delta(object r1,object r2, integer typecheck)   Determines the difference and intersection between two rectangles
  • func w32remainder(object a,object b)    Ensures that the result has the sign of b, contrary to remainder().
  • func w32removeIndex( integer index, sequence list )    Remove the element at position index from the sequence list
  • func w32removeItem( object item, sequence list)    Removes item from the list, if it is in the list.
  • func w32replaceItem(sequence pList, object pOld, object pNew)    Replaces all occurances of pOld with pNew
  • func w32round(object a,object b,integer flag)    Rounds a, or all the atoms in the sequence a, to some multiple of b.
  • func w32routine_id(sequence pRoutineName)    Returns the routine id for the registered routine pRoutineName
  • proc w32SetCType( object pChar, object pSet)    Sets one or more character types used by w32CType and w32GetCType
  • func w32shortInt( atom a )   Converts a number into a 16-bit signed integer
  • func w32signed_word( atom a )    Converts a into a signed 16-bit integer.
  • func w32split(sequence pSource, object pDelim)   Returns the undelimited substrings
  • func w32TextToNumber( sequence text )   This converts the text into a number.
  • func w32to_string( object pData )   Converts the parameter to a string repesentation of its value.
  • func w32trim(object pSource)    Removes any whitespace chars from both ends of pSource
  • func w32trim_left(sequence pSource)    Removes any whitespace chars from the beginning of pSource
  • func w32trim_right(sequence pSource)    Removes any whitespace chars from the end of pSource
  • func w32unpack_dword( atom a )   Converts a number into two 16-bit integers

    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    addToCType
    (object pChar,object pSet)

    Adds characters to one or more sets.

    Category: Support Routines

    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.

    See Also: ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    ansiLower
    (object Text)

    Converts a 8-bit encoded string to lower case, using the current codepage.

    Returns: (SEQUENCE) The converted string.

    Category: Support Routines

    See Also: addToCType, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    ansiUpper
    (object Text)

    Converts a 8-bit encoded string to upper case, using the current codepage.

    Returns: (SEQUENCE) The converted string.

    Category: Support Routines

    See Also: addToCType, ansiLower, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    registerRoutine
    (sequence pRoutineName, integer pRoutineId)

    Registers a text string with an associated routine_id.

    Category: Support Routines

    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 a text string to a routine_id, and later you can use w32routine_id() to retrieve the routine_id given the text string. For instance, this routine has been used extensively to enable a sub include file to call a routine in another file without making the routine global, nor its routine_id.

    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: addToCType, ansiLower, ansiUpper, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    removeFromCType
    (object pChar,object pSet)

    Removes characters from one or more sets.

    Category: Support Routines

    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.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setDecimalMark
    (integer new_mark)

    Gets and possibly sets the decimal mark w32TextToNumner() is to recognise.

    Returns: (INTEGER) The previous or current value.

    Category: Support Routines

    new_mark is either '.', ',', w32DECIMAL_DOT, w32DECIMAL_COMMA or w32GetValue. Negative values are considered to be w32GetValue, positive unknown value are assumed to be w32DECIMAL_DOT. If the new mark is not w32GetValue, the new mark becomes the decimal mark w32TextToNumber() will use. The former value is always returned.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32abs
    ( object a )

    Absolute value.

    Returns: Absolute value of the atom or sequence.

    Category: Support Routines

    Example

           sequence s
           atom a
    

    a = w32abs(-1) -- = 1 s = w32abs({-2,-1,{-1,0,1},1,2}) -- = {2,1,{1,0,1},1,2}

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32average
    (sequence data,object weight)

    Computes the weighted average of data using the weight(s) weight.

    Returns: (OBJECT) The ratio sum_of_data/sum_of_weights.

    Category: Support Routines

    If data is not homogeneous, or weight is a sequence and has a sequence element, or the supplied weight is 0, or the sum of supplied weights is 0, then an "absurd" value is returned: 0 if data[1] is a sequence, else {}./n Extra data or weights are discarded./n If data or weight is an empty sequence, 0 is returned.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32CType
    ( object pChar, object pSet)

    Tests a character to see if it 'belongs' to a specified CharType set.

    Returns: OBJECT: w32True or w32False if pChar is an atom, a sequence of these otherwise..

    Category: Support Routines

    pChar is the character(s) to check. 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 set of codes.
    See w32SetCType for a complete list of valid CharType codes.
    w32True is returned only if the character belongs to all sets pSet refers to. Only single byte characters are supported.

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32Encode
    (sequence PlainText, sequence Mask, integer Size)

    This routine transforms a string into an encoded form

    Returns: SEQUENCE: A set of Size ascii digits.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32extract_formats
    (sequence s)

    Determines all substrings of i s which are format specifiers

    Returns: (SEQUENCE) A triple of lists: starting points, status, end points.

    Category: Support Routines

    The returned lists have the same length:

  • the first list holds the indexes of the starting '%' of the assumed format specifiers;
  • the second list holds a 1 to mark an actual specifier, else a 0.
  • the third list holds the terminating indexes of the assumesd format specifiers; When a format specifier is succesfully parsed, its terminating index is the index of its last character. Otherwise, it is the index of the first illegal character found past it starting index.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32findKey
    ( object key, sequence list )

    Find the element in list that has key as its first element.

    Returns: INTEGER: The index for the item that contains key. Zero if not found.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32findKeyEx
    ( object key, sequence list, object element )

    Find key in list using the depth indicated in element.

    Returns: INTEGER: The index for the item that contains key. Zero if not found.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32GetCType
    ( object pChar)

    Gets the CharType for the specified character(s)

    Returns: Same datatype as pChar: The CharType code for the character(s)

    Category: Support Routines

    pChar is the character(s) to check. 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"}.

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32get_bits
    ( atom b32 )

    Does the reverse of w32or_all() in that it gets all the bit values from an atom.

    Returns: Sequence: The non-zero bits set in b32.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32hi_word
    ( atom pData)

    returns the high 16 bits of pData

    Returns: INTEGER: Bits 31-16 of the parameter as a 16 bit value.

    Category: Support Routines

    Example:

    integer y
    y = w32hi_word( bigval )
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32iff
    (atom test, object ifTrue, object ifFalse)

    Used to embed an 'if' test inside an expression.

    Returns: If test is true then ifTrue is returned otherwise ifFalse is returned.

    Category: Support Routines

    Example

             msg = sprintf("%s: %s", {
                          w32iff(ErrType = 'E', "Fatal error", "Warning"),
                          errortext } )
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32index
    (sequence s)

    Returns the list of positions of items in s.

    Returns: (SEQUENCE) A sequence s1 such that s1[i] is the position of the i-th item of sort(s).

    Category: Support Routines

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32index_by
    (sequence s,integer field)

    Indexes s using the field number field.

    Returns: (SEQUENCE) A sequence of indexes like w32index().

    Category: Support Routines

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32insertElement
    ( sequence list, integer pos, object item )

    Inserts the object into the list at position pos

    Returns: The list with the item inserted.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32join
    (sequence substrings,object delimiter,integer flag)

    Builds a string by concatenating itmes in substrings, separated by delimiters.

    Returns: (SEQUENCE) a whole sequence made from all substrings stitched together.

    Category: Support Routines

    If the w32DELIM_FIRST flag is set, the returned string will start by the delimiter. If the w32DELIM_LAST flag is set, the returned string will end with the delimiter.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32lookup
    (object pItem, sequence pSource, sequence pTarget)

    Returns the corresponding element.

    Returns: OBJECT: The corresponding element or 0/{} if not found.

    Category: Support Routines

    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. If pTarget is empty, then 0 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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32lo_word
    ( atom pData)

    returns the low-16 bits of pData

    Returns: INTEGER: Bits 15-0 of the parameter

    Category: Support Routines

    Example:

    integer y
    y = w32lo_word( bigval )
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32ordered_find
    (object x,sequence s,integer verif)

    Uses a binary tree search to find x in s, possibly

    Returns: (INTEGER) The position of x in s, if any, or the opposite of the

    Category: Support Routines

    checking if s is well ordered. position it would have if inserted. verif is nonzero if it is desired to check whether s is increasing or decreasing. A value of 0 skips the check. 0 is returned if the check fails. If x would be inserted at the end of s, -1-length(/i s) is returned. If s is {}, 0 is returned. If s has length 1, it is assumed to be increasing.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32or_all
    ( object pData )

    Calculates a binary OR against each element in pData

    Returns: ATOM: The OR'd value

    Category: Support Routines

    example:

          atom flags
          flags = w32or_all({WS_CHILD, WS_VISIBLE, WS_BORDER})
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32pack_word
    ( integer low, integer high )

    Packs values into word.

    Returns: ATOM: 32 bit word with low value in low 16 bits, high value in high 16 bits.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32rectangle_delta
    (object r1,object r2, integer typecheck)

    Determines the difference and intersection between two rectangles

    Returns: (SEQUENCE) {} on failure, else {r1-r2, r1 inter r2, r2-r1}.

    Category: Support Routines

    r1 or r2 may be atoms, in hich case they are RAM addresses to peek4s() a rectangle from.
    If r1 or r2 is not a sequence of four signed integers, nor an atom, then {} is returned.
    If the left position is not less than the right position, or the top position is not less than the bottom position, for any of the rectangles, {} is returned if typechecking was requested.
    Otherwise, the returned sequence has length 3:

  • the first element is a possibly empty list of non overlapping rectangles, whose union is the part of r1 which lies outside r2.
  • the last element is a possibly empty list of non overlapping rectangles, whose union is the part of r2 which lies outside r1.
  • the middle element is a rectangle, the intersection of r1 and r2. If the rectangles don't meet, the middle element is {} (an empty rectangle).

    Note that the whole type checking is performed if typecheck is not zero, and skipped for speed if it is zero.

    All rectangles are given {left,top,right,bottom}.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32remainder
    (object a,object b)

    Ensures that the result has the sign of b, contrary to remainder().

    Returns: (ATOM) The remainder of a divided by b, the result having the sign of b.

    Category: Support Routines

    remainder() returns a result which has the sign of a.
    This function extends to sequences.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32removeIndex
    ( integer index, sequence list )

    Remove the element at position index from the sequence list

    Returns: The list without the element.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32removeItem
    ( object item, sequence list)

    Removes item from the list, if it is in the list.

    Returns: The list without the item.

    Category: Support Routines

    Example

         -- Remove the name 'fred' from the list.
         nameList = w32removeItem("fred", nameList)
    
    --------------------------------------------------------------------------

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32replaceItem
    (sequence pList, object pOld, object pNew)

    Replaces all occurances of pOld with pNew

    Returns: SEQUENCE: Updated pList.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32round
    (object a,object b,integer flag)

    Rounds a, or all the atoms in the sequence a, to some multiple of b.

    Returns: The rounded value(s).

    Category: Support Routines

    This function extends to sequences, except for the flag argument.
    The way the rounded value is reckoned from a is defined by flag. Supported values are:

  • w32RoundDown: round to the highest less or equal multiple of b
  • w32RoundUp: round to the lowest greater or equal multiple of b
  • w32RoundToZero: round to the closest multiple of b betwaeen a and 0.0
  • w32RoundToInf: round to the closest multiple of b betwaeen a and the infinity.
  • w32RoundScientific: round to closest multiple of b. If there is a tie, ensure deterministic evenness of choices.
  • w32RoundCommercial: round to closest multiple of b.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32routine_id
    (sequence pRoutineName)

    Returns the routine id for the registered routine pRoutineName

    Returns: INTEGER: The routine id or -1 if pRoutineName is not registered.

    Category: Support Routines

    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 event handlers.

    Example:

      integer id
      id = w32routine_id( EventType & "_" & ControlName )
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    w32SetCType
    ( object pChar, object pSet)

    Sets one or more character types used by w32CType and w32GetCType

    Category: Support Routines

    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 ...

  • Control_CT
  • Alpha_CT
  • Digit_CT
  • Punct_CT
  • Symbol_CT
  • White_CT
  • Lowercase_CT
  • Uppercase_CT
  • Printable_CT
  • NameChar_CT
  • User1_CT
  • User2_CT
  • User3_CT
  • User4_CT
  • User5_CT
  • User6_CT
  • AlphaNumeric_CT (a combination of Alpha_CT and Digit_CT)

    You may define new character sets: the associated value must be a power of 2 greater than #8000 and less than #20000000.

    Example:

          w32SetCType( 255, User1_CT) -- Single char
          w32SetCType( {"n","z"}, User3_CT ) -- Range of chars
          w32SetCType( "13579", User2_CT ) -- List of chars
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32shortInt
    ( atom a )

    Converts a number into a 16-bit signed integer

    Returns: INTEGER: The value of a as a short int, in the -32,768..32767 range.

    Category: Support Routines

    Typically used to decode Win32 message values

    Example:

    -- Mouse Position
    sequence hilo, x, y
    lohi = w32unpack_dword( lParam )
    x = w32shortInt(lohi[2])
    y = w32shortInt(lohi[1])
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32signed_word
    ( atom a )

    Converts a into a signed 16-bit integer.

    Returns: INTEGER: Signed 16 bits of a 32 bit word.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32split
    (sequence pSource, object pDelim)

    Returns the undelimited substrings

    Returns: SEQUENCE: A set of sequences, one per delimited substring in pSource

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32TextToNumber
    ( sequence text )

    This converts the text into a number.

    Returns: Atom: The number represented by the text.

    Category: Support Routines

    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 characters or thousands separators, that are embedded in the text number are ignored. These can be used to help visual clarity for long numbers. The thousands separator is ',' if the decimal mark is '.' (the default), or '.' if it is ','. You inspect and set it using setDecimalMark().

    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. A currency symbol is any character of the string: "$£¤¥€". A currency symbol may have no digit before it, and must be followed by a dot or digit. If there is none, a single trailing currency sign will be ignored, but there must not be any digit past it.

    Note 6: Leading characters may appear in any order and be mixed. Only the sign or base symbol further inside is taken into acount.

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32to_string, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32to_string
    ( object pData )

    Converts the parameter to a string repesentation of its value.

    Returns: SEQUENCE: A string representation of the parameter.

    Category: Support Routines

    -------------------------------------

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32trim
    (object pSource)

    Removes any whitespace chars from both ends of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    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: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim_left, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32trim_left
    (sequence pSource)

    Removes any whitespace chars from the beginning of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    pSource is the sequence from which to remove whitespace.
    Example:

           sequence result
           result = w32trim_left("  abc def  ")
           ? result  -- Should display "abc def  "
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_right, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32trim_right
    (sequence pSource)

    Removes any whitespace chars from the end of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    pSource is the sequence from which to remove whitespace.
    Example:

           sequence result
           result = w32trim_right("  abc def  ")
           ? result  -- Should display "  abc def"
    

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32unpack_dword


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    w32unpack_dword
    ( atom a )

    Converts a number into two 16-bit integers

    Returns: (SEQUENCE) The pair {low word,high word}

    Category: Support Routines

    Typically used to decode Win32 message values.

    See Also: addToCType, ansiLower, ansiUpper, registerRoutine, removeFromCType, setDecimalMark, w32abs, w32average, w32CType, w32Encode, w32extract_formats, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32index, w32index_by, w32insertElement, w32join, w32lookup, w32lo_word, w32ordered_find, w32or_all, w32pack_word, w32rectangle_delta, w32remainder, w32removeIndex, w32removeItem, w32replaceItem, w32round, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32to_string, w32trim, w32trim_left, w32trim_right