Forum > Pas2JS

Not supported: variant record

(1/2) > >>

peter.dell:
Hello,

I've tried to get the Java Bytecode target working for quite some time, but it looks like that's far from reality. So I now had the idea of using pas2js and then running the Javascript inside die Java VM (e.g. via Nashorn).

The first attempts look promising. I had to change some parts in the code where pas2js appears to be stricter than FPC (e.g. {I+) => {IOCHECK+}; string[32] => array[0..31] of string, ...).

But I think now I've come to the point where pas2js needs an extension. Is there a standard way of requesting an extension, like here, support for variant records?

- Kind regards Peter/JAC!

C:\Users\JAC\Downloads\pas2js-win64-x86_64-3.0.1>bin\pas2js.exe -Mdelphi src\mp.pas
Pas2JS Compiler version 3.0.1 [2024/01/25] for Win32 i386
Copyright (c) 2023 Free Pascal team.
packages\rtl\src\js.pas(1012,15) Warning: Symbol "Int64" is not implemented
packages\rtl\src\js.pas(1014,15) Warning: Symbol "Int64" is not implemented
packages\rtl\src\js.pas(1047,14) Hint: method hides identifier at "packages\rtl\src\js.pas(87,21)". Use reintroduce
packages\rtl\src\js.pas(1050,36) Warning: Symbol "Int64" is not implemented
packages\rtl\src\js.pas(1052,36) Warning: Symbol "Int64" is not implemented
src\Common.pas(407,5) Warning: Symbol "Int64" is not implemented

src\Common.pas(424,23) Error: Not supported: variant record

  TToken = record
    UnitIndex, Column: Smallint;
    Line: Integer;
    case Kind: Byte of
      IDENTTOK:
   (Name: ^TString);
      INTNUMBERTOK:
   (Value: Int64);
      FRACNUMBERTOK:
   (FracValue: Single);
      STRINGLITERALTOK:
   (StrAddress: Word;
    StrLength: Word);
    end;

Fatal: Compilation aborted

Thaddy:

--- Quote from: peter.dell on May 02, 2024, 12:07:35 am ---I've tried to get the Java Bytecode target working for quite some time, but it looks like that's far from reality.

--- End quote ---
In what sense? I use it daily. I might be able to help, but you did not describe any issue..


Btw:
 string[32] => array[0..31] of string, ...)
is wrong of course, it is a shortstring of length 32, not an array of string, but essentially an array of AnsiChar.

peter.dell:

--- Quote from: Thaddy on May 02, 2024, 01:22:36 pm ---In what sense? I use it daily. I might be able to help, but you did not describe any issue..

--- End quote ---
That would be great. I'll get in contact with you via DM.


--- Quote --- string[32] => array[0..31] of string, ...)
is wrong of course, it is a shortstring of length 32, not an array of string, but essentially an array of AnsiChar.

--- End quote ---
Thanks, I was not aware shortstrings existed. But that means pas2js does not support them?
The line
    name : string[32];
results in "src\targets\type.inc(8,18) Error: Expected ";" or "End""

cdbc:
Hey
None of us can read anything from 1 line of code and then deduce what went wrong  >:(
Hazarding a wild guess here:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type  TNameStr = string[32];...var  Name: TNameStr;... ...if it were...
/bc

peter.dell:
Please excuse me for not providing the whole context. This is the whole "type.inc" file.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type   tCPU = (CPU_6502, CPU_65C02, CPU_65816);   tComputer = (___c64, ___c4p, ___a8, ___raw, ___neo, ___x16);   TTarget = Record    name : string[32];    id: tComputer;    cpu: tCPU;    eol: byte;    zpage,    buf,    codeorigin : word;    header          : array[0..15] of string;  end; 

Navigation

[0] Message Index

[#] Next page

Go to full version