NETB131 Programming Project 
Programming language Curl
An overview

Martin Arsovski, F40677

Navigation:
1. History and Special Features
2. "Hello World" Program
3. Fundamental Data Types and Assignment Operators
4. Basic Control Flow
5. Functions
6. Arrays
7. Compilers
8. Projects and software in Groovy
9. Standard
10. References



1. History and Special Features

In the second half of 1997, Daniel Stenberg came up with the idea to make currency-exchange calculations available to Internet Relay Chat (IRC) users. All the necessary data are published on the Web; he just needed to automate their retrieval.
Daniel simply adopted an existing command-line open-source tool, httpget, that Brazilian Rafael Sagula had written. After a few minor adjustments, it did just what he needed.
Soon, he found currencies on a GOPHER site, so support for that had to go in, and not before long FTP download support was added as well. The name of the project was changed to urlget to better fit what it actually did now, since the http-only days were already passed.
The project slowly grew bigger. When upload capabilities were added and the name once again was misleading, a second name change was made and on March 20, 1998 curl 4 was released. (The version numbering from the previous names was kept.)
(Unrelated to this project a company called Curl Corporation registered a US trademark on the name "CURL" on May 18 1998. That company had then already registered the curl.com domain back in November of the previous year. All this was revealed to us much later.)
SSL support was added, powered by the SSLeay library.
August 1998, first announcement of curl on freshmeat.net.
October 1998, with the curl 4.9 release and the introduction of cookie support, curl was no longer released under the GPL license. Now we're at 4000 lines of code, we switched over to the MPL license to restrict the effects of "copyleft".
November 1998, configure script and reported successful compiles on several major operating systems. The never-quite-understood -F option was added and curl could now simulate quite a lot of a browser. TELNET support was added.
Curl 5 was released in December 1998 and introduced the first ever curl man page. People started making Linux RPM packages out of it.
The Curl programming language is a reflective object-oriented programming language designed for interactive Web content. It combines text markup (as in HTML), scripting (as in JavaScript), and heavy-duty computing (as in Java, C#, or C++) within one unified framework. It is used in a range of internal enterprise, B2B, and B2C applications.
Curl is a markup language like HTML, that is, plain text is shown as text; at the same time, Curl includes an object-oriented programming language that supports multiple inheritance. Curl applications are not required to observe the separation of information, style, and behavior that HTML, CSS, and JavaScript have imposed, although that style of programming can be used in Curl if desired.
While the Curl language can be used as an HTML replacement for presenting formatted text, its capabilities range all the way to those of a compiled, strongly typed, object-oriented system programming language (from MIT Curl Project's white paper). Both the authoring (HTML-level) and programming constructs of Curl can be extended in user code. The language is designed so Curl applications can be compiled to native code of the client machine by a just-in-time compiler and run at high speed.
Curl applets are viewed using the Curl RTE, a runtime environment plugin for web browsers. Currently, it is supported on Microsoft Windows and Linux. A Macintosh beta version was made publicly available in March 2007.




2."Hello World" Program

|| ===== begin of program ========
{curl 3.0, 4.0, 5.0, 6.0 applet}
Hello World!
|| ======end of program ========



3. Fundamental Data Types (integer, floating point, string) and
Assignment Operator Definitions:

i:int = 1
code-str:String

{for i:int = 1 to 25 do
let square:int = i*i
let cube:int = square*i
{my-table.add {row-prototype i, square, cube}}
}

4. Basic Control Flow (conditional and loop statements)Conditional operator:

{for ch in code-str do
{inc count}
{if ch < '0' or ch > '9' then
{error "Invalid Universal Product Code: " & code-str}
}
{if count < 12 then
{if (count mod 2) == 1 then
set checksum = checksum + 3 * (ch - '0')
else
set checksum = checksum + (ch - '0')
}
else
set checksum = 10 - (checksum mod 10)
{if checksum != ch - '0' then
{error "Invalid Checksum in Universal Product Code: " & code-str}}
}
}
}


Loop operator:

while
(*args && *args[0] == '-')



5. Functions - syntax, writing and using functions, example The following is function's format:


Syntax: define name { parameter1, parameter2, ...}

EXAMPLE:

static
curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp)
{
int fd = (int)userp;

(void)handle; /* not used in here */

switch(cmd) {
case CURLIOCMD_RESTARTREAD:
/* mr libcurl kindly asks as to rewind the read data stream to start */
if(-1 == lseek(fd, 0, SEEK_SET))
/* couldn't rewind */
return CURLIOE_FAILRESTART;

break;

default: /* ignore unknown commands */
return CURLIOE_UNKNOWNCMD;
}
return CURLIOE_OK; /* success! */
}


6. Arrays - syntax, definition, example

Syntax : Name:type = {parametar}


EXAMPLE:


{let t1:type={array int}
t2:type={list-of t1}
x:t2
...}


7. Compilers

[1] Sparc compiler
[2] ANSI Compiler
[3] Curl Compiler



8. Projects and Software in Curl:

9. Standard

Much of Curl's standard syntax is implemented using macros.

Unicode is Curl's internal standard for character data representation;
transcoding is supported between Unicode and external formats
like UTF-8 and UTF-16, as well as locale-specific formats such
as SHIFT-JIS, EUC-JP, and the various ISO-LATIN formats


10. References

[1] Curl - WIkipedia
[2] Curl Inc
[3] Curl Hindu Resource
[4] Indopedia Resource about Curl programming language
[5]John K. Ousterhout, Tcl and the Tk Toolkit, Addison-Wesley, 1993.
[6]World Wide Web Consortium. See http://w3.org/. [7]T. Berners-Lee and D. Connolly, Hypertext Markup Language: A Representation of Textual Information and Metainformation for Retrieval and Interchange, CERN and Atrium Technology Inc. July 1993.