receive compiler error E0030 through hbmk2, but not when I compile straight with harbour (v3)

828 views
Skip to first unread message

Fred Philip

unread,
Aug 25, 2014, 4:13:03 PM8/25/14
to harbou...@googlegroups.com
Hi fellows,

Here is a question for the experts ;-)
Why is the harbour compiler (from DOS command line) accepting (compiling) the following lines of code,
while HBMK2 is reporting an error E0030 on lines 187 to 192?
 
<< begin code snippet >>
line #186 FOR LN_X:=1 TO LEN(RA_TABLE)
line #187   @ LN_ROW,08 GET RA_TABLE[LN_X,1] VARNAME "AGE"    PICT "##"  WHEN(FU_FLYHELP())
line #188   @ LN_ROW,18 GET RA_TABLE[LN_X,2] VARNAME "TYPE"   PICT "!"   WHEN(FU_FLYHELP())
line #189     VALID(FU_IS(GETACTIVE():VARGET()$"01234","C0013"))
line #190   @ LN_ROW,26 GET RA_TABLE[LN_X,3] VARNAME "AMOUNT" PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())
line #191   @ LN_ROW,41 GET RA_TABLE[LN_X,4] VARNAME "MIN"    PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())
line #192   @ LN_ROW,57 GET RA_TABLE[LN_X,5] VARNAME "MAX"    PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())

line #193   LN_ROW++
line #194 NEXT LN_X
line #195 READ
<< end code snippet >>
 
Error message for each line (187-192): "Error E0030 Syntax error "syntax error at '@'""
 
The options in the .hbp file are
"-w0 -es1 -kmo /m -n2"
 
Any feedback is much appreciated.

Cheers
Fred

 

elch

unread,
Aug 27, 2014, 2:14:22 AM8/27/14
to harbou...@googlegroups.com

Hi Fred,


luckily no expert is needed :-)


Harbour does not know your VARNAME, look at:

http://x-hacker.org/ng/53guide/ngacf16.html


A line starting with a 'VALID' condition, without a ';' at line-end before, also won't work.

Your example will end up with: function VALID() not found ..

BTW, 'WHEN' and 'VALID' are no functions, but options to the 'GET' command -- and ok, you can write it like you did.


---

in my words:

Harbour 'compile', better to say 'transpile', your prg code to C-code functions with p-code.

This step includes pre-processing before ( add '-p' to see the .ppo files )


Then a C-compiler is called to generate '.o' object files.

At end, all your 'obj' files, together with the Harbour core ( the virtual machine for the p-code, terminal window, ... )

and perhaps 3rd party libs are linked to an executable file.

All these steps are done by this fantastic 'make' tool hbmk2,

which auto-locate all needed files and knows the switches for the auto-detected C-compiler/ linker.



----

As long as Harbour v3 works for you, you sure can take that version.

But v3.2 (so called 'nightly') contains 3 more years of strong development -- my advice ...

If you need Harbour 3.2 for another platform as Win32, you have to compile Harbour from source -- how to do is described in the README.md.

This is overall a good experience/ source of information to look into Harbour itself, and the overwhelming advantage of open source ...


best regards

Rolf

Fred Philip

unread,
Aug 27, 2014, 9:25:33 AM8/27/14
to harbou...@googlegroups.com
Hi Rolf,
 
thank you for your detailed reply.
 
You are right pointing to line 188/189. The original code has this statement on one line. During the edit of the posting, I guess I made the mistake and numbered the line 189 as independent.
However, even if code from 188/189 are merged into one line, Harbour is complaining with E0030.
I guess it has something to-do with the structure of these GET statements, perhaps the use of VARNAME ?
 
And Yes, I think Harbour is an awesome tool (and I beginning to like hbmk2) even though we are used to have  the "make script" and the "make process" under control.
-----
Is perhaps the "VARNAME" use the cause of the problem or is Harbour here 100% compatible?
This code runs in Clipper 5.2e for over 15 years ;-)
 
Cheers
Fred
 
 

 

Fred Philip

unread,
Aug 27, 2014, 9:57:43 AM8/27/14
to harbou...@googlegroups.com
Here is an update to my previous posting:
 
I investigated and found out HBMK2 is reporting an error every time when the VARNAME clause is used in a get statement.
When I'm taking this clause out of the statement, hbmk2 compiles properly, however it would break some of the logic in our applications.
 
It must be noticed, when I'm compiling the module with the compiler itself (harbour.exe) - no complaints, compilation completed successful.
 
Maybe its really a bug in the hbmk2  executable or need hbmk2 an additional directive?
 
Should I report  it as a bug to the dev team?
 
Any feedback is appreciated.
Cheers Fred
 
 

elch

unread,
Aug 27, 2014, 10:41:39 AM8/27/14
to harbou...@googlegroups.com

