Selaa lähdekoodia

* 1.9.x fixes

marco 21 vuotta sitten
vanhempi
commit
5f8f040fdc
6 muutettua tiedostoa jossa 35 lisäystä ja 35 poistoa
  1. 8 8
      docs/linuxex/ex33.pp
  2. 3 3
      docs/linuxex/ex34.pp
  3. 15 15
      docs/linuxex/ex35.pp
  4. 3 3
      docs/linuxex/ex36.pp
  5. 4 4
      docs/linuxex/ex37.pp
  6. 2 2
      docs/linuxex/ex38.pp

+ 8 - 8
docs/linuxex/ex33.pp

@@ -2,22 +2,22 @@ Program Example33;
 
 { Program to demonstrate the Select function. }
 
-Uses linux;
+Uses BaseUnix;
 
-Var FDS : FDSet;
+Var FDS : sigset_t;
 
 begin
-  FD_Zero (FDS);
-  FD_Set (0,FDS);
+  fpsigemptyset (FDS);
+  fpsigaddset (FDS,0);
   Writeln ('Press the <ENTER> to continue the program.');
   { Wait until File descriptor 0 (=Input) changes }
-  Select (1,@FDS,nil,nil,nil);
+  fpSelect (1,@FDS,nil,nil,nil);
   { Get rid of <ENTER> in buffer }
   readln;
   Writeln ('Press <ENTER> key in less than 2 seconds...');
-  FD_Zero (FDS);
-  FD_Set (0,FDS);
-  if Select (1,@FDS,nil,nil,2000)>0 then 
+  fpsigemptyset (FDS);
+  fpsigaddset (FDS,0);
+  if fpSelect (1,@FDS,nil,nil,2000)>0 then 
     Writeln ('Thank you !')
     { FD_ISSET(0,FDS) would be true here. }
   else

+ 3 - 3
docs/linuxex/ex34.pp

@@ -2,7 +2,7 @@ Program Example33;
 
 { Program to demonstrate the SelectText function. }
 
-Uses linux;
+Uses Unix;
 
 Var tv : TimeVal;
     
@@ -13,8 +13,8 @@ begin
   { Get rid of <ENTER> in buffer }
   readln;
   Writeln ('Press <ENTER> key in less than 2 seconds...');
-  tv.sec:=2;
-  tv.usec:=0;
+  tv.tv_sec:=2;
+  tv.tv_sec:=0;
   if SelectText (Input,@tv)>0 then 
     Writeln ('Thank you !')
   else

+ 15 - 15
docs/linuxex/ex35.pp

@@ -3,25 +3,25 @@ Program Example35;
 { Program to demonstrate the 
   OpenDir,ReadDir, SeekDir and TellDir functions. }
 
-Uses linux;
+Uses BaseUnix;
 
 Var TheDir : PDir;
     ADirent : PDirent;
     Entry : Longint;
 
 begin
-  TheDir:=OpenDir('./.');
+  TheDir:=fpOpenDir('./.');
   Repeat 
-    Entry:=TellDir(TheDir);
-    ADirent:=ReadDir (TheDir);
+//    Entry:=fpTellDir(TheDir);
+    ADirent:=fpReadDir (TheDir^);
     If ADirent<>Nil then
       With ADirent^ do
         begin
         Writeln ('Entry No : ',Entry);
-        Writeln ('Inode    : ',ino);
-        Writeln ('Offset   : ',off);
-        Writeln ('Reclen   : ',reclen);
-        Writeln ('Name     : ',pchar(@name[0]));
+        Writeln ('Inode    : ',d_fileno);
+//        Writeln ('Offset   : ',d_off);
+        Writeln ('Reclen   : ',d_reclen);
+        Writeln ('Name     : ',pchar(@d_name[0]));
         end;
   Until ADirent=Nil;
   Repeat
@@ -29,18 +29,18 @@ begin
     ReadLn (Entry);
     If Entry<>-1 then 
       begin
-      SeekDir (TheDir,Entry);
-      ADirent:=ReadDir (TheDir);
+//      fpSeekDir (TheDir,Entry);		// not implemented for various platforms
+      ADirent:=fpReadDir (TheDir^);
       If ADirent<>Nil then
         With ADirent^ do
           begin
           Writeln ('Entry No : ',Entry);
-          Writeln ('Inode    : ',ino);
-          Writeln ('Offset   : ',off);
-          Writeln ('Reclen   : ',reclen);
-          Writeln ('Name     : ',pchar(@name[0]));
+          Writeln ('Inode    : ',d_fileno);
+//          Writeln ('Offset   : ',off);
+          Writeln ('Reclen   : ',d_reclen);
+          Writeln ('Name     : ',pchar(@d_name[0]));
           end;
     end;
   Until Entry=-1;
-  CloseDir (TheDir);
+  fpCloseDir (TheDir^);
 end.

+ 3 - 3
docs/linuxex/ex36.pp

@@ -2,15 +2,15 @@ Program Example36;
 
 { Program to demonstrate the AssignPipe function. }
 
-Uses linux;
+Uses BaseUnix,Unix;
 
 Var pipi,pipo : Text;
     s : String;
     
 begin
   Writeln ('Assigning Pipes.');
-  If Not assignpipe(pipi,pipo) then
-    Writeln('Error assigning pipes !',LinuxError);
+  If assignpipe(pipi,pipo)<>0 then
+    Writeln('Error assigning pipes !',fpgeterrno);
   Writeln ('Writing to pipe, and flushing.');
   Writeln (pipo,'This is a textstring');close(pipo);
   Writeln ('Reading from pipe.');

+ 4 - 4
docs/linuxex/ex37.pp

@@ -2,7 +2,7 @@ Program Example37;
 
 { Program to demonstrate the Popen function. }
 
-uses linux;
+uses BaseUnix,Unix;
 
 var f : text;
     i : longint;
@@ -19,10 +19,10 @@ begin
   writeln (f,'exit 2');
   writeln (f);
   close (f);
-  chmod ('test21a',octal (755));
+  fpchmod ('test21a',&755);
   popen (f,'./test21a arg1 arg2','W');
-  if linuxerror<>0 then 
-     writeln ('error from POpen : Linuxerror : ', Linuxerror);
+  if fpgeterrno<>0 then 
+     writeln ('error from POpen : errno : ', fpgeterrno);
   for i:=1 to 10 do 
     writeln (f,'This is written to the pipe, and should appear on stdout.');
   Flush(f);

+ 2 - 2
docs/linuxex/ex38.pp

@@ -2,7 +2,7 @@ Program Example38;
 
 { Program to demonstrate the AssignStream function. }
 
-Uses linux;
+Uses BaseUnix,Unix;
 
 Var Si,So : Text;
     S : String;
@@ -13,7 +13,7 @@ begin
     begin
     Writeln ('Calling son');
     Assignstream (Si,So,'./ex38 -son');
-    if linuxerror<>0 then 
+    if fpgeterrno<>0 then 
       begin
       writeln ('AssignStream failed !');
       halt(1);