소스 검색

* 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