Browse Source

* more updates to attempt to get a larger part of the full RTL to compile for WASM32

git-svn-id: branches/wasm@47970 -
nickysn 4 years ago
parent
commit
a5fafea8d1
5 changed files with 66 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 8 0
      rtl/inc/system.inc
  3. 34 0
      rtl/wasi/sysos.inc
  4. 6 0
      rtl/wasi/system.pp
  5. 16 0
      rtl/wasm32/wasm32.inc

+ 2 - 0
.gitattributes

@@ -12188,10 +12188,12 @@ rtl/unix/unxovl.inc svneol=native#text/plain
 rtl/unix/unxovlh.inc svneol=native#text/plain
 rtl/unix/x86.pp svneol=native#text/plain
 rtl/wasi/rtldefs.inc svneol=native#text/plain
+rtl/wasi/sysos.inc svneol=native#text/plain
 rtl/wasi/sysosh.inc svneol=native#text/plain
 rtl/wasi/system.pp svneol=native#text/plain
 rtl/wasm32/cpuh.inc svneol=native#text/plain
 rtl/wasm32/setjumph.inc svneol=native#text/plain
+rtl/wasm32/wasm32.inc svneol=native#text/plain
 rtl/watcom/Makefile svneol=native#text/plain
 rtl/watcom/Makefile.fpc svneol=native#text/plain
 rtl/watcom/classes.pp svneol=native#text/plain

+ 8 - 0
rtl/inc/system.inc

@@ -315,6 +315,14 @@ function do_isdevice(handle:thandle):boolean;forward;
   {$define SYSPROCDEFINED}
 {$endif cpuz80}
 
+{$ifdef cpuwasm32}
+  {$ifdef SYSPROCDEFINED}
+    {$Error Can't determine processor type !}
+  {$endif}
+  {$i wasm32.inc}  { Case dependent, don't change }
+  {$define SYSPROCDEFINED}
+{$endif cpuwasm32}
+
 {$ifndef SYSPROCDEFINED}
   {$Error Can't determine processor type !}
 {$endif}

+ 34 - 0
rtl/wasi/sysos.inc

@@ -0,0 +1,34 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2013 by Free Pascal development team
+
+    This file implements all the base types and limits required
+    for a minimal POSIX compliant subset required to port the compiler
+    to a new OS.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{procedure GetInOutRes(def: Word);
+var
+  regs : Registers;
+begin
+  regs.AX:=$5900;
+  regs.BX:=$0;
+  MsDos(regs);
+  InOutRes:=regs.AX;
+  case InOutRes of
+   19 : InOutRes:=150;
+   21 : InOutRes:=152;
+   32 : InOutRes:=5;
+  end;
+  if InOutRes=0 then
+    InOutRes:=Def;
+end;}
+

+ 6 - 0
rtl/wasi/system.pp

@@ -8,6 +8,9 @@ interface
 
 {$I systemh.inc}
 
+const
+  maxExitCode = 65535;
+
 {$else FULL_RTL}
 type
   integer = longint;
@@ -43,6 +46,9 @@ type
   end;
 
 {$ifdef FULL_RTL}
+
+{$I system.inc}
+
 {$else FULL_RTL}
 procedure fpc_lib_exit; compilerproc;
 begin

+ 16 - 0
rtl/wasm32/wasm32.inc

@@ -0,0 +1,16 @@
+{
+
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2017 by the Free Pascal development team.
+
+    Processor dependent implementation for the system unit for
+    WebAssembly 32-bit
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}