marco 22 роки тому
батько
коміт
009bd44420
6 змінених файлів з 82 додано та 32 видалено
  1. 12 3
      fv/drivers.pas
  2. 22 9
      fv/fileio.pas
  3. 7 4
      fv/unixsmsg.inc
  4. 12 3
      fvision/drivers.pas
  5. 22 9
      fvision/fileio.pas
  6. 7 4
      fvision/unixsmsg.inc

+ 12 - 3
fv/drivers.pas

@@ -79,7 +79,7 @@ USES
      {$ifdef VER1_0}
        linux,
      {$else}
-       unix,
+       baseunix,unix,
      {$endif}
    {$ENDIF}
 
@@ -725,11 +725,17 @@ Function GetDosTicks:longint; { returns ticks at 18.2 Hz, just like DOS }
 {$ENDIF}
 {$IFDEF OS_UNIX}
   var
-    tv : TimeVal;
+     tv : TimeVal;
   {  tz : TimeZone;}
   begin
+    {$ifdef ver1_0}
     GetTimeOfDay(tv{,tz});
     GetDosTicks:=((tv.Sec mod 86400) div 60)*1092+((tv.Sec mod 60)*1000000+tv.USec) div 54945;
+    {$else}
+    FPGetTimeOfDay(@tv,nil{,tz}); 
+    GetDosTicks:=((tv.tv_Sec mod 86400) div 60)*1092+((tv.tv_Sec mod 60)*1000000+tv.tv_USec) div 54945;
+
+    {$endif}
   end;
 {$ENDIF OS_UNIX}
 {$IFDEF OS_WINDOWS}
