FreePascal (FPC) and RHIDE 
Author Message
 FreePascal (FPC) and RHIDE

Hi,

is it possible to use RHIDE to develop Pascal programs
that will then be compiled by FreePascal (and possibly
debugged through gdb or whatever in the IDE)?
I thought it was possible, but i couldn't find anything
in the RHIDE documentation or in the options menu.

BTW, if i feed a line like

var timer      : Longint absolute $40:$6C;

to free pascal, it says:

foo.pas(4,35) Error: absolute can only be associated a var or const
foo.pas(4,35) Fatal: Syntax error, ; expected but ordinal const
found    

but from the documentation of free pascal i read that
variables at absolute addresses are also possible in free pascal.
How did the syntax change? Which variable declaration do i have
to write in order to directly access the timer?

Regards,

        Tobias



Thu, 10 Jul 2003 06:34:27 GMT  
 FreePascal (FPC) and RHIDE

Quote:

>Hi,

>is it possible to use RHIDE to develop Pascal programs that will then be
>compiled by FreePascal (and possibly debugged through gdb or whatever in
>the IDE)? I thought it was possible, but i couldn't find anything in the
>RHIDE documentation or in the options menu.

Yes, IIRC on the FTP site there is some config file for that. Most FPC
developpers use the own IDE, which is also downloadable from FTP (directory
snapshot, idelinux.tar.gz)

Quote:
>BTW, if i feed a line like

>var timer      : Longint absolute $40:$6C;

>to free pascal, it says:

>foo.pas(4,35) Error: absolute can only be associated a var or const
>foo.pas(4,35) Fatal: Syntax error, ; expected but ordinal const
>found    

I'm not 100% sure FPC supports this, but the documentation is usually right.

But IF it is support, it is only supported  for the dos version (for BP
compability) and probably only using the BP compability switch ( -So) Under
other OSes this is not possible, which is also why we allow it in a special
mode. (there are two BP compatible mode, a "as compatible as possible", and
a more platform independant. The platform independant one is default)



Thu, 10 Jul 2003 18:39:47 GMT  
 FreePascal (FPC) and RHIDE

Quote:
> Hi,

> is it possible to use RHIDE to develop Pascal programs
> that will then be compiled by FreePascal (and possibly
> debugged through gdb or whatever in the IDE)?
> I thought it was possible, but i couldn't find anything
> in the RHIDE documentation or in the options menu.

> BTW, if i feed a line like

> var timer      : Longint absolute $40:$6C;

> to free pascal, it says:

> foo.pas(4,35) Error: absolute can only be associated a var or const
> foo.pas(4,35) Fatal: Syntax error, ; expected but ordinal const
> found    

> but from the documentation of free pascal i read that
> variables at absolute addresses are also possible in free pascal.
> How did the syntax change? Which variable declaration do i have
> to write in order to directly access the timer?

I'm working with Rhide 1.47 and FPC almost almost 8 months under linux
and it works very good.
Here are the settings steps for rhide:
1.Go to environment settings and mark 'Use FPC compiler'
2.Go to compiler options and enter ppc386 compiling options you wish to
use
3.Go to Project menu,and enter values for maintargetname and name for
source .pas
4.Go to Options menu and choose 'Save as'
5.Rhide tells you that you can save it under .gpr extension
  so just enter the name of your main .pas (program).

6.Do Save again.

7.Open your program.pas and close Rhide.

8.Now start Rhide and choose Project->OPen Project->yourproject.gpr
9.Try to compile it (not compile...it doesn't work for me..just make or  
        build)

If you want debug symbols then in compiler options say -g or -gl if you
use heaptrc unit.

Regards



Thu, 10 Jul 2003 23:42:56 GMT  
 FreePascal (FPC) and RHIDE

Quote:
>If you want debug symbols then in compiler options say -g or -gl if you
>use heaptrc unit.

-gl includes lineinfo (runtime errors with unitname and linenumber
backtrace),
-gh includes heaptrc (which includes heaptrc for memory leak backtrace)


Fri, 11 Jul 2003 02:14:16 GMT  
 FreePascal (FPC) and RHIDE
Hi,


Quote:

