uuid.ew user's manual

NAME: UUID.EW
OBJECT: functions to get a UUID (Universally Unique Identifiers) and other related functions. UUID or GUID aside from being used by COM objects, can also be used, among other things, to generate keys for database records ensuring uniqueness of each key.
REF: msdn library, RPC functions reference
AUTHOR: Jacques Deschênes, Baie-Comeau, Canada
DATE: 2006-07-20
REQUIREMENTS: To know the requirement of each function consult above REF.
LICENCE: public domain

library global constants
uuid_version library version {major, minor, revision}
UUID_SIZE size of UUID record
RPC_S_OK The call succeeded.
RPC_S_UUID_LOCAL_ONLY The UUID is guaranteed to be unique to this computer only.
RPC_S_UUID_NO_ADDRESS Cannot get Ethernet or token-ring hardware address for this computer.
RPC_S_OUT_OF_MEMORY The system is out of memory.


library global variables
global atom uuid_last_status last status code reported by a call to one of the API function.


library global functions and procedures
function:UuidCompare(atom pUuid1, atom pUuid2)
description:compare 2 uuid for sort order.
arguments:pUuid1 pointer to first uuid
pUuid2 pointer to uuid2
return:if uuid1 < uuid2 return -1, if equal return 0, if uuid1 > uuid2 return 1

function:UuidCreate()
description: create a uuid. A UUID structure is allocated and returned. Caller is responsible to deallocate it.
arguments: none
return: pointer to UUID structure

function:UuidCreateNil()
description: create a nil uuid. i.e. 00000000-0000-0000-0000-00000000
A UUID structure is allocated and returned. Caller is responsible to deallocate it.
arguments: none
return: pointer to UUID structure

function:UuidCreateSequential()
description: create a uuid using NIC MAC address, garanteed to be globally unique. A pointer to UUID structure is created. Caller is responsible to deallocate it
arguments: none
return: pointer to UUID structure

function:UuidEqual(atom pUuid1, atom pUuid2)
description: compare 2 uuid for equality
arguments:pUuid1 pointer to first UUID to compare
pUuid2 pointer to second UUID to compare.
return: TRUE/FALSE

function: UuidFromString(sequence uuid)
description: (ANSI version) Convert a string representation of a uuid to its binary form.
arguments:uuid string representing an uuid.
return: return a pointer to UUID. Caller responsible to deallocate it.
If function fail return 0

function: UuidHash(atom pUuid)
description: generate a hash value from a UUID.
arguments:pUuid pointer to UUID to hash
return: integer resulting from UUID hashing.

function: UuidIsNil(atom pUuid
description: Check if UUID is a nil UUID i.e. 00000000-0000-0000-0000-00000000
arguments:pUuid Pointer to UUID.
return: TRUE/FALSE

function: UuidToString(atom pUuid)
description: (ANSI version) Convert a UUID to its string representation.
arguments: pUuid Pointer to UUID to convert to string
return: string representing UUID

function: UuidToSequence(atom pUuid)
description: Return a sequence from binary representation of UUID.
Sequence format: {ULONG,USHORT,USHORT,{UCHAR,UCHAR,UCHAR,UCHAR,UCHAR,UCHAR,UCHAR,UCHAR}}
arguments: pUuid Pointer to UUID structure.
return: Sequence representing the UUID

function: UuidFromSequence(sequence UuidSeq)
description: Convert a sequence obtained from UuidToSequence back to its binary form.
arguments: UuidSeq Sequence containing the UUID.
return: Pointer to UUID structure. The caller is responsible to deallocate it.