Re: [fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Marco van de Voort


Op 2020-06-27 om 04:09 schreef Travis Siegel:
I'm porting some code from tp7 to fpc, and I'm running into an error I 
don't know how to fix.  The comments claim it's supposed to be a hash 
table, but to me, it looks more like labels tied to various arrays.


If you assume that variables are not rearranged in memory, it looks like 
a constant declaration of a linked list. That means there might be even 
more problems than just getting it compiled without errors.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Sven Barth via fpc-pascal

Am 27.06.2020 um 04:09 schrieb Travis Siegel:
I'm porting some code from tp7 to fpc, and I'm running into an error I 
don't know how to fix.  The comments claim it's supposed to be a hash 
table, but to me, it looks more like labels tied to various arrays.



  Ofs_00_02: Word = Ofs (Ofs_00_01);
  Tok_00_02: TToken = Token_BEGIN;
  ResWordLen_BEGIN: Byte = 5;
  ResWord_BEGIN: Array [1..5] of Char = 'BEGIN';

  Ofs_00_03: Word = Ofs (Ofs_00_02);
  Tok_00_03: TToken = Token_DIV;
  ResWordLen_DIV: Byte = 3;
  ResWord_DIV: Array [1..3] of Char = 'DIV';

  Ofs_00_04: Word = Ofs (Ofs_00_03);
  Tok_00_04: TToken = Token_NIL;
  ResWordLen_NIL: Byte = 3;
  ResWord_NIL: Array [1..3] of Char = 'NIL';

  Ofs_00_05: Word = Ofs (Ofs_00_04);
  Tok_00_05: TToken = Token_PROCEDURE;
  ResWordLen_PROCEDURE: Byte = 9;
  ResWord_PROCEDURE: Array [1..9] of Char = 'PROCEDURE';

Fpc just gives me illegal expression errors, with no indication as to 
what's illegal about them.  Any suggestions?


The Ofs() function is specific to the i8086 (which FPC would support in 
theory) and denotes the offset of the variable inside its data segment. 
For modern, flat memory modes you can replace them by code like this:


Ofs_00_02: Pointer = @Ofs_00_01;
...
Ofs_00_03: Pointer = @Ofs_00_02;

Note: in theory you could use "Ofs_00_02: PtrUInt = 
PtrUInt(@Ofs_00_01);" as well, but using a pointer type will ensure that 
you have to fix all locations where the Ofs_* variables are used as 
otherwise you'd only work with a Word range of values: You need to 
ensure that these locations use PtrUInt for any differences instead of 
Word. Afterwards you could change the Pointer types to PByte so that you 
can use Pointer arithmetic (this way you shouldn't need to change any 
calculations done on the Ofs_* variables except for the type used for 
differences).


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Mattias Gaertner via fpc-pascal
On Fri, 26 Jun 2020 22:09:39 -0400
Travis Siegel  wrote:

> I'm porting some code from tp7 to fpc, and I'm running into an error
> I don't know how to fix.  The comments claim it's supposed to be a
> hash table, but to me, it looks more like labels tied to various
> arrays.
> 
> 
>    Ofs_00_02: Word = Ofs (Ofs_00_01);

It looks like some 16-bit optimization for older CPUs, not supported by
FPC:

https://www.freepascal.org/docs-html/rtl/system/ofs.html

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Travis Siegel


On 6/27/2020 5:34 AM, Zamrony P. Juhara via fpc-pascal wrote:

Use {$MODE TP}

Zamrony P. Juhara




Hadn't known about that particular directive, but it changes nothing.  
Using -Mtp also changes nothing.


Still get illegal expression errors.  Anyone know how to convert 
this to something FPC can parse? I tried looking up hash tables in the 
help files, but the brief summaries there don't shed enough light on the 
syntax for me to figure out how to convert this mess to something FPC 
can handle.




On Sat, Jun 27, 2020 at 14:27, Travis Siegel

 wrote:
I'm porting some code from tp7 to fpc, and I'm running into an
error I
don't know how to fix.  The comments claim it's supposed to be a hash
table, but to me, it looks more like labels tied to various arrays.


  Ofs_00_02: Word = Ofs (Ofs_00_01);
  Tok_00_02: TToken = Token_BEGIN;
  ResWordLen_BEGIN: Byte = 5;
  ResWord_BEGIN: Array [1..5] of Char = 'BEGIN';

  Ofs_00_03: Word = Ofs (Ofs_00_02);
  Tok_00_03: TToken = Token_DIV;
  ResWordLen_DIV: Byte = 3;
  ResWord_DIV: Array [1..3] of Char = 'DIV';

  Ofs_00_04: Word = Ofs (Ofs_00_03);
  Tok_00_04: TToken = Token_NIL;
  ResWordLen_NIL: Byte = 3;
  ResWord_NIL: Array [1..3] of Char = 'NIL';

  Ofs_00_05: Word = Ofs (Ofs_00_04);
  Tok_00_05: TToken = Token_PROCEDURE;
  ResWordLen_PROCEDURE: Byte = 9;
  ResWord_PROCEDURE: Array [1..9] of Char = 'PROCEDURE';

Fpc just gives me illegal expression errors, with no indication as to
what's illegal about them.  Any suggestions?

Thanks for any help in advance.

___
fpc-pascal maillist  - fpc-pascal@lists.freepascal.org

https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Zamrony P. Juhara via fpc-pascal
Use {$MODE TP}

Zamrony P. Juhara
https://v3.juhara.com
https://github.com/zamronypj

Fano Framework
https://fanoframework.github.io

mod_pascal
https://zamronypj.github.io/mod_pascal 
 
  On Sat, Jun 27, 2020 at 14:27, Travis Siegel wrote:   
I'm porting some code from tp7 to fpc, and I'm running into an error I 
don't know how to fix.  The comments claim it's supposed to be a hash 
table, but to me, it looks more like labels tied to various arrays.


   Ofs_00_02: Word = Ofs (Ofs_00_01);
   Tok_00_02: TToken = Token_BEGIN;
   ResWordLen_BEGIN: Byte = 5;
   ResWord_BEGIN: Array [1..5] of Char = 'BEGIN';

   Ofs_00_03: Word = Ofs (Ofs_00_02);
   Tok_00_03: TToken = Token_DIV;
   ResWordLen_DIV: Byte = 3;
   ResWord_DIV: Array [1..3] of Char = 'DIV';

   Ofs_00_04: Word = Ofs (Ofs_00_03);
   Tok_00_04: TToken = Token_NIL;
   ResWordLen_NIL: Byte = 3;
   ResWord_NIL: Array [1..3] of Char = 'NIL';

   Ofs_00_05: Word = Ofs (Ofs_00_04);
   Tok_00_05: TToken = Token_PROCEDURE;
   ResWordLen_PROCEDURE: Byte = 9;
   ResWord_PROCEDURE: Array [1..9] of Char = 'PROCEDURE';

Fpc just gives me illegal expression errors, with no indication as to 
what's illegal about them.  Any suggestions?

Thanks for any help in advance.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
  
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] how to make this tp7 code work on fpc

