Selaa lähdekoodia

* fpISxxx renamed

peter 22 vuotta sitten
vanhempi
commit
87f0147dff
5 muutettua tiedostoa jossa 81 lisäystä ja 52 poistoa
  1. 18 15
      rtl/bsd/bunxmacr.inc
  2. 8 5
      rtl/bsd/osmain.inc
  3. 36 32
      rtl/bsd/ossysc.inc
  4. 18 0
      rtl/bsd/unxsysc.inc
  5. 1 0
      rtl/bsd/unxsysch.inc

+ 18 - 15
rtl/bsd/bunxmacr.inc

@@ -22,42 +22,42 @@
 
 
  ****************************************************************************}
  ****************************************************************************}
 
 
-function FPISDIR(m : TMode): boolean;
+function FPS_ISDIR(m : TMode): boolean;
 
 
 begin
 begin
- FPISDIR:=((m and S_IFMT) = S_IFDIR);
+ FPS_ISDIR:=((m and S_IFMT) = S_IFDIR);
 end;
 end;
 
 
-function FPISCHR(m : TMode): boolean;
+function FPS_ISCHR(m : TMode): boolean;
 begin
 begin
- FPISCHR:=((m and S_IFMT) = S_IFCHR);
+ FPS_ISCHR:=((m and S_IFMT) = S_IFCHR);
 end;
 end;
 
 
-function FPISBLK(m : TMode): boolean;
+function FPS_ISBLK(m : TMode): boolean;
 begin
 begin
- FPISBLK:=((m and S_IFMT) = S_IFBLK);
+ FPS_ISBLK:=((m and S_IFMT) = S_IFBLK);
 end;
 end;
 
 
-function FPISREG(m : TMode): boolean;
+function FPS_ISREG(m : TMode): boolean;
 begin
 begin
- FPISREG:=((m and S_IFMT) = S_IFREG);
+ FPS_ISREG:=((m and S_IFMT) = S_IFREG);
 end;
 end;
 
 
-function FPISFIFO(m : TMode): boolean;
+function FPS_ISFIFO(m : TMode): boolean;
 begin
 begin
- FPISFIFO:=((m and S_IFMT) = S_IFIFO);
+ FPS_ISFIFO:=((m and S_IFMT) = S_IFIFO);
 end;
 end;
 
 
-Function FPISLNK(m:TMode):boolean;
+Function FPS_ISLNK(m:TMode):boolean;
 
 
 begin
 begin
- FPISLNK:=((m and S_IFMT) = S_IFLNK);
+ FPS_ISLNK:=((m and S_IFMT) = S_IFLNK);
 end;
 end;
 
 
-Function FPISSOCK(m:TMode):boolean;
+Function FPS_ISSOCK(m:TMode):boolean;
 
 
 begin
 begin
- FPISSOCK:=((m and S_IFMT) = S_IFSOCK);
+ FPS_ISSOCK:=((m and S_IFMT) = S_IFSOCK);
 end;
 end;
 
 
 function wifexited(status : cint): cint;
 function wifexited(status : cint): cint;
@@ -90,7 +90,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-09-17 11:52:05  marco
+  Revision 1.5  2003-09-27 13:04:58  peter
+    * fpISxxx renamed
+
+  Revision 1.4  2003/09/17 11:52:05  marco
    * stat macro fixes voor BSD
    * stat macro fixes voor BSD
 
 
   Revision 1.3  2003/09/14 20:15:01  marco
   Revision 1.3  2003/09/14 20:15:01  marco

+ 8 - 5
rtl/bsd/osmain.inc

@@ -172,7 +172,7 @@ Begin
      Errno2Inoutres;
      Errno2Inoutres;
      exit;
      exit;
    end;
    end;
-  if FpISDIR(fileinfo.st_mode) then
+  if FpS_ISDIR(fileinfo.st_mode) then
    begin
    begin
      InOutRes := 2;
      InOutRes := 2;
      exit;
      exit;
@@ -425,7 +425,7 @@ var
 begin
 begin
 {$ifdef usegetcwd}
 {$ifdef usegetcwd}
  Fpgetcwd(@tmp[1],255);
  Fpgetcwd(@tmp[1],255);
- dir:=tmp;		
+ dir:=tmp;
 {$else}
 {$else}
   dir:='';
   dir:='';
   thedir:='';
   thedir:='';
@@ -467,8 +467,8 @@ begin
        end
        end
       else
       else
        begin
        begin
-	 if (Errno<>ESysENOENT) then
-	  Exit;
+         if (Errno<>ESysENOENT) then
+          Exit;
        end;
        end;
     until (name<>'');
     until (name<>'');
     if Fpclosedir(dirstream)<0 then
     if Fpclosedir(dirstream)<0 then
@@ -613,7 +613,10 @@ End.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.2  2003-05-29 20:54:09  marco
+   Revision 1.3  2003-09-27 13:04:58  peter
+     * fpISxxx renamed
+
+   Revision 1.2  2003/05/29 20:54:09  marco
     * progname fix.
     * progname fix.
 
 
    Revision 1.1  2003/01/05 19:01:28  marco
    Revision 1.1  2003/01/05 19:01:28  marco

+ 36 - 32
rtl/bsd/ossysc.inc

@@ -114,7 +114,7 @@ end;
 {$endif}
 {$endif}
 
 
 {$ifdef netbsdmacppc}
 {$ifdef netbsdmacppc}
