소스 검색

* Pathstr eliminated

marco 21 년 전
부모
커밋
b903ce5a9a
7개의 변경된 파일61개의 추가작업 그리고 89개의 파일을 삭제
  1. 6 4
      rtl/bsd/unxsysc.inc
  2. 5 2
      rtl/bsd/unxsysch.inc
  3. 6 4
      rtl/linux/unxsysc.inc
  4. 5 2
      rtl/linux/unxsysch.inc
  5. 21 64
      rtl/unix/unix.pp
  6. 12 10
      rtl/unix/unxovl.inc
  7. 6 3
      rtl/unix/unxovlh.inc

+ 6 - 4
rtl/bsd/unxsysc.inc

@@ -91,14 +91,13 @@ begin
  fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
 end;
 
-Function fpLstat(Filename: PathStr;Info:pstat):cint;
+Function fpLstat(Filename: ansistring;Info:pstat):cint;
 {
   Get all information on a link (the link itself), and return it in info.
 }
 
 begin
- FileName:=FileName+#0;
- fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(@filename[1]),TSysParam(info));
+ fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
 end;
 
 Function fpSymlink(oldname,newname:pchar):cint;
@@ -118,7 +117,10 @@ end;
 
 {
    $Log$
-   Revision 1.6  2004-07-03 22:48:49  marco
+   Revision 1.7  2004-11-03 15:00:43  marco
+    * Pathstr eliminated
+
+   Revision 1.6  2004/07/03 22:48:49  marco
     * small fix for 1.0.x cycling
 
    Revision 1.5  2004/04/22 16:22:10  marco

+ 5 - 2
rtl/bsd/unxsysch.inc

@@ -17,7 +17,7 @@ function fpNice(N:cint):cint;
 Function fpGetPriority(Which,Who:cint):cint;
 Function fpSetPriority(Which,Who,What:cint):cint;
 Function fpLstat(path:pchar;Info:pstat):cint;
-Function fpLstat(Filename: PathStr;Info:pstat):cint;
+Function fpLstat(Filename: ansistring;Info:pstat):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
 Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
@@ -26,7 +26,10 @@ function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYS
 
 {
   $Log$
-  Revision 1.5  2004-01-01 17:07:21  marco
+  Revision 1.6  2004-11-03 15:00:43  marco
+   * Pathstr eliminated
+
+  Revision 1.5  2004/01/01 17:07:21  marco
    * few small freebsd fixes backported from debugging linux
 
   Revision 1.4  2003/12/30 12:26:21  marco

+ 6 - 4
rtl/linux/unxsysc.inc

@@ -95,14 +95,13 @@ begin
  fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
 end;
 
-Function fpLstat(Filename: PathStr;Info:pstat):cint;
+Function fpLstat(Filename: ansistring;Info:pstat):cint;
 {
   Get all information on a link (the link itself), and return it in info.
 }
 
 begin
- FileName:=FileName+#0;
- fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(@filename[1]),TSysParam(info));
+ fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
 end;
 
 Function fpSymlink(oldname,newname:pchar):cint;
@@ -116,7 +115,10 @@ end;
 
 {
  $Log$
- Revision 1.5  2004-04-22 17:17:23  peter
+ Revision 1.6  2004-11-03 15:00:43  marco
+  * Pathstr eliminated
+
+ Revision 1.5  2004/04/22 17:17:23  peter
    * x86-64 fixes
 
  Revision 1.4  2004/01/01 16:10:23  marco

+ 5 - 2
rtl/linux/unxsysch.inc

@@ -22,13 +22,16 @@ function fpNice(N:cint):cint;
 Function fpGetPriority(Which,Who:cint):cint;
 Function fpSetPriority(Which,Who,What:cint):cint;
 Function fpLstat(path:pchar;Info:pstat):cint;
-Function fpLstat(Filename: PathStr;Info:pstat):cint;
+Function fpLstat(Filename: ansistring;Info:pstat):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
 
 {
   $Log$
-  Revision 1.5  2004-01-01 16:10:23  marco
+  Revision 1.6  2004-11-03 15:00:43  marco
+   * Pathstr eliminated
+
+  Revision 1.5  2004/01/01 16:10:23  marco
    * fpreadlink(pathstr) moved to unxovl (since not platform specific),
   	small fixes for "make all OPT='-dFPC_USE_LIBC'
 

+ 21 - 64
rtl/unix/unix.pp

@@ -20,8 +20,8 @@ Uses BaseUnix,UnixType;
 
 {$i aliasptp.inc}
 
-type
-   pathstr = string[255];
+//type
+//   pathstr = string[255];
 
 {$define POSIXWORKAROUND}
 { Get Types and Constants }
@@ -40,8 +40,11 @@ type
 {$I signal.inc}
 {$i ostypes.inc}
 
+// We init to zero to be able to put timezone stuff under IFDEF, and still
+// keep the code working.
+
 var
-  Tzseconds : Longint;
+  Tzseconds : Longint {$ifndef ver1_0} = 0 {$endif};
 
 
 {********************
@@ -73,11 +76,15 @@ var
   tzdaylight : boolean;
   tzname     : array[boolean] of pchar;
 
+{$IFNDEF DONT_READ_TIMEZONE}  // allows to disable linking in and trying for platforms
+ 		       // it doesn't (yet) work for.
+
 { timezone support }
 procedure GetLocalTimezone(timer:cint;var leap_correct,leap_hit:cint);
 procedure GetLocalTimezone(timer:cint);
 procedure ReadTimezoneFile(fn:string);
 function  GetTimezoneFile:string;
+{$ENDIF}
 
 {**************************
      Process Handling
@@ -194,9 +201,6 @@ Type
 		           CurrentDirectoryFirst,
 	                   CurrentDirectoryLast);
 
-//Function  FExpand  (Const Path: PathStr):PathStr;
-//Function  FSearch  (const path:pathstr;dirlist:string):pathstr;
-
 Function  FSearch  (const path:AnsiString;dirlist:Ansistring;CurrentDirStrategy:TFSearchOption):AnsiString;
 Function  FSearch  (const path:AnsiString;dirlist:AnsiString):AnsiString;
 
@@ -564,9 +568,10 @@ begin
 end;
 
 
+{$IFNDEF DONT_READ_TIMEZONE}
 { Include timezone handling routines which use /usr/share/timezone info }
 {$i timezone.inc}
-
+{$endif}
 {******************************************************************************
                            FileSystem calls
 ******************************************************************************}
@@ -1169,60 +1174,6 @@ end;
                              Utility calls
 ******************************************************************************}
 
-{
-{$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
-{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
-
-{$I fexpand.inc}
-
-{$UNDEF FPC_FEXPAND_GETENVPCHAR}
-{$UNDEF FPC_FEXPAND_TILDE}
-
-{}
-Function FSearch(const path:pathstr;dirlist:string):pathstr;
-{
-  Searches for a file 'path' in the list of direcories in 'dirlist'.
-  returns an empty string if not found. Wildcards are NOT allowed.
-  If dirlist is empty, it is set to '.'
-}
-Var
-  NewDir : PathStr;
-  p1     : cint;
-  Info   : Stat;
-Begin
-{Replace ':' with ';'}
-  for p1:=1 to length(dirlist) do
-   if dirlist[p1]=':' then
-    dirlist[p1]:=';';
-{Check for WildCards}
-  If (Pos('?',Path) <> 0) or (Pos('*',Path) <> 0) Then
-   FSearch:='' {No wildcards allowed in these things.}
-  Else
-   Begin
-     Dirlist:='.;'+dirlist;{Make sure current dir is first to be searched.}
-     Repeat
-       p1:=Pos(';',DirList);
-       If p1=0 Then
-        p1:=255;
-       NewDir:=Copy(DirList,1,P1 - 1);
-       if NewDir[Length(NewDir)]<>'/' then
-        NewDir:=NewDir+'/';
-       NewDir:=NewDir+Path;
-       Delete(DirList,1,p1);
-       if (FpStat(NewDir,Info)>=0) and
-          (not fpS_ISDIR(Info.st_Mode)) then
-        Begin
-          If Pos('./',NewDir)=1 Then
-           Delete(NewDir,1,2);
-        {DOS strips off an initial .\}
-        End
-       Else
-        NewDir:='';
-     Until (DirList='') or (Length(NewDir) > 0);
-     FSearch:=NewDir;
-   End;
-End;
-}
 Function FSearch(const path:AnsiString;dirlist:Ansistring;CurrentDirStrategy:TFSearchOption):AnsiString;
 {
   Searches for a file 'path' in the list of direcories in 'dirlist'.
@@ -1234,7 +1185,7 @@ stringhandling overhead at the same time.
 
 }
 Var
-  NewDir : PathStr;
+  NewDir : ansistring;
   p1     : cint;
   Info   : Stat;
   i,j      : cint; 
@@ -1289,15 +1240,21 @@ End;
 --------------------------------}
 
 Initialization
+{$IFNDEF DONT_READ_TIMEZONE}
   InitLocalTime;
-
+{$endif}
 finalization
+{$IFNDEF DONT_READ_TIMEZONE}
   DoneLocalTime;
+{$endif}
 End.
 
 {
   $Log$
-  Revision 1.75  2004-10-30 20:55:54  marco
+  Revision 1.76  2004-11-03 15:00:43  marco
+   * Pathstr eliminated
+
+  Revision 1.75  2004/10/30 20:55:54  marco
    * unix interface cleanup
 
   Revision 1.74  2004/07/18 14:54:42  jonas

+ 12 - 10
rtl/unix/unxovl.inc

@@ -14,7 +14,7 @@
 
  **********************************************************************}
 
-Function StatFS(Path:Pathstr;Var Info:Tstatfs):cint;
+Function StatFS(Path:ansistring;Var Info:Tstatfs):cint;
 
 {
   Get all information on a fileSystem, and return it in Info.
@@ -23,32 +23,34 @@ Function StatFS(Path:Pathstr;Var Info:Tstatfs):cint;
 }
  
 begin
-  path:=path+#0;
-  statfs:=statfs(pchar(@path[1]),info);
+  statfs:=statfs(pchar(path),info);
 end;
 
-Function fpReadLink(Name:pathstr):pathstr;
+Function fpReadLink(Name:ansistring):ansistring;
 {
   Read a link (where it points to)
 }
 var
-  LinkName : pathstr;
+  LinkName : ansistring;
   i : cint;
 begin
-  Name:=Name+#0;
-  i:=fpReadLink(@Name[1],@LinkName[1],high(linkname));
+  SetLength(linkname,PATH_MAX);
+  i:=fpReadLink(pchar(name),pchar(linkname),PATH_MAX);
   if i>0 then
    begin
-     linkname[0]:=chr(i);
+     SetLength(linkname,i);
      fpReadLink:=LinkName;
    end
   else
-   fpReadLink:='';
+    fpReadLink:='';
 end;
 
 {
  $Log$
- Revision 1.2  2004-01-01 16:10:23  marco
+ Revision 1.3  2004-11-03 15:00:43  marco
+  * Pathstr eliminated
+
+ Revision 1.2  2004/01/01 16:10:23  marco
   * fpreadlink(pathstr) moved to unxovl (since not platform specific),
  	small fixes for "make all OPT='-dFPC_USE_LIBC'
 

+ 6 - 3
rtl/unix/unxovlh.inc

@@ -16,13 +16,16 @@
 
 Function PClose(Var F:file) : cint;
 Function PClose      (Var F:text) : cint;
-Function StatFS(Path:Pathstr;Var Info:Tstatfs):cint;
-Function fpReadLink(Name:pathstr):pathstr;
+Function StatFS(Path:ansistring;Var Info:Tstatfs):cint;
+Function fpReadLink(Name:ansistring):ansistring;
 
 
 {
    $Log$
-   Revision 1.2  2004-01-01 16:10:23  marco
+   Revision 1.3  2004-11-03 15:00:43  marco
+    * Pathstr eliminated
+
+   Revision 1.2  2004/01/01 16:10:23  marco
     * fpreadlink(pathstr) moved to unxovl (since not platform specific),
    	small fixes for "make all OPT='-dFPC_USE_LIBC'