Hi Fred,


NO bug at Harbour side ...


If i put your example lines into a 'fred.prg' with a procedure main(),

then execute: harbour fred.prg -p

=>

fred.prg(14) Error E0030 Syntax error "syntax error at '@'"

...


---

Never have seen a 'VARNAME' statement for the 'GET' command in the last decades.

Only a guess:

can it be, that you used for your Clipper pre-processer directives ?? ( http://x-hacker.org/ng/53guide/ng11fd89.html )

And on that way a non-standard Clipper 'GET' command is pre-processed ?


best regards

Rolf

elch

unread,
Aug 27, 2014, 11:15:41 AM8/27/14
to harbou...@googlegroups.com

Hi again,


last time i showed doc for Clipper 5.3,

here a shorter and much older 'GET' doc for summer 87:

http://www.x-hacker.org/ng/sum87/ng30f1c.html

NO 'VARNAME' !


---

BTW, can you describe what that VARNAME does ??

Is that used for the 'SAY' part ?

I would suggest to rewrite that lines to get something standard Clipper conform.

Ok, with #translate or #xtranslate we theretically can fiddle at these lines without changing, but i strong dislike such ..


best regards

Rolf

Fred Philip

unread,
Aug 27, 2014, 3:00:54 PM8/27/14
to harbou...@googlegroups.com
Hi Rolf,
 
There is no manipulation of the pre-processor through a translate or command directives.
 
The Clipper and Harbour pre-processor translates the get command into the following .... "SetPos( 16, 10 ) ; .... ; ATail(GetList):NAME:="<VARNAME>" ;"
 
If you look at the GET class, the object has a "NAME" property. I guess that's why the pre-processor is producing "ATail(Getlist):NAME".
And again the question, why is HARBOUR.EXE accepting this kind of code and HBMK2 is not :-(
 
Cheers Fred 
 

elch

unread,
Aug 27, 2014, 4:00:48 PM8/27/14
to harbou...@googlegroups.com
Hi Fred,


And again the question, why is HARBOUR.EXE accepting this kind of code and HBMK2 is not :-(


and one more try to explain:

hbmk2 does NOT COMPILE NOTHING, only execute e.g. Harbour.

Reconsider what a make tool is ...


And if i 'compile' your example 'directly' with harbour[.exe v3.2]:

=> i get ERRORS.

Which must be the same at you, if a hbmk2 v3 executes a harbour 3.0.

Because you report the same errors.

Which are caused by that 'VARNAME' ...


---

I still do not understand, for what this all should be.

Either you READ the variable: RA_TABLE[ LN_X, 1 ]

OR you read a variable: "AGE"

Nothing between ... :-)


best regards

Rolf

Klas Engwall

unread,
Aug 27, 2014, 7:10:34 PM8/27/14
to harbou...@googlegroups.com
Hi Fred,

Just like Rolf did, I added "proc main()" and "return" to your code. I
also wrapped the lines before the picture clauses to prevent the
newsgroup software from doing that randomly when the code is posted
here. So this is the code I then tried to compile:

//-----------------------
proc main()
FOR LN_X:=1 TO LEN(RA_TABLE)
@ LN_ROW,08 GET RA_TABLE[LN_X,1] VARNAME "AGE";
PICT "##" WHEN(FU_FLYHELP())
@ LN_ROW,18 GET RA_TABLE[LN_X,2] VARNAME "TYPE";
PICT "!" WHEN(FU_FLYHELP());
VALID(FU_IS(GETACTIVE():VARGET()$"01234","C0013"))
@ LN_ROW,26 GET RA_TABLE[LN_X,3] VARNAME "AMOUNT";
PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())
@ LN_ROW,41 GET RA_TABLE[LN_X,4] VARNAME "MIN";
PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())
@ LN_ROW,57 GET RA_TABLE[LN_X,5] VARNAME "MAX";
PICT FU_PICTT("###,###.##") WHEN(FU_FLYHELP())
LN_ROW++
NEXT LN_X
READ
return
//-----------------------

> The Clipper and Harbour pre-processor translates the get command into
> the following .... "SetPos( 16, 10 ) ; .... ;
> ATail(GetList):NAME:="<VARNAME>" ;"

I tried to compile with Clipper 5.2e, Harbour 3.0.0 and Harbour 3.2.0dev
with the -p option (no hbmk2, no rmake, just the compiler) and they all
refused to preprocess all those lines with VARNAME in them. Instead I
got the same E0030 errors as reported by you and Rolf, and the rows with
GETs were left unpreprocessed in the .ppo file

So what kind of Clipper and Harbour versions are you using to get the
preprocessor output you mentioned? Or rather, as far as I can see, there
has to be a fancy std.ch involved in your setup.

Here is the entry for GET in the Clipper 5.3 docs:

