HMG SCRIPT PROJECT
------------------
1. PROJECT GOALS
The main project goal is to write a Harbour MiniGUI to JavaScript/HTML translator.
The translator must generate pages containing HTML+JavaScript code with equivalent functionality to the original (source) HMG program.
Because JavaScript and web browsers limitations, the translator will support only a SMALL SUBSET of current Harbour+MiniGUI features.
Data will be accessed via XmlHttpRequest object (client side).
Server side code (returning the data to XmlHttpRequest object) will be implemented via GENERIC routines (reusable for all programs) written in PHP.
The backend database will be MySql.
2. WHY?
IMHO, web browsers must be considered as the new 'operating systems' or 'target platforms'.
If our applications were capable to run on web browsers, then will run
on any place on any device.
Most web browsers can run JavaScript, so the choice is obvious.
Regarding server side, I've choosen PHP+MySql because it is a worldwide standard for servers (even for free hosting providers).
Finally, the concept is already proven. Google applications works this way. The Google web toolkit, allows you to translate Java to JavaScript to create applications like those.
3. WEB SITES VS. WEB APPLICATIONS AND A TWISTED PARADIGM STORY
I will be exaggeratedly provocative on this topic... please, don't
report as a 'bug' :)
The web was created to read static documents across a computer network, NOT AS AN APPLICATION DEVELOPMENT PLATFORM.
Across time, it was transformed (patch over patch over patch...) into
a strange hybrid that appears to be against the programmers :) .
IMHO this paradigm is clearly a technical involution, not only because the difficulty to create applications, but because the centralized processing.
Today, even cheap/portable computers has a tremendous processing power, so, wasting it, doing application processing in centralized servers is (at least) a silly thing.
You need more and more server power, while client computers uses their tremendous processing capabilities only to show the text that you server send to them. This is a really strange thing that this appears to be 'good' and 'reasonable' for most people.
So, imagine that your application is downloaded to the client (embedded into an HTML page) and then executed into the client machine using an universal programming language available for all client computers, despite the web browser, hardware or operating system that they use. JavaScript is such language.
More important yet, is that executing your applications into the client, you can 'think' your programs in a 'natural', 'common sense' and 'easy' way... AS IT MUST BE!!!
4. PROJECT LICENSE
GPL v2.
6. HOW TO DO IT?
My first idea was to use the Harbour preprocessor to do the job (only
preprocessor directives needed) but I've found certain problems that
could impede its use for this project.
Basically, the problem is that attempting to generate HTML tags, the preprocessor adds unwanted spaces that makes those tags unusable.
In the case that a workaround for this can't be found, we must write a translator from the scratch.
7. GOALS FOR THE FIRST RELEASE (SUPPORTED FEATURES)
a) Numeric variables
b) String variables
c) IF...ELSE...ENDIF control structure.
d) FOR...NEXT control structure.
e) DO WHILE...ENDDO control structure.
f) Support for the following operators:
:= , == , >= , <= , <> , .AND. , .OR. , .NOT. , + , - , / , *
g) Basic support for the following controls:
- TextBox
- CheckBox
- ComboBox
- RadioGroup
- Button
h) Basic support for the following functions:
i. DataBase Functions:
- DbCreate()
- DbUseArea()
- DbCloseArea()
- DbSkip()
- DbGoTop()
- DbGoBottom()
- Eof()
- DbFieldGet()
- DbFieldPut()
- DbAppend()
- DbDelete()
- DbSetOrder()
- DbSeek()
ii) String Functions:
- AllTrim()
- Upper()
- Lower()
- SubStr()
- Left()
- Right()
- Ltrim()
- Rtrim()
- Space()
iii) Other Functions:
- Val()
- Str()
8. TASK LIST
I've created a preliminar task list (suggestions are welcome).
a). Harbour preprocessor tests to know if it is useful for the project
(capable of generate JavaScript and HTML code from HMG code).
b). Research about the translator programs structure and working to
consider the development of our own translator in the case that Harbour preprocessor can't be used.
c). From the propossed feature list, only some items has direct support in JavaScript. When direct support exists, the only work involved is to translate (ie) a Harbour function name and its parameters into its JavaScript equivalent. The goal for this task is to do a list for the proposed features with NO DIRECT SUPPORT in JavaScript. Features in that list shoud be coded as functions in JavaScript itself to be invoked in translated programs to support source (HMG) features.
Tasks Assignment:
If you are interested in pick one of them, please answer to this message, to let us know about that.
A particular task can be taken for more than one person, since in this
stage, comparing notes and opinions between people with different
points of view, will be a good thing.
I'll take for myself all tasks too, but I'll take it easy, since I'm
pretty busy by these days.

I'm doing some php-mysql tests on the server side.
I'm just re-reading my old php books and some other things around here.
My goal is to create a universal dispatcher for data retrieval-bridging-obfuscating from sql engine.
In few day I expect to have something visible.

apais wrote:I'm doing some php-mysql tests on the server side.
I'm just re-reading my old php books and some other things around here.
My goal is to create a universal dispatcher for data retrieval-bridging-obfuscating from sql engine.
In few day I expect to have something visible.

This projekt seems very ambitious. It will levarage the power our code. If you get this right, it would be the first Rapid Application Development tool for the Internet.

But I have one concern. Do I understand you right, that you want to implement all functions as Java-Script and have the Client to the work? The clients processor is mostly idle. Thats right. But when writing a three-tier-application for the internet, the bandwidth is often the limiting factor.

So there are a lot of uses, where the server should do some of the work to save bandwidth.

Control structures that use use the SEEK (or worse: LOCATE) command will cause a lot of bandwidth-overhead.

would cause no bandwidth at all, because it will do the multiplication without sending or receiving data.

Best way would be for HMGSCRIPT to decide where to do the processing (server or client). Even, if old control structures still work with HMGSCRIPT, some code should be rewritten us make use of MySQLs capabilities.