User defined atoms are specified using a small collection of C-functions. Take you inspiration from any of the pre-defined types shown below.
MODULE color;
COMMAND color.blue(X_0:color):int;
COMMENT "Extracts blue component from a color atom";
COMMAND color.cb(X_0:color):int;
COMMENT "Extracts Cb(blue color) component from a color atom";
COMMAND color.color(X_0:str):color;
COMMENT "Converts string to color";
COMMAND color.cr(X_0:color):int;
COMMENT "Extracts Cr(red color) component from a color atom";
COMMAND color.green(X_0:color):int;
COMMENT "Extracts green component from a color atom";
COMMAND color.hsv(X_0:flt, X_1:flt, X_2:flt):color;
COMMENT "Converts an HSV triplets to a color atom";
COMMAND color.hue(X_0:color):flt;
COMMENT "Extracts hue component from a color atom";
COMMAND color.hue(X_0:color):int;
COMMENT "Extracts hue component from a color atom";
COMMAND color.luminance(X_0:color):int;
COMMENT "Extracts Y(luminance) component from a color atom";
COMMAND color.red(X_0:color):int;
COMMENT "Extracts red component from a color atom";
COMMAND color.rgb(X_0:int, X_1:int, X_2:int):color;
COMMENT "Converts an RGB triplets to a color atom";
COMMAND color.saturation(X_0:color):flt;
COMMENT "Extracts saturation component from a color atom";
COMMAND color.saturation(X_0:color):int;
COMMENT "Extracts saturation component from a color atom";
COMMAND color.str(X_0:color):str;
COMMENT "Converts color to string";
COMMAND color.value(X_0:color):flt;
COMMENT "Extracts value component from a color atom";
COMMAND color.value(X_0:color):int;
COMMENT "Extracts value component from a color atom";
COMMAND color.ycc(X_0:int, X_1:int, X_2:int):color;
COMMENT "Converts an YCC triplets to a color atom";
MODULE batcolor;
COMMAND batcolor.blue(X_0:bat[:color]):bat[:int];
COMMENT "Extracts blue component from a color atom";
COMMAND batcolor.cb(X_0:bat[:color]):bat[:int];
COMMENT "Extracts Cb(blue color) component from a color atom";
COMMAND batcolor.color(X_0:bat[:str]):bat[:color];
COMMENT "Converts string to color";
COMMAND batcolor.cr(X_0:bat[:color]):bat[:int];
COMMENT "Extracts Cr(red color) component from a color atom";
COMMAND batcolor.green(X_0:bat[:color]):bat[:int];
COMMENT "Extracts green component from a color atom";
COMMAND batcolor.hsv(X_0:bat[:flt], X_1:bat[:flt], X_2:bat[:flt]):bat[:color];
COMMENT "Converts an HSV triplets to a color atom";
COMMAND batcolor.hue(X_0:bat[:color]):bat[:flt];
COMMENT "Extracts hue component from a color atom";
COMMAND batcolor.hue(X_0:bat[:color]):bat[:int];
COMMENT "Extracts hue component from a color atom";
COMMAND batcolor.luminance(X_0:bat[:color]):bat[:int];
COMMENT "Extracts Y(luminance) component from a color atom";
COMMAND batcolor.red(X_0:bat[:color]):bat[:int];
COMMENT "Extracts red component from a color atom";
COMMAND batcolor.rgb(X_0:bat[:int], X_1:bat[:int], X_2:bat[:int]):bat[:color];
COMMENT "Converts an RGB triplets to a color atom";
COMMAND batcolor.saturation(X_0:bat[:color]):bat[:flt];
COMMENT "Extracts saturation component from a color atom";
COMMAND batcolor.saturation(X_0:bat[:color]):bat[:int];
COMMENT "Extracts saturation component from a color atom";
COMMAND batcolor.str(X_0:bat[:color]):bat[:str];
COMMENT "Identity mapping for string bats";
COMMAND batcolor.value(X_0:bat[:color]):bat[:flt];
COMMENT "Extracts value component from a color atom";
COMMAND batcolor.value(X_0:bat[:color]):bat[:int];
COMMENT "Extracts value component from a color atom";
COMMAND batcolor.ycc(X_0:bat[:flt], X_1:bat[:flt], X_2:bat[:flt]):bat[:color];
COMMENT "Converts an YCC triplets to a color atom";
MODULE blob;
COMMAND blob.blob(X_0:blob):blob;
COMMENT "Noop routine.";
COMMAND blob.blob(X_0:str):blob;
COMMENT "";
COMMAND blob.nitems(X_0:blob):int;
COMMENT "get the number of bytes in this blob.";
COMMAND blob.toblob(X_0:str):blob;
COMMENT "store a string as a blob.";
MODULE batblob;
PATTERN batblob.nitems(X_0:bat[:blob]):bat[:int];
COMMENT "";
PATTERN batblob.nitems(X_0:bat[:blob], X_1:bat[:oid]):bat[:int];
COMMENT "";
MODULE inet;
COMMAND inet.!=(X_0:inet, X_1:inet):bit;
COMMENT "Inequality of two inets";
COMMAND inet.<(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is less than w";
COMMAND inet.<<(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is contained within w";
COMMAND inet.<<=(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is contained within or is equal to w";
COMMAND inet.<=(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is less than or equal to w";
COMMAND inet.=(X_0:inet, X_1:inet):bit;
COMMENT "Equality of two inets";
COMMAND inet.>(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is greater than w";
COMMAND inet.>=(X_0:inet, X_1:inet):bit;
COMMENT "Whether v is equal to or greater than w";
COMMAND inet.>>(X_0:inet, X_1:inet):bit;
COMMENT "Whether v contains w";
COMMAND inet.>>=(X_0:inet, X_1:inet):bit;
COMMENT "Whether v contains or is equal to w";
COMMAND inet.abbrev(X_0:inet):str;
COMMENT "Abbreviated display format as text";
COMMAND inet.broadcast(X_0:inet):inet;
COMMENT "Returns the broadcast address for network";
COMMAND inet.host(X_0:inet):str;
COMMENT "Extract IP address as text";
COMMAND inet.hostmask(X_0:inet):inet;
COMMENT "Construct host mask for network";
COMMAND inet.isnil(X_0:inet):bit;
COMMENT "Nil test for inet value";
COMMAND inet.masklen(X_0:inet):int;
COMMENT "Extract netmask length";
COMMAND inet.netmask(X_0:inet):inet;
COMMENT "Construct netmask for network";
COMMAND inet.network(X_0:inet):inet;
COMMENT "Extract network part of address";
COMMAND inet.new(X_0:str):inet;
COMMENT "Create an inet from a string literal";
COMMAND inet.setmasklen(X_0:inet, X_1:int):inet;
COMMENT "Set netmask length for inet value";
COMMAND inet.text(X_0:inet):str;
COMMENT "Extract IP address and netmask length as text";
MODULE uuid;
COMMAND uuid.isaUUID(X_0:str):bit;
COMMENT "Test a string for a UUID format";
UNSAFE COMMAND uuid.new():uuid;
COMMENT "Generate a new uuid";
COMMAND uuid.new(X_0:int):uuid;
COMMENT "Generate a new uuid (dummy version for side effect free multiplex loop)";
COMMAND uuid.str(X_0:uuid):str;
COMMENT "Coerce a uuid to its string type";
COMMAND uuid.uuid(X_0:str):uuid;
COMMENT "Coerce a string to a uuid, validating its format";
MODULE batuuid;
COMMAND batuuid.isaUUID(X_0:bat[:str]):bat[:bit];
COMMENT "Test a string for a UUID format";
PATTERN batuuid.new(X_0:bat[:int]):bat[:uuid];
COMMENT "Generate a new uuid (dummy version for side effect free multiplex loop)";
PATTERN batuuid.new(X_0:lng):bat[:uuid];
COMMENT "Generate a new uuid (dummy version for side effect free multiplex loop)";
MODULE url;
COMMAND url.extractURLHost(X_0:str, X_1:bit):str;
COMMENT "Extract host from a URL relaxed version";
COMMAND url.getAnchor(X_0:url):str;
COMMENT "Extract the URL anchor (reference)";
COMMAND url.getBasename(X_0:url):str;
COMMENT "Extract the URL base file name";
COMMAND url.getContext(X_0:url):str;
COMMENT "Get the path context of a URL";
COMMAND url.getDomain(X_0:url):str;
COMMENT "Extract Internet domain from the URL";
COMMAND url.getExtension(X_0:url):str;
COMMENT "Extract the file extension of the URL";
COMMAND url.getFile(X_0:url):str;
COMMENT "Extract the last file name of the URL";
COMMAND url.getHost(X_0:url):str;
COMMENT "Extract the server name from the URL strict version";
COMMAND url.getPort(X_0:url):str;
COMMENT "Extract the port id from the URL";
COMMAND url.getProtocol(X_0:url):str;
COMMENT "Extract the protocol from the URL";
COMMAND url.getQuery(X_0:url):str;
COMMENT "Extract the query string from the URL";
COMMAND url.getRobotURL(X_0:url):str;
COMMENT "Extract the location of the robot control file";
COMMAND url.getUser(X_0:url):str;
COMMENT "Extract the user identity from the URL";
COMMAND url.isaURL(X_0:str):bit;
COMMENT "Check conformity of the URL syntax";
COMMAND url.new(X_0:str, X_1:str, X_2:str):url;
COMMENT "Construct URL from protocol, host,and file";
COMMAND url.new(X_0:str, X_1:str, X_2:int, X_3:str):url;
COMMENT "Construct URL from protocol, host, port, and file";
COMMAND url.url(X_0:str):url;
COMMENT "Create an URL from a string literal";
COMMAND url.url(X_0:url):url;
COMMENT "Create an URL from a string literal";
MODULE xml;
COMMAND xml.aggr(X_0:bat[:xml]):xml;
COMMENT "Aggregate the XML values.";
COMMAND xml.attribute(X_0:str, X_1:str):xml;
COMMENT "Construct an attribute value pair";
COMMAND xml.comment(X_0:str):xml;
COMMENT "Construct an comment struction";
COMMAND xml.concat(X_0:xml, X_1:xml):xml;
COMMENT "Concatenate the xml values";
COMMAND xml.content(X_0:str):xml;
COMMENT "Check the value for compliance as content, i.e. it may contain multiple roots and character data.";
COMMAND xml.document(X_0:str):xml;
COMMENT "Check the value for compliance as XML document";
COMMAND xml.element(X_0:str, X_1:xml, X_2:xml, X_3:xml):xml;
COMMENT "The basic building block for XML elements are namespaces, attributes and a sequence of xml elements. The name space and the attributes may be left unspecified(=nil:bat).";
COMMAND xml.element(X_0:str, X_1:xml):xml;
COMMENT "The basic building block for XML elements are namespaces, attributes and a sequence of xml elements. The name space and the attributes may be left unspecified(=nil:bat).";
COMMAND xml.epilogue():void;
COMMENT "";
PATTERN xml.forest(X_0:xml...):xml;
COMMENT "Construct an element list";
COMMAND xml.isdocument(X_0:str):bit;
COMMENT "Validate the string as a document";
COMMAND xml.parse(X_0:str, X_1:str, X_2:str):xml;
COMMENT "Parse the XML document or element string values";
COMMAND xml.pi(X_0:str, X_1:str):xml;
COMMENT "Construct a processing instruction";
COMMAND xml.root(X_0:xml, X_1:str, X_2:str):xml;
COMMENT "Construct the root nodes";
COMMAND xml.str(X_0:xml):str;
COMMENT "Cast the string to an xml compliant string";
COMMAND xml.subaggr(X_0:bat[:xml], X_1:bat[:oid], X_2:bat[:any_1], X_3:bit):bat[:xml];
COMMENT "Grouped aggregation of XML values.";
COMMAND xml.subaggr(X_0:bat[:xml], X_1:bat[:oid], X_2:bat[:any_1], X_3:bat[:oid], X_4:bit):bat[:xml];
COMMENT "Grouped aggregation of XML values with candidates list.";
COMMAND xml.text(X_0:xml):str;
COMMENT "Extract text from an xml atom";
COMMAND xml.xml(X_0:str):xml;
COMMENT "Cast the string to an xml compliant string";
MODULE batxml;
COMMAND batxml.attribute(X_0:str, X_1:bat[:str]):bat[:xml];
COMMENT "Construct an attribute value pair.";
COMMAND batxml.comment(X_0:bat[:str]):bat[:xml];
COMMENT "Create an XML comment element.";
COMMAND batxml.concat(X_0:bat[:xml], X_1:bat[:xml]):bat[:xml];
COMMENT "Concatenate the XML values.";
COMMAND batxml.content(X_0:bat[:str]):bat[:xml];
COMMENT "Parse the string as XML element content.";
COMMAND batxml.document(X_0:bat[:str]):bat[:xml];
COMMENT "Parse the string as an XML document.";
COMMAND batxml.element(X_0:str, X_1:xml, X_2:xml, X_3:bat[:xml]):bat[:xml];
COMMENT "The basic building block for XML elements are namespaces, attributes and a sequence of XML elements. The name space and the attributes may be left unspecified(=nil).";
COMMAND batxml.element(X_0:str, X_1:bat[:xml]):bat[:xml];
COMMENT "The basic building block for XML elements are namespaces, attributes and a sequence of XML elements. The name space and the attributes may be left unspecified.";
PATTERN batxml.forest(X_0:bat[:xml]...):bat[:xml];
COMMENT "Construct an element list.";
COMMAND batxml.isdocument(X_0:bat[:str]):bat[:bit];
COMMENT "Validate the string as a XML document.";
COMMAND batxml.options(X_0:str, X_1:str, X_2:bat[:xml]):bat[:xml];
COMMENT "Create the components including NULL conversions.";
COMMAND batxml.parse(X_0:str, X_1:bat[:str], X_2:str):bat[:xml];
COMMENT "Parse the XML document or element string values.";
COMMAND batxml.pi(X_0:str, X_1:bat[:xml]):bat[:xml];
COMMENT "Construct a processing instruction.";
COMMAND batxml.root(X_0:bat[:xml], X_1:str, X_2:str):bat[:xml];
COMMENT "Contruct the root nodes.";
COMMAND batxml.serialize(X_0:bat[:xml]):bat[:str];
COMMENT "Serialize the XML object to a string.";
COMMAND batxml.str(X_0:bat[:xml]):bat[:str];
COMMENT "Cast the xml to a string.";
COMMAND batxml.text(X_0:bat[:xml]):bat[:str];
COMMENT "Serialize the XML object to a string.";
COMMAND batxml.xml(X_0:bat[:str]):bat[:xml];
COMMENT "Cast the string to an xml compliant string.";
COMMAND batxml.xquery(X_0:bat[:str], X_1:str):bat[:xml];
COMMENT "Execute the XQuery against the elements.";