# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.

module url;

atom url:str;

command url(s:str) :url
address URLnew
comment "Create an URL from a string literal";

command url(s:url) :url
address URLnoop
comment "Create an URL from a string literal";

command calc.url(s:str) :url
address URLnew
comment "Create an URL from a string literal";

command calc.url(s:url) :url
address URLnoop
comment "Create an URL from a string literal";

command getAnchor(u:url) :str
address URLgetAnchor
comment "Extract the URL anchor (reference)";

command getBasename(u:url) :str
address URLgetBasename
comment "Extract the URL base file name";

command getContent(u:url) :str
address URLgetContent
comment "Get the URL resource in a local file";

command getContext(u:url) :str
address URLgetContext
comment "Get the path context of a URL";


command getDomain(u:url) :str
address URLgetDomain
comment "Extract Internet domain from the URL";

command getExtension(u:url) :str
address URLgetExtension
comment "Extract the file extension of the URL";

command getFile(u:url) :str
address URLgetFile
comment "Extract the last file name of the URL";

command getHost(u:url) :str
address URLgetHost
comment "Extract the server name from the URL";

command getPort(u:url) :str
address URLgetPort
comment "Extract the port id from the URL";

command getProtocol(u:url) :str
address URLgetProtocol
comment "Extract the protocol from the URL";

command getQuery(u:url) :str
address URLgetQuery
comment "Extract the query string from the URL";

command getUser(u:url) :str
address URLgetUser
comment "Extract the user identity from the URL";

command getRobotURL(u:url) :str
address URLgetRobotURL
comment "Extract the location of the robot control file";

command isaURL(u:url) :bit
address URLisaURL
comment "Check conformity of the URL syntax";

command new(p:str, h:str, prt:int, f:str) :url
address URLnew4
comment "Construct URL from protocol, host, port, and file";

command new(prot:str, host:str, fnme:str) :url
address URLnew3
comment "Construct URL from protocol, host,and file";

command fromstr()
address URLfromString
comment "Convert a string to an url. ";

command tostr()
address URLtoString
comment "Convert url to string equivalent";
