浏览代码

* moved the preopened dir and current dir handling types and variables to the
implementation part of the system unit, so their implementation is not exposed
and can be changed in the future (e.g. for thread safety when WebAssembly
gets multithreading support, etc.)

Nikolay Nikolov 4 年之前
父节点
当前提交
64db584eef
共有 1 个文件被更改,包括 17 次插入15 次删除
  1. 17 15
      rtl/wasi/system.pp

+ 17 - 15
rtl/wasi/system.pp

@@ -48,6 +48,23 @@ const
   sLineBreak = LineEnding;
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
 
+var
+  argc: longint;
+  argv: PPChar;
+  envp: PPChar;
+
+function ConvertToFdRelativePath(path: ansistring; out fd: LongInt; out relfd_path: ansistring): Boolean;
+
+implementation
+
+{$I wasitypes.inc}
+{$I wasiprocs.inc}
+
+function HasDriveLetter(const path: rawbytestring): Boolean;
+begin
+  HasDriveLetter:=(path<>'') and (UpCase(path[1]) in ['A'..'Z']) and (path[2] = ':');
+end;
+
 type
   PPreopenedDir = ^TPreopenedDir;
   TPreopenedDir = record
@@ -60,27 +77,12 @@ type
   end;
 
 var
-  argc: longint;
-  argv: PPChar;
-  envp: PPChar;
   preopened_dirs_count: longint;
   preopened_dirs: PPreopenedDir;
   drives_count: longint;
   current_dirs: PCurrentDir;
   current_drive: longint;
 
-function ConvertToFdRelativePath(path: ansistring; out fd: LongInt; out relfd_path: ansistring): Boolean;
-
-implementation
-
-{$I wasitypes.inc}
-{$I wasiprocs.inc}
-
-function HasDriveLetter(const path: rawbytestring): Boolean;
-begin
-  HasDriveLetter:=(path<>'') and (UpCase(path[1]) in ['A'..'Z']) and (path[2] = ':');
-end;
-
 {$I system.inc}
 
 var