> >is it possible to use RHIDE to develop Pascal programs that will then be
> >compiled by FreePascal (and possibly debugged through gdb or whatever in
> >the IDE)? I thought it was possible, but i couldn't find anything in the
> >RHIDE documentation or in the options menu.

> Yes, IIRC on the FTP site there is some config file for that. Most FPC
> developpers use the own IDE, which is also downloadable from FTP (directory
> snapshot, idelinux.tar.gz)

Yes, but we need it for a competition where we are bound to using RHIDE.

Quote:
> >BTW, if i feed a line like

> >var timer      : Longint absolute $40:$6C;

> >to free pascal, it says:

> >foo.pas(4,35) Error: absolute can only be associated a var or const
> >foo.pas(4,35) Fatal: Syntax error, ; expected but ordinal const
> >found

> I'm not 100% sure FPC supports this, but the documentation is usually right.

Meanwhile i found a point in the FAQ that says a variable with an
absolute
value can only be located at the address of another variable or constant
(so actually you can only invent alias-variables).

That's sad because this was such a comfortable way of querying the
timer (BTW, was this thingy controlled by DOS or by the BIOS?).

Quote:
> But IF it is support, it is only supported  for the dos version (for BP
> compability) and probably only using the BP compability switch ( -So) Under
> other OSes this is not possible, which is also why we allow it in a special
> mode. (there are two BP compatible mode, a "as compatible as possible", and
> a more platform independant. The platform independant one is default)

Ok, then i should probably forget it anyway. We are using RHIDE under
linux.

Regards,

        Tobias

P.S. I wonder if still "Yogi" will appear as sender, i thought that i
had
     already changed the old entry before posting in this newsgroup -
sorry
     for not posting under my real name when i posted my first message.



Fri, 11 Jul 2003 07:33:57 GMT  
 FreePascal (FPC) and RHIDE
Hi,

Quote:

> > is it possible to use RHIDE to develop Pascal programs
> > that will then be compiled by FreePascal (and possibly
> > debugged through gdb or whatever in the IDE)?
> > I thought it was possible, but i couldn't find anything
> > in the RHIDE documentation or in the options menu.

> I'm working with Rhide 1.47 and FPC almost almost 8 months under linux
> and it works very good.

Fine, that's exactly what i am planning to do, too.

Quote:
> Here are the settings steps for rhide:
> 1.Go to environment settings and mark 'Use FPC compiler'

Ah, you mean in the settings of the project?
I had not created a real project so far, i
only opened single .PAS files. Therefore, i
never got into the project settings menue
with the free pascal option.

Can't i tell RHIDE to use free pascal by default?

Regards,

        Tobias



Fri, 11 Jul 2003 07:41:22 GMT  
 FreePascal (FPC) and RHIDE

Quote:

> > >var timer      : Longint absolute $40:$6C;

> > >to free pascal, it says:

> > >foo.pas(4,35) Error: absolute can only be associated a var or const
> > >foo.pas(4,35) Fatal: Syntax error, ; expected but ordinal const
> > >found

> > I'm not 100% sure FPC supports this, but the documentation is usually right.

> Meanwhile i found a point in the FAQ that says a variable with an
> absolute
> value can only be located at the address of another variable or constant
> (so actually you can only invent alias-variables).

The above works in the Dos version of FPC, but only there.

Quote:
> That's sad because this was such a comfortable way of querying the
> timer (BTW, was this thingy controlled by DOS or by the BIOS?).

The reason this doesn't work under Linux or anywhere else, is that
under Dos, mem[0:0] corresponds to the physical memory addres 0.
Win32/Linux/... remap the physical address space completely and also
don't allow you to access an arbitrary address (which is why you can
get General Protection Faults under Windows, but not under Dos unless
you use an EMM or a Dos extender).

So the timer iself is provided by the hardware, but the ability and way
to access it by the OS.

Jonas



Fri, 11 Jul 2003 18:57:55 GMT  
 FreePascal (FPC) and RHIDE

Quote:

>Hi,



>> >is it possible to use RHIDE to develop Pascal programs that will then be
>> >compiled by FreePascal (and possibly debugged through gdb or whatever in
>> >the IDE)? I thought it was possible, but i couldn't find anything in the
>> >RHIDE documentation or in the options menu.