@@ -1703,7 +1709,10 @@ BEGIN
 END.
 {
  $Log$
- Revision 1.37  2002-10-17 11:22:46  pierre
+ Revision 1.38  2003-10-01 16:20:27  marco
+  * baseunix fixes for 1.1
+
+ Revision 1.37  2002/10/17 11:22:46  pierre
   * fix a problem in InitVideo with StoreVideoMode
 
  Revision 1.36  2002/10/07 15:44:43  pierre

+ 22 - 9
fv/fileio.pas

@@ -236,7 +236,7 @@ FUNCTION FileWrite (Handle: THandle; Var Buf; Count: Sw_Word; Var Actual: Sw_Wor
     {$ifdef VER1_0}
       linux;
     {$else}
-      unix;
+      Baseunix,unix;
     {$endif}
 {$ENDIF}
 
@@ -293,7 +293,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}                                     { LINUX CODE }
 BEGIN
-   fdClose(Handle);                                   { Close the file }
+   {$ifdef ver1_0}fdClose{$else}fpclose{$endif}(Handle);                                   { Close the file }
    FileClose := LinuxError <= 0
 END;
 {$ENDIF}
@@ -396,12 +396,22 @@ BEGIN
 END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
+
+{$ifndef ver1_0}
+ var tmp : ansistring;
+{$endif}
+
 BEGIN
    if mode = fa_Create    then mode := Open_Creat or Open_RdWr else
    if mode = fa_OpenRead  then mode := Open_RdOnly             else
    if mode = fa_OpenWrite then mode := Open_WrOnly             else
    if mode = fa_Open      then mode := Open_RdWr;
-   FileOpen := fdOpen(FileName, mode);
+   {$ifdef ver1_0}
+   FileOpen := fdOpen(FileName,mode);
+   {$else}
+   tmp:=filename;
+   FileOpen := fpopen(tmp,longint(mode));
+   {$endif}
 END;
 {$ENDIF}
 
@@ -479,9 +489,9 @@ END;
 VAR
    Actual : LongInt;
 BEGIN
-   Actual := fdSeek(Handle, FileSize, 0);             { Position file }
+   Actual := {$ifdef ver1_0}fdSeek{$else} fplseek{$endif}(Handle, FileSize, 0);             { Position file }
    If (Actual = FileSize) Then Begin                  { No position error }
-     if (fdTruncate(Handle, FileSize))                { Truncate the file }
+     if ({$ifdef ver1_0}fdTruncate{$else}fpftruncate{$endif}(Handle,FileSize)){$ifndef ver1_0}=0{$endif}       { Truncate the file }
         Then SetFileSize := 0                         { No truncate error }
         else SetFileSize := 103;                      { File truncate error }
    End Else SetFileSize := 103;                       { File truncate error }
@@ -557,7 +567,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdSeek(Handle, Pos, MoveType);
+   Actual := {$ifdef ver1_0}fdSeek{$else}fplseek{$endif}(Handle, Pos, MoveType);
    If (Actual <> -1) Then SetFilePos := 0 Else        { No position error }
       SetFilePos := 107;                               { File position error }
 END;
@@ -621,7 +631,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdRead(Handle, Buf, Count);
+   Actual := {$ifdef ver1_0}fdRead{$else} fpread{$endif}(Handle, Buf, Count);
    if (Actual = Count) Then FileRead := 0             { No read error }
      Else FileRead := 104;                            { File read error }
 END;
@@ -685,7 +695,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdWrite(Handle, Buf, Count);
+   Actual := {$ifdef ver1_0}fdWrite{$else}fpwrite{$endif}(Handle, Buf, Count);
    If (Actual = Count) Then FileWrite := 0 Else       { No write error }
      FileWrite := 105;                                { File write error }
 END;
@@ -694,7 +704,10 @@ END;
 END.
 {
  $Log$
- Revision 1.10  2002-10-13 20:52:09  hajny
+ Revision 1.11  2003-10-01 16:20:27  marco
+  * baseunix fixes for 1.1
+
+ Revision 1.10  2002/10/13 20:52:09  hajny
    * mistyping corrected
 
  Revision 1.9  2002/10/12 19:39:00  hajny

+ 7 - 4
fv/unixsmsg.inc

@@ -28,7 +28,7 @@ uses
 {$ifdef VER1_0}
   linux;
 {$else}
-  unix;
+  BaseUnix,unix;
 {$endif}
 
 Const
@@ -49,7 +49,7 @@ begin
   PendingSystemEvents:=0;
   FillChar(LastSystemEvent,sizeof(TSystemEvent),0);
   FillChar(WinSize,sizeof(WinSize),0);
-  ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+  fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
   LastXSize:=WinSize.ws_row;
   LastYSize:=WinSize.ws_col;
   If LastXSize=0 then
@@ -100,7 +100,7 @@ begin
   else
    begin
      FillChar(WinSize,sizeof(WinSize),0);
-     ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+     fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
      if (winsize.ws_col<>0) and (winsize.ws_row<>0) and
         ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
        begin
@@ -119,7 +119,10 @@ end;
 
 {
   $Log$
-  Revision 1.3  2003-06-18 09:54:13  pierre
+  Revision 1.4  2003-10-01 16:20:27  marco
+   * baseunix fixes for 1.1
+
+  Revision 1.3  2003/06/18 09:54:13  pierre
    * use termios.inc TwinSize definition
 
   Revision 1.2  2002/06/07 14:15:10  pierre

+ 12 - 3
fvision/drivers.pas

@@ -79,7 +79,7 @@ USES
      {$ifdef VER1_0}
        linux,
      {$else}
-       unix,
+       baseunix,unix,
      {$endif}
    {$ENDIF}
 
@@ -725,11 +725,17 @@ Function GetDosTicks:longint; { returns ticks at 18.2 Hz, just like DOS }
 {$ENDIF}
 {$IFDEF OS_UNIX}
   var
-    tv : TimeVal;
+     tv : TimeVal;
   {  tz : TimeZone;}
   begin
+    {$ifdef ver1_0}
     GetTimeOfDay(tv{,tz});
     GetDosTicks:=((tv.Sec mod 86400) div 60)*1092+((tv.Sec mod 60)*1000000+tv.USec) div 54945;
+    {$else}
+    FPGetTimeOfDay(@tv,nil{,tz}); 
+    GetDosTicks:=((tv.tv_Sec mod 86400) div 60)*1092+((tv.tv_Sec mod 60)*1000000+tv.tv_USec) div 54945;
+
+    {$endif}
   end;
 {$ENDIF OS_UNIX}
 {$IFDEF OS_WINDOWS}
@@ -1703,7 +1709,10 @@ BEGIN
 END.
 {
  $Log$
- Revision 1.37  2002-10-17 11:22:46  pierre
+ Revision 1.38  2003-10-01 16:20:27  marco
+  * baseunix fixes for 1.1
+
+ Revision 1.37  2002/10/17 11:22:46  pierre
   * fix a problem in InitVideo with StoreVideoMode
 
  Revision 1.36  2002/10/07 15:44:43  pierre

+ 22 - 9
fvision/fileio.pas

@@ -236,7 +236,7 @@ FUNCTION FileWrite (Handle: THandle; Var Buf; Count: Sw_Word; Var Actual: Sw_Wor
     {$ifdef VER1_0}
       linux;
     {$else}
-      unix;
+      Baseunix,unix;
     {$endif}
 {$ENDIF}
 
@@ -293,7 +293,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}                                     { LINUX CODE }
 BEGIN
-   fdClose(Handle);                                   { Close the file }
+   {$ifdef ver1_0}fdClose{$else}fpclose{$endif}(Handle);                                   { Close the file }
    FileClose := LinuxError <= 0
 END;
 {$ENDIF}
@@ -396,12 +396,22 @@ BEGIN
 END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
+
+{$ifndef ver1_0}
+ var tmp : ansistring;
+{$endif}
+
 BEGIN
    if mode = fa_Create    then mode := Open_Creat or Open_RdWr else
    if mode = fa_OpenRead  then mode := Open_RdOnly             else
    if mode = fa_OpenWrite then mode := Open_WrOnly             else
    if mode = fa_Open      then mode := Open_RdWr;
-   FileOpen := fdOpen(FileName, mode);
+   {$ifdef ver1_0}
+   FileOpen := fdOpen(FileName,mode);
+   {$else}
+   tmp:=filename;
+   FileOpen := fpopen(tmp,longint(mode));
+   {$endif}
 END;
 {$ENDIF}
 
@@ -479,9 +489,9 @@ END;
 VAR
    Actual : LongInt;
 BEGIN
-   Actual := fdSeek(Handle, FileSize, 0);             { Position file }
+   Actual := {$ifdef ver1_0}fdSeek{$else} fplseek{$endif}(Handle, FileSize, 0);             { Position file }
    If (Actual = FileSize) Then Begin                  { No position error }
-     if (fdTruncate(Handle, FileSize))                { Truncate the file }
+     if ({$ifdef ver1_0}fdTruncate{$else}fpftruncate{$endif}(Handle,FileSize)){$ifndef ver1_0}=0{$endif}       { Truncate the file }
         Then SetFileSize := 0                         { No truncate error }
         else SetFileSize := 103;                      { File truncate error }
    End Else SetFileSize := 103;                       { File truncate error }
@@ -557,7 +567,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdSeek(Handle, Pos, MoveType);
+   Actual := {$ifdef ver1_0}fdSeek{$else}fplseek{$endif}(Handle, Pos, MoveType);
    If (Actual <> -1) Then SetFilePos := 0 Else        { No position error }
       SetFilePos := 107;                               { File position error }
 END;
@@ -621,7 +631,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdRead(Handle, Buf, Count);
+   Actual := {$ifdef ver1_0}fdRead{$else} fpread{$endif}(Handle, Buf, Count);
    if (Actual = Count) Then FileRead := 0             { No read error }
      Else FileRead := 104;                            { File read error }
 END;
@@ -685,7 +695,7 @@ END;
 {$ENDIF}
 {$IFDEF OS_UNIX}
 BEGIN
-   Actual := fdWrite(Handle, Buf, Count);
+   Actual := {$ifdef ver1_0}fdWrite{$else}fpwrite{$endif}(Handle, Buf, Count);
    If (Actual = Count) Then FileWrite := 0 Else       { No write error }
      FileWrite := 105;                                { File write error }
 END;
@@ -694,7 +704,10 @@ END;
 END.
 {
  $Log$
- Revision 1.10  2002-10-13 20:52:09  hajny
+ Revision 1.11  2003-10-01 16:20:27  marco
+  * baseunix fixes for 1.1
+
+ Revision 1.10  2002/10/13 20:52:09  hajny
    * mistyping corrected
 
  Revision 1.9  2002/10/12 19:39:00  hajny

+ 7 - 4
fvision/unixsmsg.inc

@@ -28,7 +28,7 @@ uses
 {$ifdef VER1_0}
   linux;
 {$else}
-  unix;
+  BaseUnix,unix;
 {$endif}
 
 Const
@@ -49,7 +49,7 @@ begin
   PendingSystemEvents:=0;
   FillChar(LastSystemEvent,sizeof(TSystemEvent),0);
   FillChar(WinSize,sizeof(WinSize),0);
-  ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+  fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
   LastXSize:=WinSize.ws_row;
   LastYSize:=WinSize.ws_col;
   If LastXSize=0 then
@@ -100,7 +100,7 @@ begin
   else
    begin
      FillChar(WinSize,sizeof(WinSize),0);
-     ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+     fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
      if (winsize.ws_col<>0) and (winsize.ws_row<>0) and
         ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
        begin
@@ -119,7 +119,10 @@ end;
 
 {
   $Log$
-  Revision 1.3  2003-06-18 09:54:13  pierre
+  Revision 1.4  2003-10-01 16:20:27  marco
+   * baseunix fixes for 1.1
+
+  Revision 1.3  2003/06/18 09:54:13  pierre
    * use termios.inc TwinSize definition
 
   Revision 1.2  2002/06/07 14:15:10  pierre