瀏覽代碼

Fixed compilation of the Symobi RTL (a 'Hello World' now runs ^^).

* rtl/symobi/sysos*.inc
   - include oscdeclh.inc in sysosh.inc, because otherwise the "external" declaration will trigger an error
   - thus the constant "clib", the include of "ostypes.inc" and the import of "malloc" and "free" needs to be moved there as well
* rtl/symobi/cwstring.pp
   - used an incorrect constant ("libc" instead of "clib")
   - I had replaced the wrong function
   - also a define wasn't terminated correctly
* rtl/symobi/unix.pp
   I had disabled the definiton of "GetDomainName", but not the declaration
* rtl/unix/oscdeclh.inc
   Added a define so that the "forward" modifiers are disabled in the System unit for Symobi
* rtl/symobi/Makefile.fpc
   Don't use GPM on Symobi (mouse support isn't even working at all, but that is a different story)

git-svn-id: branches/svenbarth/symobi@18065 -
svenbarth 14 年之前
父節點
當前提交
aca211ca25
共有 6 個文件被更改,包括 37 次插入29 次删除
  1. 1 4
      rtl/symobi/Makefile.fpc
  2. 6 8
      rtl/symobi/sysos.inc
  3. 10 0
      rtl/symobi/sysosh.inc
  4. 8 13
      rtl/unix/cwstring.pp
  5. 10 4
      rtl/unix/oscdeclh.inc
  6. 2 0
      rtl/unix/unix.pp

+ 1 - 4
rtl/symobi/Makefile.fpc

@@ -78,7 +78,7 @@ override FPCOPT+=-Ur
 endif
 
 # Symobi requires usage of the C library, no syscalls
-override FPCOPT+=-dFPC_USE_LIBC -dDONT_READ_TIMEZONE
+override FPCOPT+=-dFPC_USE_LIBC -dDONT_READ_TIMEZONE -dNOGPM
 
 # Paths
 OBJPASDIR=$(RTL)/objpas
