atom uuid;

# the atom functions
command cmp() address UUIDcompare;
command fromstr() address UUIDfromString;
command hash() address UUIDhash;
command null() address UUIDnull;
command read() address UUIDread;
command tostr() address UUIDtoString;
command write() address UUIDwrite;

# fix up the rest of the atom definition
command prelude():void address UUIDprelude;
uuid.prelude();

command new() :uuid
address UUIDgenerateUuid
comment "Generate a new uuid";

command uuid(s:str):uuid
address UUIDstr2uuid
comment "Coerce a string to a uuid, validating its format";

command str(u:uuid):str
address UUIDuuid2str
comment "Coerce a uuid to its string type";

command isaUUID(u:str):bit
address UUIDisaUUID
comment "Test a string for a UUID format";

module calc;

command uuid(s:str):uuid
address UUIDstr2uuid
comment "Coerce a string to a uuid, validating its format";

function uuid(u:uuid):uuid;
 return u;
end uuid;

command str(s:uuid):str
address UUIDuuid2str
comment "Coerce a uuid to a string type";

pattern ==(l:uuid,r:uuid):bit
address CMDvarEQ
comment "Return V1 == V2";

pattern !=(l:uuid,r:uuid):bit
address CMDvarNE
comment "Return V1 != V2";

pattern <(l:uuid,r:uuid):bit
address CMDvarLT
comment "Return V1 < V2";

pattern <=(l:uuid,r:uuid):bit
address CMDvarLE
comment "Return V1 <= V2";

pattern >(l:uuid,r:uuid):bit
address CMDvarGT
comment "Return V1 > V2";

pattern >=(l:uuid,r:uuid):bit
address CMDvarGE
comment "Return V1 >= V2";

module batcalc;

pattern ==(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatEQ
comment "Return B1 == B2";

pattern !=(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatNE
comment "Return B1 != B2";

pattern <(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatLT
comment "Return B1 < B2";

pattern <=(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatLE
comment "Return B1 <= B2";

pattern >(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatGT
comment "Return B1 > B2";

pattern >=(b1:bat[:uuid],b2:bat[:uuid]) :bat[:bit]
address CMDbatGE
comment "Return B1 >= B2";

function uuid(u:bat[:uuid]):bat[:uuid];
 return u;
end uuid;