-{$i sysofft.inc}			// odd ball calling convention.
+{$i sysofft.inc}                        // odd ball calling convention.
 {$else}
 {$else}
   // generic versions.
   // generic versions.
 function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; [public, alias : 'FPC_SYSC_LSEEK'];
 function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; [public, alias : 'FPC_SYSC_LSEEK'];
@@ -477,12 +477,13 @@ begin
   Fpmunmap:=do_syscall(syscall_nr_munmap,TSysParam(start),Len);
   Fpmunmap:=do_syscall(syscall_nr_munmap,TSysParam(start),Len);
 end;
 end;
 
 
-Function sbrk(size : longint) : cint;
+Function sbrk(size : longint) : pointer;
 begin
 begin
-  sbrk:=longint(Fpmmap(0,Size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0)); // ugh
-  if sbrk<>(-1) then
-   errno:=0;
-  {! It must be -1, not 0 as before, see heap.inc. Should be in sysmmap?}
+  sbrk:=Fpmmap(0,Size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0);
+  if sbrk=pointer(-1) then
+    sbrk:=nil
+  else
+    errno:=0;
 end;
 end;
 
 
 {
 {
@@ -542,50 +543,50 @@ end;
 
 
 function Fpgetcwd(pt:pchar; _size:size_t):pchar;[public, alias :'FPC_SYSC_GETCWD'];
 function Fpgetcwd(pt:pchar; _size:size_t):pchar;[public, alias :'FPC_SYSC_GETCWD'];
 {$ifndef darwin}
 {$ifndef darwin}
-const intpathmax = 1024-4;	// didn't use POSIX data in libc
-				// implementation.
+const intpathmax = 1024-4;      // didn't use POSIX data in libc
+                                // implementation.
 var ept,bpt : pchar;
 var ept,bpt : pchar;
-    c	    : char;
-    ret	    : cint;
+    c       : char;
+    ret     : cint;
 
 
 begin
 begin
    if pt=NIL Then
    if pt=NIL Then
-    begin 
+    begin
       // POSIX: undefined. (exit(nil) ?)
       // POSIX: undefined. (exit(nil) ?)
       // BSD  : allocate mem for path.
       // BSD  : allocate mem for path.
-      getmem(pt,intpathmax); 
-      if pt=nil Then 
+      getmem(pt,intpathmax);
+      if pt=nil Then
         exit(nil);
         exit(nil);
       ept:=pt+intpathmax;
       ept:=pt+intpathmax;
-    end 
+    end
    else
    else
     Begin
     Begin
       if (_size=0) Then
       if (_size=0) Then
         Begin
         Begin
           seterrno(ESysEINVAL);
           seterrno(ESysEINVAL);
-	  exit(nil);
-        End; 
+          exit(nil);
+        End;
       if (_size=1) Then
       if (_size=1) Then
         Begin
         Begin
           seterrno(ESysERANGE);
           seterrno(ESysERANGE);
-	  exit(nil);
-        End; 
+          exit(nil);
+        End;
       ept:=pt+_size;
       ept:=pt+_size;
-    end; 
+    end;
 
 
     ret := do_syscall(syscall_nr___getcwd,TSysParam(pt),TSysParam( ept - pt));
     ret := do_syscall(syscall_nr___getcwd,TSysParam(pt),TSysParam( ept - pt));
-    If (ret = 0) Then 
-	If (pt[0] <> '/') Then
-	   Begin
-	     bpt := pt;
-	     ept := pt + strlen(pt) - 1;
-	     While (bpt < ept) Do
-	       Begin
-  		 c := bpt^;
- 		 bpt^:=ept^;
-		 inc(bpt);
-		 ept^:=c;
-		 dec(ept);		
+    If (ret = 0) Then
+        If (pt[0] <> '/') Then
+           Begin
+             bpt := pt;
+             ept := pt + strlen(pt) - 1;
+             While (bpt < ept) Do
+               Begin
+                 c := bpt^;
+                 bpt^:=ept^;
+                 inc(bpt);
+                 ept^:=c;
+                 dec(ept);
                End;
                End;
            End;
            End;
  Fpgetcwd:=pt;
  Fpgetcwd:=pt;
@@ -598,7 +599,10 @@ end;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.10  2003-09-20 12:38:29  marco
+ Revision 1.11  2003-09-27 13:04:58  peter
+   * fpISxxx renamed
+
+ Revision 1.10  2003/09/20 12:38:29  marco
   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
 
 
  Revision 1.9  2003/09/17 16:02:31  marco
  Revision 1.9  2003/09/17 16:02:31  marco

+ 18 - 0
rtl/bsd/unxsysc.inc

@@ -97,3 +97,21 @@ begin
 end;
 end;
 
 
 
 
+Function fpReadLink(Name:pathstr):pathstr;
+{
+  Read a link (where it points to)
+}
+var
+  LinkName : pathstr;
+  i : cint;
+begin
+  Name:=Name+#0;
+  i:=fpReadLink(@Name[1],@LinkName[1],high(linkname));
+  if i>0 then
+   begin
+     linkname[0]:=chr(i);
+     fpReadLink:=LinkName;
+   end
+  else
+   fpReadLink:='';
+end;

+ 1 - 0
rtl/bsd/unxsysch.inc

@@ -6,6 +6,7 @@ Function fpLstat(path:pchar;Info:pstat):cint;
 Function fpLstat(Filename: PathStr;Info:pstat):cint;
 Function fpLstat(Filename: PathStr;Info:pstat):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
+Function fpReadLink(name:PathStr):PathStr;
 Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
 Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
 Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
 Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
 function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
 function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';