>> Yes, IIRC on the FTP site there is some config file for that. Most FPC
>> developpers use the own IDE, which is also downloadable from FTP (directory
>> snapshot, idelinux.tar.gz)

>Yes, but we need it for a competition where we are bound to using RHIDE.

Hmm. Olympiad?

Quote:

>> I'm not 100% sure FPC supports this, but the documentation is usually right.

>Meanwhile i found a point in the FAQ that says a variable with an
>absolute
>value can only be located at the address of another variable or constant
>(so actually you can only invent alias-variables).

>That's sad because this was such a comfortable way of querying the
>timer (BTW, was this thingy controlled by DOS or by the BIOS?).

Bios afaik.
You can use the Go32 unit to access the first 1 MB. Simply do a dosmemget on
the right addr.

Quote:
>> But IF it is support, it is only supported  for the dos version (for BP
>> compability) and probably only using the BP compability switch ( -So) Under
>> other OSes this is not possible, which is also why we allow it in a special
>> mode. (there are two BP compatible mode, a "as compatible as possible", and
>> a more platform independant. The platform independant one is default)

>Ok, then i should probably forget it anyway. We are using RHIDE under
>linux.

Forget it, not possible. Use nanosleep to pauze. It is less CPU intensive
too.


Fri, 11 Jul 2003 19:15:39 GMT  
 FreePascal (FPC) and RHIDE

Quote:
> Hi,


> > > is it possible to use RHIDE to develop Pascal programs
> > > that will then be compiled by FreePascal (and possibly
> > > debugged through gdb or whatever in the IDE)?
> > > I thought it was possible, but i couldn't find anything
> > > in the RHIDE documentation or in the options menu.

> > I'm working with Rhide 1.47 and FPC almost almost 8 months under linux
> > and it works very good.

> Fine, that's exactly what i am planning to do, too.

> > Here are the settings steps for rhide:
> > 1.Go to environment settings and mark 'Use FPC compiler'

> Ah, you mean in the settings of the project?
> I had not created a real project so far, i
> only opened single .PAS files. Therefore, i
> never got into the project settings menue
> with the free pascal option.

> Can't i tell RHIDE to use free pascal by default?

I didn't found such a option.

Regards



Fri, 11 Jul 2003 23:29:05 GMT  
 FreePascal (FPC) and RHIDE
Hi,


Quote:



> >Yes, but we need it for a competition where we are bound to using RHIDE.

> Hmm. Olympiad?

Yes, it is for our national preparation rounds for the international
olympiad in informatics (IOI).

Quote:
> >> I'm not 100% sure FPC supports this, but the documentation is usually right.

> >Meanwhile i found a point in the FAQ that says a variable with an
> >absolute
> >value can only be located at the address of another variable or constant
> >(so actually you can only invent alias-variables).

> >That's sad because this was such a comfortable way of querying the
> >timer (BTW, was this thingy controlled by DOS or by the BIOS?).

> Bios afaik.
> You can use the Go32 unit to access the first 1 MB. Simply do a dosmemget on
> the right addr.

Meanwhile, when browsing the FreePascal docs, i found out it implements
the Dos
Unit from Borland Pascal which has a GetTime() Function. I'd prefer
getting the whole time in a single longint at once, but querying
hour,min,sec
and 1/100st secs is also acceptable.

One question here: is FreePascal still as dumb as Borland Pascal when
doing
a calculation for example with integers or words and assigning the
result
to a longint?

Quote:
> >Ok, then i should probably forget it anyway. We are using RHIDE under
> >linux.

> Forget it, not possible. Use nanosleep to pauze. It is less CPU intensive
> too.

I don't want to pause. I want a simple way to know how much time the
program was running when it terminates. I want to give the contestants
some simple basic program on which they can build their sources, and
it should contain a running time check. This was so simple under good
old BP 7.0 and DOS :-)

Regards,

        Tobias



Wed, 16 Jul 2003 05:05:14 GMT  
 FreePascal (FPC) and RHIDE

Quote:

>Hi,
>> Bios afaik.
>> You can use the Go32 unit to access the first 1 MB. Simply do a dosmemget on
>> the right addr.

>Meanwhile, when browsing the FreePascal docs, i found out it implements
>the Dos
>Unit from Borland Pascal which has a GetTime() Function. I'd prefer
>getting the whole time in a single longint at once, but querying
>hour,min,sec
>and 1/100st secs is also acceptable.