//-----------------------
@ <nRow>, <nCol>
[SAY <exp>
[PICTURE <cSayPicture>]
[COLOR <cColorString>]]
GET <idVar>
[PICTURE <cGetPicture>]
[COLOR <cColorString>]
[CAPTION<cCaption>]
[MESSAGE <cMessage>]
[WHEN <lPreExpression>]
[RANGE* <dnLower>, <dnUpper>] |
[VALID <lPostExpression>]
[SEND <msg>]
[GUISEND <guimsg>]
//-----------------------

No VARNAMR or even NAME there. And here is the preprocessor rule for GET
from Clipper's std.ch file, slightly edited for white space:

//-----------------------
#command @ <row>, <col> GET <var> ;
[PICTURE <pic>] ;
[VALID <valid>] ;
[WHEN <when>] ;
[SEND <msg>] ;
;
=> SetPos( <row>, <col> ) ;
; AAdd( ;
GetList, ;
_GET_( <var>, <"var">, <pic>, <{valid}>, <{when}> ):display();
) ;
[; ATail(GetList):<msg>]
//-----------------------

No VARNAME there either, and also not in the so called "fancy" GETs.

When I comment out your VARNAME clauses, Clipper preprocesses the first
GET to this (wrapped into two lines here):

SetPos( LN_ROW, 08 ) ; AAdd( GetList, _GET_( RA_TABLE[LN_X,1],
"RA_TABLE[LN_X,1]", "##",, {||(FU_FLYHELP())} ):display() )

If you remove the VARNAME clause from the GET you can instead add it on
the line following after the get, similarly to what the preprocessor
does with <msg>:

ATail(GetList):VARNAME:="AGE"
or
ATail(GetList):NAME:="AGE"
or even
ATail(GetList):FREDSVARIABLE:="AGE"
or
ATail(GetList):FREDSVARIABLE:="<VARNAME>"

and they will all fly through the Clipper preprocessor, and the second
version will then probably replace the name passed in the
"RA_TABLE[LN_X,1]" argument (with the quotes) in the preprocessor output
above. NAME is a documented exported instance variable in the GET class,
so the second version would probably work in the application. But the
other three will just add junk.

Regards,
Klas

elch

unread,
Aug 28, 2014, 7:21:56 AM8/28/14
to harbou...@googlegroups.com

Hi Klas,


maybe i lastly found what Fred want to do,

look for the second param of _GET_():


#command @ <row>, <col> GET <var>                             ;
                         [PICTURE <pic>]                       ;
                         [VALID <valid>]                       ;
                         [WHEN <when>]                         ;
                         [SEND <msg>]                          ;
                                                               ;
   => SetPos( <row>, <col> )                                   ;
      ; AAdd(                                                  ;
      GetList,                                                 ;
      _GET_( <var>, <"var">, <pic>, <{valid}>, <{when}> ):display();
            )                                                  ;
       [; ATail(GetList):<msg>]

But now i have a problem:
Fred maybe can add something in his std.ch, like adding a [VARNAME <vn>],
and use that "vn" as second param for _GET_() ..
.. but what is if this VARNAME misses ?
So he will need an additional #command, right ?

Maybe you or someone else can help out, i'm no expert for #directives :-)


best regards

Rolf

Tony Quick

unread,
Aug 28, 2014, 12:17:49 PM8/28/14
to harbou...@googlegroups.com
Fred,

What #include statements do you have in that module when compiled in Clipper?

Regards,
Tony

Klas Engwall

unread,
Aug 28, 2014, 1:55:59 PM8/28/14
to harbou...@googlegroups.com
Hi Rolf,

> maybe i lastly found what Fred want to do,
> look for the second param of _GET_():
>
> #command @ <row>, <col> GET <var> ;
> [PICTURE <pic>] ;
> [VALID <valid>] ;
> [WHEN <when>] ;
> [SEND <msg>] ;
> ;
> => SetPos( <row>, <col> ) ;
> ; AAdd( ;
> GetList, ;
> _GET_( <var>, <"var">, <pic>, <{valid}>, <{when}> ):display();
> ) ;
> [; ATail(GetList):<msg>]

Yes, he is GETting array elements and wants to give each element a
specific name instead of "array[index]". There is no doubt about that.
It it "only" the syntax that is strange :-)

Looking at it from another angle, when using GetNew() instead of
preprocessing GET into _GET_() it is possible to code something like

oGet := GetNew( nRow, nCol, bBlock, "MyVarName", cPicture )

where bBlock loads the data into the oGet and "MyVarName" is the name
that refers to the oGet. <var> (without the quotes) is the equivalent of
bBlock in the _GET_() version.

... or, if you like, you can create an empty oGet and fill it later,
like this (the example can be compiled and run as it is):

//-------------------------------
proc main()

local cTest := "abc"
local oGet := GetNew() // An empty oGet
local GetList := {}

