GCL Home ] [ CGI Tutorial ] [ Home ] [ > ]

The Graphic Counter Language

This page is the result of some “sample” code I was going to write for my CGI Tutorial. All I wanted to do was create a simple program to manage a web page counter. But I got caught up in it. Let me add this, and let me add that, was constantly coming to me.

After almost two weeks of working some 12 - 16 hours a day, I ended up with more than 3,000 lines of C code. Hardly something I would want to insert into an introductory tutorial... And, I had to force myself to stop. “No new features,” I had to order myself, “or you’ll never get done!” But don’t worry. I will add new features in the next version.

Indeed, rather than creating a counter, I created a new language. I named it GCL, which stands for Graphic Counter Language. This is good news for you: If you want to create your own counter, you no longer need to write a full program in C or Perl. Instead, all you need to do is create the graphics for the digits 0 - 9, and write some 15 - 20 lines of GCL code. Voilà, you have created a counter, one that is uniquely yours, unlike any other counter on the web!

Before you get too excited, there is a catch: It only works on web sites running under a Unix compatible operating system. Windows is out! Why? Ask the company that created Windows. Back in the days of plain MS DOS, the MS C compiler could compile and link essentially anything that you could write for Unix. They followed the unwritten, and unquestioned, standard. But with each new version of MS Visual C++, they are moving farther and farther away from the standard. They, it seems, have decided to set their own “standard,” apparently trying to lock programmers out of Unix and in to Windows. Well, that is a double-edged sword. I am not about to write free software just so Uncle Bill can add another billion to his wallet. Heck, if he used that money to feed the hungry and dress the naked, to educate children and adults of the world, I would gladly keep contributing to the Windows world with my free programs. But we all know that is not the case.

I am not saying this to complain. What he does is his karma. What I do is mine. I am simply explaining here why GCL is for Unix only. Most web sites run under Unix anyway (mostly FreeBSD, which is a wise choice!).

Now, to the exciting part. Take a look at the sample counter below. I have created it just for this page. It is not a very good web page counter because its digits are way too big. But it is good for illustrating how to create your own counters with GCL. And to see this really is a counter, reload this page and see that the count is increasing. While you're at it, look at the other counter, the one to the left. It is in Devanagari, the alphabet of the Sanskrt language. With GCL you can use any alphabet you want! Also note that the Devanagari counter is not increasing; the digits (yes, those are digits) remain the same: GCL gives you total control over the counter—I have programmed this one always to show 1234567890. But I have placed another copy of the same counter at the bottom—this one does change.

Copyright © 1999 G. Adam Stanislav
All rights reserved

And, by the way, the counter above left, the one with the antenna, shows you how many people have visited the Whiz Kid Technomagic home page. It increases every time someone goes to the home page but it does not change no matter how many times you reload this page (unless, of course, someone has just visited the home page before you reloaded). GCL is very flexible!

When you are satisfied, click on either counter below to get to page 2, to see how this counter was created:

GCL Home ] [ CGI Tutorial ] [ Home ] [ > ]