>One question here: is FreePascal still as dumb as Borland Pascal when
>doing
>a calculation for example with integers or words and assigning the
>result
>to a longint?

I don't exactly what you mean by this (example?), but if it is, probably
only with the double word size (longint and cardinals, assigned to an
int64)

Quote:
>> >Ok, then i should probably forget it anyway. We are using RHIDE under
>> >linux.

>> Forget it, not possible. Use nanosleep to pauze. It is less CPU intensive
>> too.

>I don't want to pause. I want a simple way to know how much time the
>program was running when it terminates. I want to give the contestants
>some simple basic program on which they can build their sources, and
>it should contain a running time check. This was so simple under good
>old BP 7.0 and DOS :-)

Hmm. There are also datetime routines in Sysutils, which work with epochs,
and direct Unix timestamps in unit Linux.


Thu, 17 Jul 2003 01:40:58 GMT  
 FreePascal (FPC) and RHIDE

Quote:
> >One question here: is FreePascal still as dumb as Borland Pascal when
> >doing
> >a calculation for example with integers or words and assigning the
> >result
> >to a longint?

> I don't exactly what you mean by this (example?), but if it is, probably
> only with the double word size (longint and cardinals, assigned to an
> int64)

He means this:

var i, k: integer;
    l: longint;
begin
     i := 10000;
     k := i;
     l := i * k;
     writeln (l); { not 100000000! }
end.

But this is standard pascal behaviour and is exactly the same even in C++,
but clearly stated there:

Given standard builtins
 int operator* (int, int);
 long operator= (int);

l = i * k;

is converted to
l.operator= (i.operator* (k));
             ^^^^^^^^^^^^^^^
while the i.operator* (k) is defined as returning an int.

A compiler could only do better when it does top-down analyzing, but
Pascal analyzed bottom-up (as well as C++, but Perl does not).

That is:

l := i * k;
is compiled as
1. I need i:integer * k:integer => this is an integer by definition of *
2. I need l:longint := (1.):integer => converting integer to longint.

Top-down analyzing would result in this:
1. I need l := <something> => <something> must be a longint to be able to
be assigned to l
2. I need <something> * <something> with an longint return value =>
the <something> must be converted to longint
3. I need longint (i) and longint (k).

--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.



Thu, 17 Jul 2003 22:05:44 GMT  
 FreePascal (FPC) and RHIDE

Quote:

>He means this:

>var i, k: integer;
>    l: longint;
>begin
>     i := 10000;
>     k := i;
>     l := i * k;
>     writeln (l); { not 100000000! }
>end.

Yes, I already expected this. As said, for FPC it is the same, but the limit
is not with longint, but the next type, int64, since the natural type is
longint, not integer.


Fri, 18 Jul 2003 02:50:23 GMT  
 FreePascal (FPC) and RHIDE

Quote:

> One question here: is FreePascal still as dumb as Borland Pascal when
> doing
> a calculation for example with integers or words and assigning the
> result to a longint?

This has nothing to do with being dumb. TP is a 16bit compiler and as
such evaluates all mathematical expressions involving only 8 and 16bit
values in 16bits. FPC is a 32bits compiler and as such uses 32bits.
It's just as "dumb" as TP when you do calculations on longints which
overflow into 64bits.

The reason is that the compilers don't know what the value will be used
for while they are evaluating an expression. And I believe the Pascal
standard says that all integer expressions should be evaluated in the
"integer" range (normally, integer is the natural word size of the
processor you're running on, though in the default FPC mode it's still
16bit for TP compatibility).

Jonas



Sat, 19 Jul 2003 03:39:07 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Help: RHIDE with FreePascal (in W32 env.)

2. RHIde and freepascal

3. How to use rhide and FPC under DOS

4. FPC + RHIDE + Linux questions

5. FPC:problem with printing from fpc programs

6. FPC: translate execvp from c to FPC

7. Rhide pascal source ?

8. is there source for rhide in pascal ?

9. GPC in RHIDE

10. GPC+Rhide

11. FPK and RHIDE

12. RHIDE and FPK

 

 
Powered by phpBB® Forum Software