Page 1 of 1

Formatting rules while coding HMG4

Posted: Tue Mar 29, 2011 1:53 pm
by concentra
Didn´t find a specific topic about formatting rules while coding HMG4.
Please review what I found searching the forum:

1. Indentation is three spaces and not tab.

2. Variable names should start with the type (c,n,l,d,a,x,o,q as the case may be) as mentioned below in smaller case letter and name of the variable would start with an uppercase letter.
Examples:
cName - variable name 'cName' which is a character type.
nNumber - 'nNumber' variable which is a number type.
lYesNo - 'lYesNo' variable which is a logical type.
dToday - 'dToday' variable which is a date type.
aObjects - 'aObjects' variable which is an array type.
xValue - 'xValue' variable the type of which is not known now and may be known at run time.
oDataObject - 'oDataObject' variable which is an object type.
qPrinter - 'qPrinter' variable which is a QT object type.

3. When calling a QT method/function, the first word is started with a smaller case and next words are uppercase.
Example:
qTreeWidget:indexFromItem( qTreeWidgetItem )

4. A space is necessary between starting and ending parenthesis of function names and the parameters. Please see the example.
qTreeWidget.collapseItem(qTreeWidgetItem) - Wronge
qTreeWidget.collapseItem( qTreeWidgetItem ) - Right

5. All Harbour keywords must be uppercase: DO CASE IF ENDIF ELSE CASE FOR NEXT etc.

6. Only FUNCTION/METHOD Name must be starting at column 1, rest of the lines including RETURN
must be indented.

7. No short names as FUNC PROC be used, all complete ones.

8. SWTCH and DO CASE and its CASE statements must be on same indent:
...SWITCH x
...CASE 4
...CASE 5
...ENDSWITCH

9. Function call must be like: MyFunc( n, n1, ... ), no space between function name and opening parenthesis.

10. No comments starting with * (star). Only ANSI compatible // some comment OR preferably /* some comment */.

11. Every function body must be separated by a blank line and seperator. Seperator line must be uniform as I have used.

12. HMG library source must be compilable with -w3 switch. It helps to detect the wrong code soon.

13. No LOCAL variable assignment with NIL. It is neither needed not oprimized.

Re: Formatting rules while coding HMG4

Posted: Tue Mar 29, 2011 4:22 pm
by Rathinagiri
I made this useful topic sticky.

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 3:52 pm
by BeGeS
What is HMG 4?

:?:
:|

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 4:00 pm
by esgici
BeGeS wrote: Mon Aug 07, 2017 3:52 pm What is HMG 4?

:?:
:|
+1

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 4:07 pm
by danielmaximiliano
BeGes : un proyecto antiguo que quedó en la nada...

Si miras las fechas encontrarás que es viejo pero con mucho contenido e información...

viewforum.php?f=32

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 5:51 pm
by mol
hmg4 is abandoned version

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 5:55 pm
by BeGeS
danielmaximiliano wrote: Mon Aug 07, 2017 4:07 pm BeGes : un proyecto antiguo que quedó en la nada...

Si miras las fechas encontrarás que es viejo pero con mucho contenido e información...

viewforum.php?f=32
Gracias, Daniel.

Sí, lógicamente me he fijado en las fechas y eso era lo más desconcertante.

Espero y deseo que haya un HMG 4 oficial (tras las versiones 3.4.x) para... no sé... ¿quizá el año 2020 que es muy cuadradito? :mrgreen:

Esa versión "definitiva" (como todas las que no tienen apellido :lol: ) significaría que Harbour y HMG estarían vivitos y coleando al alcanzar la mayoría de edad.

P.D.: Arrastro la frustrante maldición de subirme al tren cuando se acerca a la estación terminal. Me ha ocurrido un par de veces. Pero creo que aquí he encontrado la ruta acertada.

* * * * * * * *

Thanks Daniel.

Yes, logically I have looked at the dates and that was disconcerting.

I hope and wish that there is an official HMG 4 (after versions 3.4.x) for... I do not know... maybe the year 2020 that is very square? :mrgreen:

That "definitive" version (like all those with no surname :lol: ) would mean that Harbour and HMG would be alive and kicking when they came of age.

P.D .: I have the frustrating curse of getting on the train when it approaches the terminal station. It happened to me a couple of times. But I think I've found the right route here.

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 5:56 pm
by BeGeS
mol wrote: Mon Aug 07, 2017 5:51 pm hmg4 is abandoned version
From what little I have seen, I deduce that it was a question of relating HMG to Qt.

* * * * * * *

Por lo poco que he visto, deduzco que se trataba de relacionar HMG con Qt.

Re: Formatting rules while coding HMG4

Posted: Mon Aug 07, 2017 11:55 pm
by danielmaximiliano
BeGeS wrote: Mon Aug 07, 2017 5:56 pm
From what little I have seen, I deduce that it was a question of relating HMG Qt
Exacto... Muy buena opción lástima que los ejecutables quedaban muy grandes con si fueran ejecutables Visual FoxPro 😁

Re: Formatting rules while coding HMG4

Posted: Tue Aug 08, 2017 9:03 am
by BeGeS
danielmaximiliano wrote: Mon Aug 07, 2017 11:55 pm Exacto... Muy buena opción lástima que los ejecutables quedaban muy grandes con si fueran ejecutables Visual FoxPro 😁
Eso ya está inventado y se llama Marinas-GUI, ¿no?

Después de que Harbour me sacara de un tremendo apuro, estuve a punto de escoger Marinas como interfaz gráfica, pero Roberto me trajo para acá (él no lo sabía :D ).

* * * * * * *

That is already invented and is called Marinas-GUI, right?

After Harbour got me out of a terrible hurry, I was about to choose Marinas as a graphical interface, but Roberto brought me here (he did not know :D ).