Formatting rules while coding HMG4

Moderator: Rathinagiri

Post Reply
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Formatting rules while coding HMG4

Post 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.
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Formatting rules while coding HMG4

Post by Rathinagiri »

I made this useful topic sticky.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
BeGeS
Posts: 125
Joined: Fri Jul 14, 2017 10:45 am
DBs Used: DBF
Location: La Mancha, Spain

Re: Formatting rules while coding HMG4

Post by BeGeS »

What is HMG 4?

:?:
:|
I get by with a little help from my friends
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Formatting rules while coding HMG4

Post by esgici »

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

:?:
:|
+1
Viva INTERNATIONAL HMG :D
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Formatting rules while coding HMG4

Post 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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
BeGeS
Posts: 125
Joined: Fri Jul 14, 2017 10:45 am
DBs Used: DBF
Location: La Mancha, Spain

Re: Formatting rules while coding HMG4

Post 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.
I get by with a little help from my friends
User avatar
BeGeS
Posts: 125
Joined: Fri Jul 14, 2017 10:45 am
DBs Used: DBF
Location: La Mancha, Spain

Re: Formatting rules while coding HMG4

Post 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.
I get by with a little help from my friends
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Formatting rules while coding HMG4

Post 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 😁
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
BeGeS
Posts: 125
Joined: Fri Jul 14, 2017 10:45 am
DBs Used: DBF
Location: La Mancha, Spain

Re: Formatting rules while coding HMG4

Post 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 ).
I get by with a little help from my friends
Post Reply