2020-06-27 Thread Travis Siegel
I'm porting some code from tp7 to fpc, and I'm running into an error I 
don't know how to fix.  The comments claim it's supposed to be a hash 
table, but to me, it looks more like labels tied to various arrays.



  Ofs_00_02: Word = Ofs (Ofs_00_01);
  Tok_00_02: TToken = Token_BEGIN;
  ResWordLen_BEGIN: Byte = 5;
  ResWord_BEGIN: Array [1..5] of Char = 'BEGIN';

  Ofs_00_03: Word = Ofs (Ofs_00_02);
  Tok_00_03: TToken = Token_DIV;
  ResWordLen_DIV: Byte = 3;
  ResWord_DIV: Array [1..3] of Char = 'DIV';

  Ofs_00_04: Word = Ofs (Ofs_00_03);
  Tok_00_04: TToken = Token_NIL;
  ResWordLen_NIL: Byte = 3;
  ResWord_NIL: Array [1..3] of Char = 'NIL';

  Ofs_00_05: Word = Ofs (Ofs_00_04);
  Tok_00_05: TToken = Token_PROCEDURE;
  ResWordLen_PROCEDURE: Byte = 9;
  ResWord_PROCEDURE: Array [1..9] of Char = 'PROCEDURE';

Fpc just gives me illegal expression errors, with no indication as to 
what's illegal about them.  Any suggestions?


Thanks for any help in advance.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal