Not supported: variant record lazarus / 76-Pas2JS ---------------------------------------------------------------------- peter.dell · 2024-05-01 22:07 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 · 2024-05-02 11:22 Quote from: peter.dell on May 02, 2024, 12:07:35 amI've tried to get the Java Bytecode target working for quite some time, but it looks like that's far from reality. 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 · 2024-05-03 04:28 Quote from: Thaddy on May 02, 2024, 01:22:36 pmIn what sense? I use it daily. I might be able to help, but you did not describe any issue.. 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. 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 · 2024-05-03 04:42 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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TNameStr = string[32];...var  Name: TNameStr;... ...if it were... /bc ---------------------------------------------------------------------- peter.dell · 2024-05-03 05:51 Please excuse me for not providing the whole context. This is the whole "type.inc" file. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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; ---------------------------------------------------------------------- cdbc · 2024-05-03 08:06 hey Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 ansichar; //<-- or ~ string[16];  end; /bc ---------------------------------------------------------------------- peter.dell · 2024-05-03 21:08 It is really intended to be an array of strings. Here's an example of how it is filled: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i target.header[0]  := 'opt h-f+';target.header[1]  := 'org $801';target.header[2]  := 'org [a($801)],$801';target.header[3]  := 'basic_start(START)';target.header[4]  := ''; // asm65;target.header[5]  := 'org $900';target.header[6]  := ''; // asm65;target.header[7]  := 'END';