|
"Whether you believe you can do a thing or not, you are right." (Henry Ford)
Better tools let you build better solutions
Why use C rather than a more 'modern' language for G-WAN?
1. If you know C, how many other languages do you need to learn*?
2. ANSI C is stable, efficient and available on all hardware platforms.
3. C can be as safe as any other language (see the 'crash.c' servlet).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include "gwan.h" // G-WAN exported functions
int main(int argc, char *argv[])
{
xbuf_t reply; // create a dynamic buffer
get_reply(argv, &reply); // setup the server reply
char *name = 0; // get an URL parameter
get_arg("name=", &name, argc, argv);
xbuf_xcat(&reply, "Hello %s", // format a safe reply
escape_html(name, name, 20) ? name : "you");
set_reply(argv, &reply); // update the server reply
return(200); // HTTP status (200:'OK')
} |
The best way to understand G-WAN's capabilities is to play with it: just click on the links below (press the browser's 'back' button to return to this page):
| servlet description | run | src |
| 'Hello World' sample (used to benchmark servlets) | [run] | [src] |
| Render Area/Bar/Dot/Line/Pie/Ring Charts in GIF pictures | [run] | [src] |
| Render the Mandelbrot Set in a 800x800 GIF picture | [run] | [src] |
| Link the SQLite Library to a C servlet (#pragma link/include) | [run] | [src] |
| (GET or POST) AJAX form to calculate Loan Payments | [run] | [src] |
| (GET or POST) Contact Form to get email from users | [run] | [src] |
| Query the ECB to get 34 Currency Exchange Rates | [run] | [src] |
| Attack G-WAN with hundreds of Malicious URIs (be creative) | [run] | [src] |
| Make G-WAN Crash (it won't) and get an useful crash report | [run] | [src] |
[*] C is a 40-year-old free standard which offers more source code than all other languages... which have all been written in C (probably for a reason).
|