oGet:block := { | xVal | iif( PCount() == 0, cTest, cTest := xVal ) }
oGet:row := 5
oGet:col := 10
oGet:name := "MyVarName"
oGet:picture := "!!!"

aadd( GetList, oGet )
readmodal( GetList )

return
//-------------------------------

> But now i have a problem:
> Fred maybe can add something in his std.ch, like adding a [VARNAME <vn>],
> and use that "vn" as second param for _GET_() ..
> .. but what is if this VARNAME misses ?
> So he will need an additional #command, right ?
>
> Maybe you or someone else can help out, i'm no expert for #directives :-)

I don't really like writing preprocessor directives either :-) and would
rather use GetNew() when setting up a GET. I do that all the time,
especially when GETting array elements with valid clauses that are also
array elements. I send the array of setup info and the array index in
separate arguments to a "getbuilder" function that returns the oGet. The
function detatches the array index so the correct valid clauses are
connected to each oGet, and not the last valid clause in the array to
all oGet's.

But if, as Fred claims, VARNAME is working for him in Clipper, he must
already have a custom directive that takes care of it. I cannot see any
other explanation.

Regards,
Klas

Fred Philip

unread,
Aug 29, 2014, 10:57:48 AM8/29/14
to harbou...@googlegroups.com
Klas, Rolf ( and all the other readers of this post)
 
I have to say, I'm feeling embarrassed- and it should not have happen to me.
 
I overlooked a .CH file when I set-up my new Harbour environment.
There was an include file that contained the following command:
 
 
<<< start snippet
#command @ <row>, <col> GET <var>     ;
    VARNAME <vname>    ;

   [PICTURE <pic>]     ;
   [VALID <valid>]     ;
   [WHEN <when>]     ;
   [SEND <msg>]     ;
   [XLAT <xlta>]     ;
         ;

      => SetPos( <row>, <col> )      ;
       ; AAdd(        ;
        GetList,       ;
        _GET_( <var>, <(var)>, <pic>, <{valid}>, <{when}> ):display()  ;
      )        ;
      [; ATail(GetList):<msg>]      ;
      [; ATail(GetList):NAME:=<vname>]     ;  ;
      [; ATail(GetList):CARGO:=<xlta>]
>>> end snippet
 
After I included this .CH file the compilation works fine.
I apologize overlooking this , as I said I should have known better ;-)
 
Now I can move on with my research project and I'm sure I will be back with another question. ;-)
 
I'm on my way to complete to compilation of all the 50+ PRG's with over 160,000 lines of code.
 
Thanks again
Fred
 

Klas Engwall

unread,
Aug 29, 2014, 11:54:51 AM8/29/14
to harbou...@googlegroups.com
Hi Fred,

> Klas, Rolf ( and all the other readers of this post)
> I have to say, I'm feeling embarrassed- and it should not have happen to me.
> I overlooked a .CH file when I set-up my new Harbour environment.
> There was an include file that contained the following command:
> <<< start snippet
> #command @ <row>, <col> GET <var> ;
> VARNAME <vname> ;
> [PICTURE <pic>] ;
> [VALID <valid>] ;
> [WHEN <when>] ;
> [SEND <msg>] ;
> [XLAT <xlta>] ;
> ;
> => SetPos( <row>, <col> ) ;
> ; AAdd( ;
> GetList, ;
> _GET_( <var>, <(var)>, <pic>, <{valid}>, <{when}> ):display() ;
> ) ;
> [; ATail(GetList):<msg>] ;
> [; ATail(GetList):NAME:=<vname>] ; ;
> [; ATail(GetList):CARGO:=<xlta>]
> >>> end snippet
> After I included this .CH file the compilation works fine.
> I apologize overlooking this , as I said I should have known better ;-)

Don't worry, we all know it is difficult to remember all the smart
things we added to our toolboxes 25 years ago :-)

> Now I can move on with my research project and I'm sure I will be back
> with another question. ;-)

OK, we will be here when you come back :-)

> I'm on my way to complete to compilation of all the 50+ PRG's with over
> 160,000 lines of code.

Great, good luck with that!

Regards,
Klas

Alex Strickland

unread,
Aug 30, 2014, 2:17:25 AM8/30/14
to harbou...@googlegroups.com
Hi Fred

> After I included this .CH file the compilation works fine.
> I apologize overlooking this , as I said I should have known better ;-)

To complete your ritual humiliation may I ask why your results were
different when using hbmk2.exe vs harbour.exe?

> Now I can move on with my research project and I'm sure I will be back
> with another question. ;-)
> I'm on my way to complete to compilation of all the 50+ PRG's with over
> 160,000 lines of code.

It will mostly just work - Harbour is amazing.

--
Regards
Alex
Reply all
Reply to author
Forward
0 new messages