浏览代码

+ first attempts to compile a full WASI rtl

git-svn-id: branches/wasm@47958 -
nickysn 4 年之前
父节点
当前提交
9bd8b66e86
共有 4 个文件被更改,包括 69 次插入4 次删除
  1. 2 0
      .gitattributes
  2. 24 0
      rtl/wasi/rtldefs.inc
  3. 27 0
      rtl/wasi/sysosh.inc
  4. 16 4
      rtl/wasi/system.pp

+ 2 - 0
.gitattributes

@@ -12187,6 +12187,8 @@ rtl/unix/unxdeclh.inc svneol=native#text/plain
 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/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

+ 24 - 0
rtl/wasi/rtldefs.inc

@@ -0,0 +1,24 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2012 by Free Pascal development team
+
+    This file contains platform-specific defines that are used in
+    multiple RTL units.
+
+    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.
+
+ **********************************************************************}
+
+{ the single byte OS APIs always use UTF-8 }
+{ define FPCRTL_FILESYSTEM_UTF8}
+
+{ The OS supports a single byte file system operations API that we use }
+{$define FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
+
+{ The OS supports a two byte file system operations API that we use }
+{ define FPCRTL_FILESYSTEM_TWO_BYTE_API}

+ 27 - 0
rtl/wasi/sysosh.inc

@@ -0,0 +1,27 @@
+{
+    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.
+
+ **********************************************************************}
+
+{Platform specific information}
+type
+  THandle = Word;
+  TThreadID = THandle;
+  TOSTimestamp = LongInt;
+
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = record
+    Locked: boolean
+  end;

+ 16 - 4
rtl/wasi/system.pp

@@ -2,6 +2,13 @@ unit system;
 
 interface
 
+{$define FPC_IS_SYSTEM}
+
+{$ifdef FULL_RTL}
+
+{$I systemh.inc}
+
+{$else FULL_RTL}
 type
   integer = longint;
   hresult = integer; 
@@ -12,6 +19,8 @@ type
   pchar = ^Char;
 
 procedure fpc_lib_exit; compilerproc;
+{$endif FULL_RTL}
+
 procedure DebugWrite(const P: PChar);
 procedure DebugWriteChar(Ch: Char);
 procedure DebugWriteHexDigit(d: Byte);
@@ -19,6 +28,13 @@ procedure DebugWriteHexByte(b: Byte);
 
 implementation
 
+{$ifdef FULL_RTL}
+{$else FULL_RTL}
+procedure fpc_lib_exit; compilerproc;
+begin
+end;
+{$endif FULL_RTL}
+
 type
   P__wasi_size_t = ^__wasi_size_t;
   __wasi_size_t = longint;
@@ -79,8 +95,4 @@ begin
   DebugWriteHexDigit(b and 15);
 end;
 
-procedure fpc_lib_exit; compilerproc;
-begin
-end;
-
 end.