@@ -128,7 +128,6 @@ unixtype$(PPUEXT): $(UNIXINC)/unixtype.pp $(UNIXINC)/ctypes.inc ptypes.inc $(SYS
 
 baseunix$(PPUEXT) : errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
   signal.inc $(UNIXINC)/bunxh.inc \
-  bunxsysc.inc \
   ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
@@ -137,8 +136,6 @@ unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/fi
                  unxconst.inc $(UNIXINC)/timezone.inc \
                  unxfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
-linux$(PPUEXT) : baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
-
 #
 # TP7 Compatible RTL Units
 #

+ 6 - 8
rtl/symobi/sysos.inc

@@ -21,12 +21,12 @@ var
   operatingsystem_parameter_argc: ptruint; public name 'operatingsystem_parameter_argc';
   operatingsystem_parameter_argv: ppchar; public name 'operatingsystem_parameter_argv';
 
-const clib = 'c';
+//const clib = 'c';
 
 type libcint=longint;
      plibcint=^libcint;
 
-function geterrnolocation: Plibcint; cdecl;external stdclib name 'getThdErrno';
+function geterrnolocation: Plibcint; cdecl;external clib name 'getThdErrno';
 
 function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
 
@@ -42,16 +42,14 @@ end;
 { OS dependant parts  }
 
 {$I errno.inc}                          // error numbers
-{$I ostypes.inc}                        // c-types, unix base types, unix base structures
+// these are needed by oscdeclh.inc
+//{$I ostypes.inc}                        // c-types, unix base types, unix base structures
 {$I osmacro.inc}
 
-{$i oscdeclh.inc}
+// because of "external" the C functions need to be imported in sysos.h
+{.$i oscdeclh.inc}
 {$i oscdecl.inc}
 
-// used in sysheap.inc
-function FpMalloc(size: size_t): pointer; cdecl; external clib name 'malloc';
-procedure FpFree(p: pointer); cdecl; external clib name 'free';
-
 
 {*****************************************************************************
                             Error conversion

+ 10 - 0
rtl/symobi/sysosh.inc

@@ -25,6 +25,16 @@ type
   { pthread_mutex_t }
   PRTLCriticalSection = ^TRTLCriticalSection;
   TRTLCriticalSection = pointer;
+  
+const clib = 'c';
+
+{$i ostypes.inc}
+
+// because of "external" these functions need to be imported in the inteface part
+{$i oscdeclh.inc}
 
+// used in sysheap.inc
+function FpMalloc(size: size_t): pointer; cdecl; external clib name 'malloc';
+procedure FpFree(p: pointer); cdecl; external clib name 'free';
 
 

+ 8 - 13
rtl/unix/cwstring.pp

@@ -29,7 +29,7 @@ implementation
 {$endif}
 
 {$if not defined(linux) and not defined(solaris)}  // Linux (and maybe glibc platforms in general), have iconv in glibc.
- {$if not defined(symobi}
+ {$if not defined(symobi)}
    {$if defined(haiku)}
      {$linklib textencoding}
      {$linklib locale}
@@ -162,7 +162,7 @@ type
     {$ifndef symobi}
       function nl_langinfo(__item:nl_item):pchar;cdecl;external libiconvname name 'nl_langinfo';
 	{$else}
-      function nl_langinfo(__item:nl_item):pchar;cdecl;external libc name 'nl_langinfo';
+      function nl_langinfo(__item:nl_item):pchar;cdecl;external clib name 'nl_langinfo';
 	{$endif}
   {$endif}
 {$endif}
@@ -565,17 +565,6 @@ function WideStringToUCS4StringNoNulls(const s : WideString) : UCS4String;
 
 
 function CompareWideString(const s1, s2 : WideString) : PtrInt;
-  var
-    hs1,hs2 : UCS4String;
-  begin
-    { wcscoll interprets null chars as end-of-string -> filter out }
-    hs1:=WideStringToUCS4StringNoNulls(s1);
-    hs2:=WideStringToUCS4StringNoNulls(s2);
-    result:=wcscoll(pwchar_t(hs1),pwchar_t(hs2));
-  end;
-
-
-function CompareTextWideString(const s1, s2 : WideString): PtrInt;
 {$ifdef symobi}
   // Symobi doesn't currently define wcscoll(), so we do a simple comparison
   // taken from GenericAnsiCompareStr in objpas/sysutils/sysstr.inc
@@ -606,6 +595,12 @@ function CompareTextWideString(const s1, s2 : WideString): PtrInt;
 {$endif}
 
 
+function CompareTextWideString(const s1, s2 : WideString): PtrInt;
+  begin
+    result:=CompareWideString(UpperWideString(s1),UpperWideString(s2));
+  end;
+
+
 function CharLengthPChar(const Str: PChar): PtrInt;
   var
     nextlen: ptrint;

+ 10 - 4
rtl/unix/oscdeclh.inc

@@ -19,6 +19,12 @@
 {   var
      Errno : cint; external clib name 'errno';}
 
+{$if defined(FPC_IS_SYSTEM) and not defined(SYMOBI)}
+  // for Symobi this file is included in the interface section of the system unit,
+  // so we must not use "forward"
+  {$define USE_FORWARD}
+{$endif}	 
+	 
 Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
      pGrpArr = ^TGrpArr;
      TFilDes = Array [0..1] of cInt;
@@ -87,7 +93,7 @@ const
     function  fpmunmap  (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
     { The libc version has "..." as third parameter -> wrap for }
     { interface compatibility with syscalls                     }
-    function  FpIOCtl   (Handle:cint;Ndx: TIOCtlRequest;Data: Pointer):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
+    function  FpIOCtl   (Handle:cint;Ndx: TIOCtlRequest;Data: Pointer):cint; {$ifdef USE_FORWARD}forward;{$endif}
 {$ifdef beos}
   {$ifdef haiku}
     Function  FPSelect  (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external 'network' name 'select';  
@@ -116,9 +122,9 @@ const
     Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
     { The libc version has "..." as third parameter -> wrap for }
     { interface compatibility with syscalls                     }
-    Function  FpFcntl      (fildes : cInt; cmd : cInt): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
-    Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
-    Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
+    Function  FpFcntl      (fildes : cInt; cmd : cInt): cInt; {$ifdef USE_FORWARD}forward;{$endif}
+    Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; {$ifdef USE_FORWARD}forward;{$endif}
+    Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; {$ifdef USE_FORWARD}forward;{$endif}
     Function  FpAlarm      (seconds : cuint) : cuint; cdecl;external clib name 'alarm';
     Function  FpPause   : cInt; cdecl; external clib name 'pause';
     Function  FpMkfifo     (path: pchar; mode: tmode): cint; cdecl; external clib name 'mkfifo';

+ 2 - 0
rtl/unix/unix.pp

@@ -121,7 +121,9 @@ Function POpen       (var F:text;const Prog:Ansistring;rw:char):cint;
 Function POpen       (var F:file;const Prog:Ansistring;rw:char):cint;
 Function AssignStream(Var StreamIn,Streamout:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function AssignStream(Var StreamIn,Streamout,streamerr:text;Const Prog:ansiString;const args : array of ansistring) : cint;
+{$ifndef symobi}
 Function  GetDomainName:String; deprecated; // because linux only.
+{$endif}
 Function  GetHostName:String;
 
 {** Utility functions  **}