Browse Source

* initial Objective-C 1.0 support:
o support for declaring external Objective-C classes (see
rtl/inc/objcbase.pas), including derived classes
o support for converting methods of objcclasses into selectors
(see tests/test/tobjc1.pp)
o support for loading from/storing to fields of objcclasses
o support for calling Objective-C methods using regular
Object Pascal syntax (see tests/test/tobjc1.pp)
o some things that are known to be not yet working:
o automatic conversion from ID to objcclasses and back
o declaring and implementing new objcclasses/methods in Pascal code
o debug information (objcclasses are currently plain pointers
as far as the debugger knows)

git-svn-id: branches/objc@13162 -

Jonas Maebe 16 năm trước cách đây
mục cha
commit
b1b9894ae3

+ 4 - 1
.gitattributes

@@ -304,6 +304,8 @@ compiler/nopt.pas svneol=native#text/plain
 compiler/nset.pas svneol=native#text/plain
 compiler/nset.pas svneol=native#text/plain
 compiler/nstate.pas svneol=native#text/plain
 compiler/nstate.pas svneol=native#text/plain
 compiler/nutils.pas svneol=native#text/plain
 compiler/nutils.pas svneol=native#text/plain
+compiler/objcgutl.pas svneol=native#text/plain
+compiler/objcutil.pas svneol=native#text/plain
 compiler/ogbase.pas svneol=native#text/plain
 compiler/ogbase.pas svneol=native#text/plain
 compiler/ogcoff.pas svneol=native#text/plain
 compiler/ogcoff.pas svneol=native#text/plain
 compiler/ogelf.pas svneol=native#text/plain
 compiler/ogelf.pas svneol=native#text/plain
@@ -5479,7 +5481,7 @@ rtl/inc/mouse.inc svneol=native#text/plain
 rtl/inc/mouseh.inc svneol=native#text/plain
 rtl/inc/mouseh.inc svneol=native#text/plain
 rtl/inc/mvecimp.inc svneol=native#text/plain
 rtl/inc/mvecimp.inc svneol=native#text/plain
 rtl/inc/objc1.pp svneol=native#text/plain
 rtl/inc/objc1.pp svneol=native#text/plain
-rtl/inc/objc1h.inc svneol=native#text/plain
+rtl/inc/objcbase.pp svneol=native#text/plain
 rtl/inc/objects.pp svneol=native#text/plain
 rtl/inc/objects.pp svneol=native#text/plain
 rtl/inc/objpas.inc svneol=native#text/plain
 rtl/inc/objpas.inc svneol=native#text/plain
 rtl/inc/objpash.inc svneol=native#text/plain
 rtl/inc/objpash.inc svneol=native#text/plain
@@ -7913,6 +7915,7 @@ tests/test/tmsg2.pp svneol=native#text/plain
 tests/test/tmsg3.pp svneol=native#text/plain
 tests/test/tmsg3.pp svneol=native#text/plain
 tests/test/tmsg4.pp svneol=native#text/plain
 tests/test/tmsg4.pp svneol=native#text/plain
 tests/test/tmt1.pp svneol=native#text/plain
 tests/test/tmt1.pp svneol=native#text/plain
+tests/test/tobjc1.pp svneol=native#text/plain
 tests/test/tobject1.pp svneol=native#text/plain
 tests/test/tobject1.pp svneol=native#text/plain
 tests/test/tobject2.pp svneol=native#text/plain
 tests/test/tobject2.pp svneol=native#text/plain
 tests/test/tobject3.pp svneol=native#text/plain
 tests/test/tobject3.pp svneol=native#text/plain

+ 2 - 1
compiler/aasmdata.pas

@@ -79,7 +79,8 @@ interface
          sp_ansistr,
          sp_ansistr,
          sp_widestr,
          sp_widestr,
          sp_unicodestr,
          sp_unicodestr,
-         sp_objcselector
+         sp_objcselector,
+         sp_objcmetaclass
       );
       );
       
       
     const
     const

+ 7 - 0
compiler/dbgdwarf.pas

@@ -3014,6 +3014,13 @@ implementation
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
               doappend;
               doappend;
             end;
             end;
+          odt_objcclass:
+            begin
+              // Objective-C class: plain pointer for now
+              append_entry(DW_TAG_pointer_type,false,[]);
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(voidpointertype));
+              finish_entry;
+            end;
           else
           else
             internalerror(200602041);
             internalerror(200602041);
         end;
         end;

+ 23 - 1
compiler/msg/errore.msg

@@ -366,7 +366,7 @@ scan_w_multiple_main_name_overrides=02086_W_Overriding name of "main" procedure
 #
 #
 # Parser
 # Parser
 #
 #
-# 03250 is the last used one
+# 03252 is the last used one
 #
 #
 % \section{Parser messages}
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
 % This section lists all parser messages. The parser takes care of the
@@ -1176,7 +1176,24 @@ parser_n_ignore_lower_visibility=03250_N_Virtual method "$1" has a lower visibil
 % The virtual method overrides an method that is declared with a higher visibility. This might give
 % The virtual method overrides an method that is declared with a higher visibility. This might give
 % unexpected results. In case the new visibility is private than it might be that a call to inherited in a
 % unexpected results. In case the new visibility is private than it might be that a call to inherited in a
 % new child class will call the higher visible method in a parent class and ignores the private method.
 % new child class will call the higher visible method in a parent class and ignores the private method.
+parser_e_objc_requires_msgstr=03251_E_Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
+% Objective-C messages require their Objective-C name (selector name) to be specified using the \var{message `someName:'} procedure directive.
+% While bindings to other languages automatically generate such names based on the identifier you use (by replacing
+% all underscores with colons), this is unsafe since nothing prevents an Objective-C method name to contain actual
+% colons.
+parser_e_objc_no_constructor_destructor=03252_E_Objective-C does not have formal constructors or destructors. Use initXXX and the dealloc instance methods.
+% The Objective-C language does not have any constructors or destructors. While there are some messages with a similar
+% purpose (such as \var{init} and \var{dealloc}), these cannot be identified using automatic parsers and do not
+% guarantee anything like Pascal constructors/destructors (e.g., you have to take care of only calling ``designated''
+% inherited ``constructors''). For these reasons, we have opted to follow the standard Objective-C patterns for
+% instance creation/destruction.
+parser_e_message_string_too_long=03253_E_Message name is too long (max. 255 characters)
+% Due to compiler implementation reasons, message names are currently limited to 255 characters.
+parser_e_objc_message_name_too_long=03254_E_Objective-C message symbol name for "$1" is too long
+% Due to compiler implementation reasons, mangled message names (i.e., the symbol names used in the assembler
+% code) are currently limited to 255 characters.
 % \end{description}
 % \end{description}
+
 #
 #
 # Type Checking
 # Type Checking
 #
 #
@@ -1785,6 +1802,11 @@ cg_e_goto_label_not_found=06049_E_Goto label "$1" not defined or optimized away
 % The label used in the goto definition is not defined or optimized away by the
 % The label used in the goto definition is not defined or optimized away by the
 % unreachable code elemination.
 % unreachable code elemination.
 % \end{description}
 % \end{description}
+cg_f_unknown_type_in_unit=06050_F_Cannot find type "$1" in unit "$2". Check if you use the correct run time library.
+% The compiler expects that the runtime library contains certain type definitions. If you see this error
+% and you didn't change the runtime library code, it's very likely that the runtime library
+% you're using doesn't match the compiler in use. If you changed the runtime library this error means
+% that you removed a type which the compiler needs for internal use.
 # EndOfTeX
 # EndOfTeX
 
 
 #
 #

+ 7 - 2
compiler/msgidx.inc

@@ -338,6 +338,10 @@ const
   parser_e_weak_external_not_supported=03248;
   parser_e_weak_external_not_supported=03248;
   parser_e_forward_mismatch=03249;
   parser_e_forward_mismatch=03249;
   parser_n_ignore_lower_visibility=03250;
   parser_n_ignore_lower_visibility=03250;
+  parser_e_objc_requires_msgstr=03251;
+  parser_e_objc_no_constructor_destructor=03252;
+  parser_e_message_string_too_long=03253;
+  parser_e_objc_message_name_too_long=03254;
   type_e_mismatch=04000;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
   type_e_not_equal_types=04002;
@@ -494,6 +498,7 @@ const
   cg_f_unknown_system_type=06047;
   cg_f_unknown_system_type=06047;
   cg_h_inherited_ignored=06048;
   cg_h_inherited_ignored=06048;
   cg_e_goto_label_not_found=06049;
   cg_e_goto_label_not_found=06049;
+  cg_f_unknown_type_in_unit=06050;
   asmr_d_start_reading=07000;
   asmr_d_start_reading=07000;
   asmr_d_finish_reading=07001;
   asmr_d_finish_reading=07001;
   asmr_e_none_label_contain_at=07002;
   asmr_e_none_label_contain_at=07002;
@@ -787,9 +792,9 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 51070;
+  MsgTxtSize = 51509;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
-    24,87,251,88,65,50,108,22,202,62,
+    24,87,255,88,65,51,108,22,202,62,
     47,20,1,1,1,1,1,1,1,1
     47,20,1,1,1,1,1,1,1,1
   );
   );

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 275 - 269
compiler/msgtxt.inc


+ 40 - 2
compiler/ncal.pas

@@ -118,7 +118,9 @@ interface
           constructor create(l:tnode; v : tprocsym;st : TSymtable; mp: tnode; callflags:tcallnodeflags);virtual;
           constructor create(l:tnode; v : tprocsym;st : TSymtable; mp: tnode; callflags:tcallnodeflags);virtual;
           constructor create_procvar(l,r:tnode);
           constructor create_procvar(l,r:tnode);
           constructor createintern(const name: string; params: tnode);
           constructor createintern(const name: string; params: tnode);
+          constructor createinternfromunit(const unitname, procname: string; params: tnode);
           constructor createinternres(const name: string; params: tnode; res:tdef);
           constructor createinternres(const name: string; params: tnode; res:tdef);
+          constructor createinternresfromunit(const unitname, procname: string; params: tnode; res:tdef);
           constructor createinternreturn(const name: string; params: tnode; returnnode : tnode);
           constructor createinternreturn(const name: string; params: tnode; returnnode : tnode);
           destructor destroy;override;
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
@@ -206,7 +208,7 @@ implementation
       verbose,globals,
       verbose,globals,
       symconst,defutil,defcmp,
       symconst,defutil,defcmp,
       htypechk,pass_1,
       htypechk,pass_1,
-      ncnv,nld,ninl,nadd,ncon,nmem,nset,
+      ncnv,nld,ninl,nadd,ncon,nmem,nset,nobjc,
       procinfo,cpuinfo,
       procinfo,cpuinfo,
       cgbase,
       cgbase,
       wpobase
       wpobase
@@ -934,12 +936,40 @@ implementation
        end;
        end;
 
 
 
 
+     constructor tcallnode.createinternfromunit(const unitname, procname: string; params: tnode);
+       var
+         srsym: tsym;
+         srsymtable: tsymtable;
+       begin
+         if not searchsym_in_named_module(unitname,procname,srsym,srsymtable) or
+            (srsym.typ<>procsym) then
+           Message1(cg_f_unknown_compilerproc,unitname+'.'+procname);
+         create(params,tprocsym(srsym),srsymtable,nil,[]);
+       end;
+
+
     constructor tcallnode.createinternres(const name: string; params: tnode; res:tdef);
     constructor tcallnode.createinternres(const name: string; params: tnode; res:tdef);
       var
       var
         pd : tprocdef;
         pd : tprocdef;
       begin
       begin
         createintern(name,params);
         createintern(name,params);
-        typedef := res;
+        typedef:=res;
+        include(callnodeflags,cnf_typedefset);
+        pd:=tprocdef(symtableprocentry.ProcdefList[0]);
+        { both the normal and specified resultdef either have to be returned via a }
+        { parameter or not, but no mixing (JM)                                      }
+        if paramanager.ret_in_param(typedef,pd.proccalloption) xor
+          paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
+          internalerror(200108291);
+      end;
+
+
+    constructor tcallnode.createinternresfromunit(const unitname, procname: string; params: tnode; res:tdef);
+      var
+        pd : tprocdef;
+      begin
+        createinternfromunit(unitname,procname,params);
+        typedef:=res;
         include(callnodeflags,cnf_typedefset);
         include(callnodeflags,cnf_typedefset);
         pd:=tprocdef(symtableprocentry.ProcdefList[0]);
         pd:=tprocdef(symtableprocentry.ProcdefList[0]);
         { both the normal and specified resultdef either have to be returned via a }
         { both the normal and specified resultdef either have to be returned via a }
@@ -2811,6 +2841,14 @@ implementation
       begin
       begin
          result:=nil;
          result:=nil;
 
 
+         { convert Objective-C calls into a message call }
+         if (procdefinition.typ=procdef) and
+            (po_objc in tprocdef(procdefinition).procoptions) then
+           begin
+             result:=cobjcmessagesendnode.create(self.getcopy);
+             exit;
+           end;
+
          { Check if the call can be inlined, sets the cnf_do_inline flag }
          { Check if the call can be inlined, sets the cnf_do_inline flag }
          check_inlining;
          check_inlining;
 
 

+ 27 - 8
compiler/ncgmem.pas

@@ -79,13 +79,13 @@ implementation
 
 
     uses
     uses
       systems,
       systems,
-      cutils,verbose,globals,constexp,
+      cutils,cclasses,verbose,globals,constexp,
       symconst,symdef,symsym,symtable,defutil,paramgr,
       symconst,symdef,symsym,symtable,defutil,paramgr,
       aasmbase,aasmtai,aasmdata,
       aasmbase,aasmtai,aasmdata,
       procinfo,pass_2,parabase,
       procinfo,pass_2,parabase,
       pass_1,nld,ncon,nadd,nutils,
       pass_1,nld,ncon,nadd,nutils,
       cgutils,cgobj,
       cgutils,cgobj,
-      tgobj,ncgutil
+      tgobj,ncgutil,objcgutl
       ;
       ;
 
 
 
 
@@ -95,17 +95,35 @@ implementation
 
 
     procedure tcgloadvmtaddrnode.pass_generate_code;
     procedure tcgloadvmtaddrnode.pass_generate_code;
       var
       var
-       href : treference;
+        href    : treference;
+        pool    : THashSet;
+        entry   : PHashSetItem;
+        typename: string;
 
 
       begin
       begin
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location_reset(location,LOC_REGISTER,OS_ADDR);
          if (left.nodetype=typen) then
          if (left.nodetype=typen) then
            begin
            begin
-             reference_reset_symbol(href,
-               current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname),0,
-               sizeof(pint));
              location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
              location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-             cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
+             if not is_objcclass(left.resultdef) then
+               begin
+                 reference_reset_symbol(href,
+                   current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname),0,
+                   sizeof(pint));
+                 cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
+               end
+             else
+               begin
+                 { find/add necessary classref/classname pool entries }
+                 if current_asmdata.ConstPools[sp_objcmetaclass]=nil then
+                   current_asmdata.ConstPools[sp_objcmetaclass]:=THashSet.Create(64, True, False);
+                 pool:=current_asmdata.ConstPools[sp_objcmetaclass];
+                 typename:=left.resultdef.gettypename;
+                 entry:=pool.FindOrAdd(@typename[1],length(typename));
+                 objcfinishstringrefpoolentry(entry,sec_objc_cls_refs,sec_objc_class_names);
+                 reference_reset_symbol(href,tasmlabel(entry^.Data),0,sizeof(pint));
+                 cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,location.register);
+               end;
            end
            end
          else
          else
            begin
            begin
@@ -256,7 +274,8 @@ implementation
            exit;
            exit;
          paraloc1.init;
          paraloc1.init;
          { classes and interfaces must be dereferenced implicit }
          { classes and interfaces must be dereferenced implicit }
-         if is_class_or_interface(left.resultdef) then
+         if is_class_or_interface(left.resultdef) or
+            is_objcclass(left.resultdef) then
            begin
            begin
              { the contents of a class are aligned to a sizeof(pointer) }
              { the contents of a class are aligned to a sizeof(pointer) }
              location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),sizeof(pint));
              location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),sizeof(pint));

+ 16 - 32
compiler/ncgobjc.pas

@@ -39,8 +39,8 @@ implementation
 uses
 uses
     globtype,cclasses,
     globtype,cclasses,
     aasmbase,aasmdata,aasmtai,
     aasmbase,aasmdata,aasmtai,
-    cgbase,cgutils,defutil,
-    symsym,
+    cgbase,cgutils,defutil,objcgutl,
+    symconst,symsym,symdef,
     node,nld,ncon,
     node,nld,ncon,
     verbose;
     verbose;
 
 
@@ -54,50 +54,34 @@ procedure tcgobjcselectornode.pass_generate_code;
     strlab : tasmlabel;
     strlab : tasmlabel;
     pool   : THashSet;
     pool   : THashSet;
     entry  : PHashSetItem;
     entry  : PHashSetItem;
-    name   : string;
+    name   : pshortstring;
     pc     : pchar;
     pc     : pchar;
   begin
   begin
-    if current_asmdata.ConstPools[sp_objcselector] = nil then
-      current_asmdata.ConstPools[sp_objcselector] := THashSet.Create(64, True, False);
-    pool := current_asmdata.ConstPools[sp_objcselector];
+    if current_asmdata.ConstPools[sp_objcselector]=nil then
+      current_asmdata.ConstPools[sp_objcselector]:=THashSet.Create(64, True, False);
+    pool:=current_asmdata.ConstPools[sp_objcselector];
 
 
     case left.nodetype of
     case left.nodetype of
       loadn:
       loadn:
         begin
         begin
-          name:=tprocsym(tloadnode(left).symtableentry).mangledname;
-          entry := pool.FindOrAdd(@name[1],length(name))
+          if (tloadnode(left).symtableentry.typ<>procsym) then
+            internalerror(2009051602);
+          if (tprocsym(tloadnode(left).symtableentry).procdeflist.count<>1) then
+            internalerror(2009051701);
+          name:=tprocdef(tprocsym(tloadnode(left).symtableentry).procdeflist[0]).messageinf.str;
+          entry:=pool.FindOrAdd(@name^[1],length(name^))
         end;
         end;
       stringconstn:
       stringconstn:
         begin
         begin
-          entry := pool.FindOrAdd(tstringconstnode(left).value_str, tstringconstnode(left).len);
+          entry:=pool.FindOrAdd(tstringconstnode(left).value_str,tstringconstnode(left).len);
         end;
         end;
       else
       else
         internalerror(2009030701);
         internalerror(2009030701);
     end;
     end;
 
 
-    { have we already generated this selector? }
-    if not assigned(entry^.Data) then
-      begin
-        { create new one
-          (no getdatalabel, because these labels have to be local)
-        }
-        current_asmdata.getlabel(reflab,alt_data);
-        current_asmdata.getlabel(strlab,alt_data);
-        entry^.Data := reflab;
-        getmem(pc,entry^.keylength+1);
-        move(entry^.key^,pc^,entry^.keylength);
-        pc[entry^.keylength]:=#0;
-        { add a pointer to the message name in the objc_message_refs section }
-        new_section(current_asmdata.asmlists[al_objc_data],sec_objc_message_refs,reflab.name,sizeof(pint));
-        current_asmdata.asmlists[al_objc_data].concat(Tai_label.Create(reflab));
-        current_asmdata.asmlists[al_objc_data].concat(Tai_const.Create_sym(strlab));
-
-        { and now add the message name to the meth_var_names }
-        new_section(current_asmdata.asmlists[al_objc_data],sec_objc_meth_var_names,strlab.name,1);
-        current_asmdata.asmlists[al_objc_data].concat(Tai_label.Create(strlab));
-        current_asmdata.asmlists[al_objc_data].concat(Tai_string.Create_pchar(pc,entry^.keylength+1));
-    end;
-    location_reset_ref(location, LOC_CREFERENCE, def_cgsize(resultdef), sizeof(pint));
+    objcfinishstringrefpoolentry(entry,sec_objc_message_refs,sec_objc_meth_var_names);
+
+    location_reset_ref(location,LOC_CREFERENCE,def_cgsize(resultdef),sizeof(pint));
     location.reference.symbol:=tasmlabel(entry^.Data);
     location.reference.symbol:=tasmlabel(entry^.Data);
   end;
   end;
 
 

+ 3 - 0
compiler/ncgutil.pas

@@ -2833,6 +2833,9 @@ implementation
             end;
             end;
           end
           end
         else
         else
+          { This is also valid for Objective-C classes: vmt_offset is 0 there,
+            and the first "field" of an Objective-C class instance is a pointer
+            to its "meta-class".  }
           begin
           begin
             case selfloc.loc of
             case selfloc.loc of
               LOC_REGISTER:
               LOC_REGISTER:

+ 13 - 9
compiler/nmem.pas

@@ -172,16 +172,20 @@ implementation
          expectloc:=LOC_REGISTER;
          expectloc:=LOC_REGISTER;
          if left.nodetype<>typen then
          if left.nodetype<>typen then
            firstpass(left)
            firstpass(left)
-         else if not assigned(current_procinfo) or
-             (po_inline in current_procinfo.procdef.procoptions) or
-             wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then
+         else if not is_objcclass(left.resultdef) and
+                 not is_objcclassref(left.resultdef) then
            begin
            begin
-             { keep track of which classes might be instantiated via a classrefdef }
-             if (left.resultdef.typ=classrefdef) then
-               tobjectdef(tclassrefdef(left.resultdef).pointeddef).register_maybe_created_object_type
-             else if (left.resultdef.typ=objectdef) then
-               tobjectdef(left.resultdef).register_maybe_created_object_type
-           end
+             if not assigned(current_procinfo) or
+               (po_inline in current_procinfo.procdef.procoptions) or
+               wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then
+             begin
+               { keep track of which classes might be instantiated via a classrefdef }
+               if (left.resultdef.typ=classrefdef) then
+                 tobjectdef(tclassrefdef(left.resultdef).pointeddef).register_maybe_created_object_type
+               else if (left.resultdef.typ=objectdef) then
+                 tobjectdef(left.resultdef).register_maybe_created_object_type
+             end
+           end;
       end;
       end;
 
 
 
 

+ 169 - 4
compiler/nobjc.pas

@@ -42,17 +42,30 @@ type
   end;
   end;
   tobjcselectornodeclass = class of tobjcselectornode;
   tobjcselectornodeclass = class of tobjcselectornode;
 
 
+  tobjcmessagesendnode = class(tunarynode)
+   public
+    constructor create(forcall: tnode);
+    function pass_typecheck: tnode;override;
+    function pass_1: tnode;override;
+  end;
+  tobjcmessagesendnodeclass = class of tobjcmessagesendnode;
+
 var
 var
   cobjcselectornode : tobjcselectornodeclass;
   cobjcselectornode : tobjcselectornodeclass;
+  cobjcmessagesendnode : tobjcmessagesendnodeclass;
 
 
 implementation
 implementation
 
 
 uses
 uses
   sysutils,
   sysutils,
-  cclasses,
+  globtype,cclasses,
   verbose,pass_1,
   verbose,pass_1,
-  defutil,symtable,symdef,symconst,
-  ncnv,ncon,ncal,nmem;
+  defutil,
+  symtype,symtable,symdef,symconst,symsym,
+  paramgr,
+  nbas,nld,ncnv,ncon,ncal,nmem,
+  objcutil,
+  cgbase;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -140,14 +153,166 @@ function tobjcselectornode.pass_typecheck: tnode;
       else
       else
         CGMessage(type_e_expected_objc_method);
         CGMessage(type_e_expected_objc_method);
     end;
     end;
-    resultdef:=search_system_type('SEL').typedef;
+    resultdef:=objc_seltype;
   end;
   end;
 
 
 
 
 function tobjcselectornode.pass_1: tnode;
 function tobjcselectornode.pass_1: tnode;
   begin
   begin
     result:=nil;
     result:=nil;
+    expectloc:=LOC_CREFERENCE;
+  end;
+
+{*****************************************************************************
+                          TOBJCMESSAGESENDNODE
+*****************************************************************************}
+
+constructor tobjcmessagesendnode.create(forcall: tnode);
+  begin
+    if (forcall.nodetype<>calln) then
+      internalerror(2009032502);
+    { typecheck pass (and pass1) must already have run on the call node,
+      because pass1 of the callnode creates this node
+    }
+    inherited create(objcmessagesendn,forcall);
+  end;
+
+
+function tobjcmessagesendnode.pass_typecheck: tnode;
+  begin
+    { typecheckpass of left has already run, see constructor }
+    resultdef:=left.resultdef;
+    result:=nil;
+    expectloc:=left.expectloc;
   end;
   end;
 
 
+
+function tobjcmessagesendnode.pass_1: tnode;
+  var
+    msgsendname: string;
+    newparas,
+    lastpara: tcallparanode;
+    block: tblocknode;
+    statements: tstatementnode;
+    temp: ttempcreatenode;
+    objcsupertype: tdef;
+    field: tfieldvarsym;
+  begin
+    { pass1 of left has already run, see constructor }
+
+    { default behaviour: call objc_msgSend and friends;
+      ppc64 and x86_64 for Mac OS X have to override this as they
+      call messages via an indirect function call similar to
+      dynamically linked functions, ARM maybe as well (not checked)
+
+      Which variant of objc_msgSend is used depends on the
+      result type, and on whether or not it's an inherited call.
+    }
+
+    { record returned via implicit pointer }
+    if paramanager.ret_in_param(left.resultdef,tcallnode(left).procdefinition.proccalloption) then
+      if not(cnf_inherited in tcallnode(left).callnodeflags) then
+        msgsendname:='OBJC_MSGSEND_STRET'
+      else
+        msgsendname:='OBJC_MSGSENDSUPER_STRET'
+{$ifdef i386}
+    { special case for fpu results on i386 for non-inherited calls }
+    else if (left.resultdef.typ=floatdef) and
+            not(cnf_inherited in tcallnode(left).callnodeflags) then
+      msgsendname:='OBJC_MSGSENF_FPRET'
+{$endif}
+    { default }
+    else if not(cnf_inherited in tcallnode(left).callnodeflags) then
+      msgsendname:='OBJC_MSGSEND'
+    else
+      msgsendname:='OBJC_MSGSENDSUPER';
+
+    newparas:=tcallparanode(tcallnode(left).left);
+    { parameters are chained from right to left, and we have to insert the two
+      first parameters (self and selector) -> walk to the end of the chain
+    }
+    lastpara:=newparas;
+    while assigned(lastpara.right) do
+      lastpara:=tcallparanode(lastpara.right);
+    { Handle self }
+    { 1) If we're calling a class method, use a class ref.  }
+    if (po_classmethod in tcallnode(left).procdefinition.procoptions) and
+       ((tcallnode(left).methodpointer.nodetype=typen) or
+        (tcallnode(left).methodpointer.resultdef.typ<>classrefdef)) then
+      begin
+        tcallnode(left).methodpointer:=cloadvmtaddrnode.create(tcallnode(left).methodpointer);
+        firstpass(tcallnode(left).methodpointer);
+      end;
+    { 2) convert parameter to id to match objc_MsgSend* signatures }
+    inserttypeconv_internal(tcallnode(left).methodpointer,objc_idtype);
+    { in case of sending a message to a superclass, self is a pointer to
+      and objc_super record
+    }
+    if (cnf_inherited in tcallnode(left).callnodeflags) then
+      begin
+         block:=internalstatements(statements);
+         objcsupertype:=search_named_unit_globaltype('OBJC1','OBJC_SUPER').typedef;
+         if (objcsupertype.typ<>recorddef) then
+           internalerror(2009032901);
+         { temp for the for the objc_super record }
+         temp:=ctempcreatenode.create(objcsupertype,objcsupertype.size,tt_persistent,false);
+         addstatement(statements,temp);
+         { initialize objc_super record: first the destination object instance }
+         field:=tfieldvarsym(trecorddef(objcsupertype).symtable.find('RECEIVER'));
+         if not assigned(field) then
+           internalerror(2009032902);
+         addstatement(statements,
+           cassignmentnode.create(
+             csubscriptnode.create(field,ctemprefnode.create(temp)),
+             tcallnode(left).methodpointer
+           )
+         );
+         { and secondly, the destination class type }
+         field:=tfieldvarsym(trecorddef(objcsupertype).symtable.find('_CLASS'));
+         if not assigned(field) then
+           internalerror(2009032903);
+         addstatement(statements,
+           cassignmentnode.create(
+             csubscriptnode.create(field,ctemprefnode.create(temp)),
+             objcsuperclassnode(tobjectdef(tcallnode(left).methodpointer.resultdef))
+           )
+         );
+         { result of this block is the address of this temp }
+         addstatement(statements,caddrnode.create_internal(ctemprefnode.create(temp)));
+         { replace the method pointer with the address of this temp }
+         tcallnode(left).methodpointer:=block;
+         typecheckpass(block);
+      end;
+    lastpara.right:=ccallparanode.create(tcallnode(left).methodpointer,nil);
+    { insert selector }
+    lastpara.right:=ccallparanode.create(
+      cobjcselectornode.create(
+        cstringconstnode.createstr(tprocdef(tcallnode(left).procdefinition).messageinf.str^)),
+     lastpara.right);
+    { parameters are reused -> make sure they don't get freed }
+    tcallnode(left).left:=nil;
+    { methodpointer is also reused }
+    tcallnode(left).methodpointer:=nil;
+    { and now the call to the Objective-C rtl }
+    result:=ccallnode.createinternresfromunit('OBJC1',msgsendname,newparas,left.resultdef);
+
+    if (cnf_inherited in tcallnode(left).callnodeflags) then
+      begin
+        { free the objc_super temp after the call. We cannout use
+          ctempdeletenode.create_normal_temp before the call, because then
+          the temp will be released while evaluating the parameters, and thus
+          may be reused while evaluating another parameter
+        }
+        block:=internalstatements(statements);
+        addstatement(statements,result);
+        addstatement(statements,ctempdeletenode.create(temp));
+        typecheckpass(block);
+        result:=block;
+     end;
+  end;
+
+
+begin
+  cobjcmessagesendnode:=tobjcmessagesendnode;
 end.
 end.
 
 

+ 4 - 2
compiler/node.pas

@@ -110,7 +110,8 @@ interface
           rttin,            { Rtti information so they can be accessed in result/firstpass}
           rttin,            { Rtti information so they can be accessed in result/firstpass}
           loadparentfpn,    { Load the framepointer of the parent for nested procedures }
           loadparentfpn,    { Load the framepointer of the parent for nested procedures }
           dataconstn,       { node storing some binary data }
           dataconstn,       { node storing some binary data }
-          objcselectorn
+          objcselectorn,    { node for an Objective-C message selector }
+          objcmessagesendn  { node for message sent to an Objective-C instance (similar to a method call) }
        );
        );
 
 
        tnodetypeset = set of tnodetype;
        tnodetypeset = set of tnodetype;
@@ -192,7 +193,8 @@ interface
           'rttin',
           'rttin',
           'loadparentfpn',
           'loadparentfpn',
           'dataconstn',
           'dataconstn',
-          'objcselectorn');
+          'objcselectorn',
+          'objcmessagesendn');
 
 
     type
     type
        { all boolean field of ttree are now collected in flags }
        { all boolean field of ttree are now collected in flags }

+ 76 - 0
compiler/objcgutl.pas

@@ -0,0 +1,76 @@
+{
+    Copyright (c) 2009 by Jonas Maebe
+
+    This unit implements some Objective-C helper routines at the code generator
+    level.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+
+{$i fpcdefs.inc}
+
+unit objcgutl;
+
+interface
+
+uses
+  cclasses,
+  aasmbase;
+
+procedure objcfinishstringrefpoolentry(entry: phashsetitem; refsec, stringsec: tasmsectiontype);
+
+
+implementation
+
+uses
+  globtype,
+  aasmdata,aasmtai,
+  cgbase,cgutils,
+  symsym,
+  verbose;
+
+procedure objcfinishstringrefpoolentry(entry: phashsetitem; refsec, stringsec: tasmsectiontype);
+  var
+    reflab,
+    strlab : tasmlabel;
+    pc     : pchar;
+  begin
+    { have we already generated this selector? }
+    if not assigned(entry^.Data) then
+      begin
+        { create new one
+          (no getdatalabel, because these labels have to be local)
+        }
+        current_asmdata.getlabel(reflab,alt_data);
+        current_asmdata.getlabel(strlab,alt_data);
+        entry^.Data:=reflab;
+        getmem(pc,entry^.keylength+1);
+        move(entry^.key^,pc^,entry^.keylength);
+        pc[entry^.keylength]:=#0;
+        { add a pointer to the message name in the string references section }
+        new_section(current_asmdata.asmlists[al_objc_data],refsec,reflab.name,sizeof(pint));
+        current_asmdata.asmlists[al_objc_data].concat(Tai_label.Create(reflab));
+        current_asmdata.asmlists[al_objc_data].concat(Tai_const.Create_sym(strlab));
+
+        { and now add the message name to the associated strings section }
+        new_section(current_asmdata.asmlists[al_objc_data],stringsec,strlab.name,1);
+        current_asmdata.asmlists[al_objc_data].concat(Tai_label.Create(strlab));
+        current_asmdata.asmlists[al_objc_data].concat(Tai_string.Create_pchar(pc,entry^.keylength+1));
+    end;
+  end;
+
+end.

+ 60 - 0
compiler/objcutil.pas

@@ -0,0 +1,60 @@
+{
+    Copyright (c) 2009 by Jonas Maebe
+
+    This unit implements some Objective-C helper routines at the node tree
+    level.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+
+{$i fpcdefs.inc}
+
+unit objcutil;
+
+interface
+
+uses
+  node,
+  symdef;
+
+function objcsuperclassnode(def: tobjectdef): tnode;
+
+implementation
+
+uses
+  pass_1,
+  verbose,
+  symtable,symconst,
+  nbas,nmem,ncal,nld;
+
+function objcsuperclassnode(def: tobjectdef): tnode;
+  var
+    block: tblocknode;
+    statements: tstatementnode;
+    para: tcallparanode;
+  begin
+    { only valid for Objective-C classes }
+    if not is_objcclass(def) then
+      internalerror(2009032903);
+    block:=internalstatements(statements);
+    para:=ccallparanode.create(cloadvmtaddrnode.create(ctypenode.create(def)),nil);
+    addstatement(statements,ccallnode.createinternfromunit('OBJC1','CLASS_GETSUPERCLASS',para));
+    typecheckpass(block);
+    result:=block;
+  end;
+
+end.

+ 25 - 2
compiler/pdecl.pas

@@ -278,6 +278,22 @@ implementation
 
 
     procedure types_dec;
     procedure types_dec;
 
 
+      procedure finish_objc_class(od: tobjectdef);
+        begin
+          { Objective-C classes can be external -> all messages inside are
+            external (defined at the class level instead of per method, so
+            that you cannot define some methods as external and some not)
+          }
+          if (token = _ID) and
+             (idtoken = _EXTERNAL) then
+            begin
+              consume(_EXTERNAL);
+              consume(_SEMICOLON);
+              od.make_all_methods_external;
+            end;
+        end;
+
+
         function parse_generic_parameters:TFPObjectList;
         function parse_generic_parameters:TFPObjectList;
         var
         var
           generictype : ttypesym;
           generictype : ttypesym;
@@ -361,7 +377,8 @@ implementation
                begin
                begin
                  if ((token=_CLASS) or
                  if ((token=_CLASS) or
                      (token=_INTERFACE) or
                      (token=_INTERFACE) or
-                     (token=_DISPINTERFACE)) and
+                     (token=_DISPINTERFACE) or
+                     (token=_OBJCCLASS)) and
                     (assigned(ttypesym(sym).typedef)) and
                     (assigned(ttypesym(sym).typedef)) and
                     is_class_or_interface_or_dispinterface(ttypesym(sym).typedef) and
                     is_class_or_interface_or_dispinterface(ttypesym(sym).typedef) and
                     (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then
                     (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then
@@ -376,6 +393,8 @@ implementation
                           objecttype:=odt_interfacecorba;
                           objecttype:=odt_interfacecorba;
                       _DISPINTERFACE :
                       _DISPINTERFACE :
                         objecttype:=odt_dispinterface;
                         objecttype:=odt_dispinterface;
+                      _OBJCCLASS :
+                        objecttype:=odt_objcclass;
                       else
                       else
                         internalerror(200811072);
                         internalerror(200811072);
                     end;
                     end;
@@ -473,7 +492,8 @@ implementation
                     { Build VMT indexes, skip for type renaming and forward classes }
                     { Build VMT indexes, skip for type renaming and forward classes }
                     if (hdef.typesym=newtype) and
                     if (hdef.typesym=newtype) and
                        not(oo_is_forward in tobjectdef(hdef).objectoptions) and
                        not(oo_is_forward in tobjectdef(hdef).objectoptions) and
-                       not(df_generic in hdef.defoptions) then
+                       not(df_generic in hdef.defoptions) and
+                       not is_objcclass(hdef) then
                       begin
                       begin
                         vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
                         vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
                         vmtbuilder.generate_vmt;
                         vmtbuilder.generate_vmt;
@@ -481,6 +501,9 @@ implementation
                       end;
                       end;
                     try_consume_hintdirective(newtype.symoptions);
                     try_consume_hintdirective(newtype.symoptions);
                     consume(_SEMICOLON);
                     consume(_SEMICOLON);
+
+                    if is_objcclass(hdef) then
+                      finish_objc_class(tobjectdef(hdef));
                   end;
                   end;
                 recorddef :
                 recorddef :
                   begin
                   begin

+ 23 - 1
compiler/pdecobj.pas

@@ -267,6 +267,9 @@ implementation
                    odt_cppclass:
                    odt_cppclass:
                      if not(is_cppclass(childof)) then
                      if not(is_cppclass(childof)) then
                        Message(parser_e_mix_of_classes_and_objects);
                        Message(parser_e_mix_of_classes_and_objects);
+                   odt_objcclass:
+                     if not(is_objcclass(childof)) then
+                       Message(parser_e_mix_of_classes_and_objects);
                    odt_object:
                    odt_object:
                      if not(is_object(childof)) then
                      if not(is_object(childof)) then
                        Message(parser_e_mix_of_classes_and_objects);
                        Message(parser_e_mix_of_classes_and_objects);
@@ -295,6 +298,9 @@ implementation
               odt_interfacecom:
               odt_interfacecom:
                 if current_objectdef<>interface_iunknown then
                 if current_objectdef<>interface_iunknown then
                   childof:=interface_iunknown;
                   childof:=interface_iunknown;
+              odt_objcclass:
+                if current_objectdef<>objcclass_nsobject then
+                  childof:=objcclass_nsobject;
             end;
             end;
           end;
           end;
 
 
@@ -362,6 +368,21 @@ implementation
 
 
     procedure parse_object_members;
     procedure parse_object_members;
 
 
+      procedure chkobjc(pd: tprocdef);
+        begin
+          if is_objcclass(pd._class) then
+            begin
+              { none of the explicit calling conventions should be allowed }
+              if (po_hascallingconvention in pd.procoptions) then
+                internalerror(2009032501);
+              pd.proccalloption:=pocall_cdecl;
+              if not(po_msgstr in pd.procoptions) then
+                Message(parser_e_objc_requires_msgstr);
+              include(pd.procoptions,po_objc);
+            end;
+        end;
+
+
         procedure chkcpp(pd:tprocdef);
         procedure chkcpp(pd:tprocdef);
         begin
         begin
            if is_cppclass(pd._class) then
            if is_cppclass(pd._class) then
@@ -390,7 +411,7 @@ implementation
         object_member_blocktype : tblock_type;
         object_member_blocktype : tblock_type;
       begin
       begin
         { empty class declaration ? }
         { empty class declaration ? }
-        if (current_objectdef.objecttype=odt_class) and
+        if (current_objectdef.objecttype in [odt_class,odt_objcclass]) and
            (token=_SEMICOLON) then
            (token=_SEMICOLON) then
           exit;
           exit;
 
 
@@ -545,6 +566,7 @@ implementation
                       include(current_objectdef.objectoptions,oo_has_virtual);
                       include(current_objectdef.objectoptions,oo_has_virtual);
 
 
                     chkcpp(pd);
                     chkcpp(pd);
+                    chkobjc(pd);
                   end;
                   end;
 
 
                 maybe_parse_hint_directives(pd);
                 maybe_parse_hint_directives(pd);

+ 46 - 12
compiler/pdecsub.pas

@@ -39,7 +39,8 @@ interface
         pd_notobjintf,   { directive can not be used interface declaration }
         pd_notobjintf,   { directive can not be used interface declaration }
         pd_notprocvar,   { directive can not be used procvar declaration }
         pd_notprocvar,   { directive can not be used procvar declaration }
         pd_dispinterface,{ directive can be used with dispinterface methods }
         pd_dispinterface,{ directive can be used with dispinterface methods }
-        pd_cppobject     { directive can be used with cppclass }
+        pd_cppobject,    { directive can be used with cppclass }
+        pd_objcclass     { directive can be used with objcclass }
       );
       );
       tpdflags=set of tpdflag;
       tpdflags=set of tpdflag;
 
 
@@ -158,7 +159,16 @@ implementation
         hdef     : tdef;
         hdef     : tdef;
         vsp      : tvarspez;
         vsp      : tvarspez;
       begin
       begin
-        if (pd.typ=procvardef) and
+        if (pd.typ=procdef) and
+           is_objcclass(tprocdef(pd)._class) then
+          begin
+            { insert Objective-C self and selector parameters }
+            vs:=tparavarsym.create('$msgsel',paranr_vmt,vs_value,objc_seltype,[vo_is_msgsel,vo_is_hidden_para]);
+            pd.parast.insert(vs);
+            vs:=tparavarsym.create('$self',paranr_self,vs_value,voidpointertype,[vo_is_self,vo_is_hidden_para]);
+            pd.parast.insert(vs);
+          end
+        else if (pd.typ=procvardef) and
            pd.is_methodpointer then
            pd.is_methodpointer then
           begin
           begin
             { Generate self variable }
             { Generate self variable }
@@ -1018,6 +1028,9 @@ implementation
 
 
           _CONSTRUCTOR :
           _CONSTRUCTOR :
             begin
             begin
+              { Objective-C does not know the concept of a constructor }
+              if is_objcclass(aclass) then
+                Message(parser_e_objc_no_constructor_destructor);
               consume(_CONSTRUCTOR);
               consume(_CONSTRUCTOR);
               parse_proc_head(aclass,potype_constructor,pd);
               parse_proc_head(aclass,potype_constructor,pd);
               if assigned(pd) and
               if assigned(pd) and
@@ -1038,6 +1051,9 @@ implementation
 
 
           _DESTRUCTOR :
           _DESTRUCTOR :
             begin
             begin
+              { Objective-C does not know the concept of a destructor }
+              if is_objcclass(aclass) then
+                Message(parser_e_objc_no_constructor_destructor);
               consume(_DESTRUCTOR);
               consume(_DESTRUCTOR);
               parse_proc_head(aclass,potype_destructor,pd);
               parse_proc_head(aclass,potype_destructor,pd);
               if assigned(pd) then
               if assigned(pd) then
@@ -1330,21 +1346,33 @@ var
 begin
 begin
   if pd.typ<>procdef then
   if pd.typ<>procdef then
     internalerror(2003042613);
     internalerror(2003042613);
-  if not is_class(tprocdef(pd)._class) then
+  if not is_class(tprocdef(pd)._class) and
+     not is_objcclass(tprocdef(pd)._class) then
     Message(parser_e_msg_only_for_classes);
     Message(parser_e_msg_only_for_classes);
   { check parameter type }
   { check parameter type }
-  paracnt:=0;
-  pd.parast.SymList.ForEachCall(@check_msg_para,@paracnt);
-  if paracnt<>1 then
-    Message(parser_e_ill_msg_param);
+  if not is_objcclass(tprocdef(pd)._class) then
+    begin
+      paracnt:=0;
+      pd.parast.SymList.ForEachCall(@check_msg_para,@paracnt);
+      if paracnt<>1 then
+        Message(parser_e_ill_msg_param);
+    end;
   pt:=comp_expr(true);
   pt:=comp_expr(true);
   if pt.nodetype=stringconstn then
   if pt.nodetype=stringconstn then
     begin
     begin
       include(pd.procoptions,po_msgstr);
       include(pd.procoptions,po_msgstr);
+      if (tstringconstnode(pt).len>255) then
+        Message(parser_e_message_string_too_long);
       tprocdef(pd).messageinf.str:=stringdup(tstringconstnode(pt).value_str);
       tprocdef(pd).messageinf.str:=stringdup(tstringconstnode(pt).value_str);
+      { the message string is the last part we need to set the mangled name
+        for an Objective-C message
+      }
+      if is_objcclass(tprocdef(pd)._class) then
+        tprocdef(pd).setmangledname(tprocdef(pd).objcmangledname);
     end
     end
   else
   else
-   if is_constintnode(pt) then
+   if is_constintnode(pt) and
+      is_class(tprocdef(pd)._class) then
     begin
     begin
       include(pd.procoptions,po_msgint);
       include(pd.procoptions,po_msgint);
       if (Tordconstnode(pt).value<int64(low(Tprocdef(pd).messageinf.i))) or
       if (Tordconstnode(pt).value<int64(low(Tprocdef(pd).messageinf.i))) or
@@ -1826,7 +1854,7 @@ const
       mutexclpo     : [po_external,po_exports]
       mutexclpo     : [po_external,po_exports]
     ),(
     ),(
       idtok:_MESSAGE;
       idtok:_MESSAGE;
-      pd_flags : [pd_interface,pd_object,pd_notobjintf];
+      pd_flags : [pd_interface,pd_object,pd_notobjintf,pd_objcclass];
       handler  : @pd_message;
       handler  : @pd_message;
       pocall   : pocall_none;
       pocall   : pocall_none;
       pooption : []; { can be po_msgstr or po_msgint }
       pooption : []; { can be po_msgstr or po_msgint }
@@ -1984,7 +2012,7 @@ const
       mutexclpo     : [po_assembler,po_external,po_virtualmethod]
       mutexclpo     : [po_assembler,po_external,po_virtualmethod]
     ),(
     ),(
       idtok:_VARARGS;
       idtok:_VARARGS;
-      pd_flags : [pd_interface,pd_implemen,pd_procvar];
+      pd_flags : [pd_interface,pd_implemen,pd_procvar,pd_objcclass];
       handler  : nil;
       handler  : nil;
       pocall   : pocall_none;
       pocall   : pocall_none;
       pooption : [po_varargs];
       pooption : [po_varargs];
@@ -2062,7 +2090,7 @@ const
            end;
            end;
          end;
          end;
 
 
-        { C directive is MAC only, because it breaks too much existing code
+        { C directive is MacPas only, because it breaks too much existing code
           on other platforms (PFV) }
           on other platforms (PFV) }
         if (idtoken=_C) and
         if (idtoken=_C) and
            not(m_mac in current_settings.modeswitches) then
            not(m_mac in current_settings.modeswitches) then
@@ -2081,7 +2109,7 @@ const
          begin
          begin
             { parsing a procvar type the name can be any
             { parsing a procvar type the name can be any
               next variable !! }
               next variable !! }
-            if ((pdflags * [pd_procvar,pd_object])=[]) and
+            if ((pdflags * [pd_procvar,pd_object,pd_objcclass])=[]) and
                not(idtoken=_PROPERTY) then
                not(idtoken=_PROPERTY) then
               Message1(parser_w_unknown_proc_directive_ignored,name);
               Message1(parser_w_unknown_proc_directive_ignored,name);
             exit;
             exit;
@@ -2139,10 +2167,16 @@ const
            if (pd_notobjintf in proc_direcdata[p].pd_flags) and
            if (pd_notobjintf in proc_direcdata[p].pd_flags) and
               is_interface(tprocdef(pd)._class) then
               is_interface(tprocdef(pd)._class) then
             exit;
             exit;
+
            { check if method and directive not for interface }
            { check if method and directive not for interface }
            if is_dispinterface(tprocdef(pd)._class) and
            if is_dispinterface(tprocdef(pd)._class) and
              not(pd_dispinterface in proc_direcdata[p].pd_flags) then
              not(pd_dispinterface in proc_direcdata[p].pd_flags) then
             exit;
             exit;
+
+           { check if method and directive not for objcclass }
+           if is_objcclass(tprocdef(pd)._class) and
+             not(pd_objcclass in proc_direcdata[p].pd_flags) then
+            exit;
          end;
          end;
 
 
         { consume directive, and turn flag on }
         { consume directive, and turn flag on }

+ 9 - 1
compiler/pmodules.pas

@@ -602,7 +602,15 @@ implementation
           AddUnit('macpas');
           AddUnit('macpas');
         { Objective-C 1.0 support unit? }
         { Objective-C 1.0 support unit? }
         if (m_objectivec1 in current_settings.modeswitches) then
         if (m_objectivec1 in current_settings.modeswitches) then
-          AddUnit('objc1');
+          begin
+            { interface to Objective-C run time }
+            AddUnit('objc1');
+            loadobjctypes;
+            { NSObject }
+            if not(current_module.is_unit) or
+               (current_module.modulename^<>'OBJCBASE') then
+              AddUnit('objcbase');
+          end;
         { Profile unit? Needed for go32v2 only }
         { Profile unit? Needed for go32v2 only }
         if (cs_profile in current_settings.moduleswitches) and
         if (cs_profile in current_settings.moduleswitches) and
            (target_info.system in [system_i386_go32v2,system_i386_watcom]) then
            (target_info.system in [system_i386_go32v2,system_i386_watcom]) then

+ 9 - 2
compiler/ptype.pas

@@ -987,6 +987,11 @@ implementation
                 consume(token);
                 consume(token);
                 def:=object_dec(odt_cppclass,name,genericdef,genericlist,nil);
                 def:=object_dec(odt_cppclass,name,genericdef,genericlist,nil);
               end;
               end;
+            _OBJCCLASS :
+              begin
+                consume(token);
+                def:=object_dec(odt_objcclass,name,genericdef,genericlist,nil);
+              end;
             _INTERFACE :
             _INTERFACE :
               begin
               begin
                 { need extra check here since interface is a keyword
                 { need extra check here since interface is a keyword
@@ -1099,7 +1104,8 @@ implementation
             { Init }
             { Init }
             if (
             if (
                 assigned(def.typesym) and
                 assigned(def.typesym) and
-                (st.symtabletype=globalsymtable)
+                (st.symtabletype=globalsymtable) and
+                not is_objcclass(def)
                ) or
                ) or
                def.needs_inittable or
                def.needs_inittable or
                (ds_init_table_used in def.defstates) then
                (ds_init_table_used in def.defstates) then
@@ -1107,7 +1113,8 @@ implementation
             { RTTI }
             { RTTI }
             if (
             if (
                   assigned(def.typesym) and
                   assigned(def.typesym) and
-                  (st.symtabletype=globalsymtable)
+                  (st.symtabletype=globalsymtable) and
+                  not is_objcclass(def)
                ) or
                ) or
                (ds_rtti_table_used in def.defstates) then
                (ds_rtti_table_used in def.defstates) then
               RTTIWriter.write_rtti(def,fullrtti);
               RTTIWriter.write_rtti(def,fullrtti);

+ 11 - 2
compiler/scanner.pas

@@ -449,9 +449,18 @@ implementation
                 current_settings.modeswitches:=init_settings.modeswitches;
                 current_settings.modeswitches:=init_settings.modeswitches;
               Result:=true;
               Result:=true;
               if doinclude then
               if doinclude then
-                include(current_settings.modeswitches,i)
+                begin
+                  include(current_settings.modeswitches,i);
+                  if (i=m_objectivec1) then
+                    include(current_settings.modeswitches,m_class);
+                end
               else
               else
-                exclude(current_settings.modeswitches,i);
+                begin
+                  exclude(current_settings.modeswitches,i);
+                  if (i=m_objectivec1) and
+                     ([m_delphi,m_objfpc]*current_settings.modeswitches=[]) then
+                    exclude(current_settings.modeswitches,m_class);
+                end;
 
 
               { set other switches depending on changed mode switch }
               { set other switches depending on changed mode switch }
               HandleModeSwitches(changeinit);
               HandleModeSwitches(changeinit);

+ 5 - 2
compiler/symconst.pas

@@ -289,7 +289,8 @@ type
     odt_interfacecom_function,
     odt_interfacecom_function,
     odt_interfacecorba,
     odt_interfacecorba,
     odt_cppclass,
     odt_cppclass,
-    odt_dispinterface
+    odt_dispinterface,
+    odt_objcclass
   );
   );
 
 
   { Variations in interfaces implementation }
   { Variations in interfaces implementation }
@@ -364,7 +365,9 @@ type
     vo_is_range_check,
     vo_is_range_check,
     vo_is_overflow_check,
     vo_is_overflow_check,
     vo_is_typinfo_para,
     vo_is_typinfo_para,
-    vo_is_weak_external
+    vo_is_weak_external,
+    { Objective-C message selector parameter }
+    vo_is_msgsel
   );
   );
   tvaroptions=set of tvaroption;
   tvaroptions=set of tvaroption;
 
 

+ 95 - 5
compiler/symdef.pas

@@ -299,6 +299,7 @@ interface
           procedure register_created_object_type;override;
           procedure register_created_object_type;override;
           procedure register_maybe_created_object_type;
           procedure register_maybe_created_object_type;
           procedure register_created_classref_type;
           procedure register_created_classref_type;
+          procedure make_all_methods_external;
        end;
        end;
 
 
        tclassrefdef = class(tabstractpointerdef)
        tclassrefdef = class(tabstractpointerdef)
@@ -517,6 +518,7 @@ interface
           procedure setmangledname(const s : string);
           procedure setmangledname(const s : string);
           function  fullprocname(showhidden:boolean):string;
           function  fullprocname(showhidden:boolean):string;
           function  cplusplusmangledname : string;
           function  cplusplusmangledname : string;
+          function  objcmangledname : string;
           function  is_methodpointer:boolean;override;
           function  is_methodpointer:boolean;override;
           function  is_addressonly:boolean;override;
           function  is_addressonly:boolean;override;
        end;
        end;
@@ -660,6 +662,13 @@ interface
          of all interfaces         }
          of all interfaces         }
        rec_tguid : trecorddef;
        rec_tguid : trecorddef;
 
 
+       { Objective-C base types }
+       objc_metaclasstype,
+       objc_superclasstype,
+       objc_idtype,
+       objc_seltype         : tpointerdef;
+       objcclass_nsobject   : tobjectdef;
+
     const
     const
 {$ifdef i386}
 {$ifdef i386}
        pbestrealtype : ^tdef = @s80floattype;
        pbestrealtype : ^tdef = @s80floattype;
@@ -708,10 +717,13 @@ interface
     function is_object(def: tdef): boolean;
     function is_object(def: tdef): boolean;
     function is_class(def: tdef): boolean;
     function is_class(def: tdef): boolean;
     function is_cppclass(def: tdef): boolean;
     function is_cppclass(def: tdef): boolean;
+    function is_objcclass(def: tdef): boolean;
+    function is_objcclassref(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
     function is_class_or_interface_or_object(def: tdef): boolean;
     function is_class_or_interface_or_object(def: tdef): boolean;
     function is_class_or_interface_or_dispinterface(def: tdef): boolean;
     function is_class_or_interface_or_dispinterface(def: tdef): boolean;
 
 
+    procedure loadobjctypes;
 
 
 {$ifdef x86}
 {$ifdef x86}
     function use_sse(def : tdef) : boolean;
     function use_sse(def : tdef) : boolean;
@@ -3498,6 +3510,24 @@ implementation
       end;
       end;
 
 
 
 
+    function  tprocdef.objcmangledname : string;
+      begin
+        if not (po_msgstr in procoptions) then
+          internalerror(2009030901);
+        { we may very well need longer strings to handle these... }
+        if ((255-length(tobjectdef(procsym.owner.defowner).objrealname^)
+             -length('+[ ]')-length(messageinf.str^)) < 0) then
+          Message1(parser_e_objc_message_name_too_long,messageinf.str^);
+        if not(po_classmethod in procoptions) then
+          result:='-['
+        else
+          result:='+[';
+        result:=
+          result+tobjectdef(procsym.owner.defowner).objrealname^+' '+
+          messageinf.str^+']';
+      end;
+
+
     procedure tprocdef.setmangledname(const s : string);
     procedure tprocdef.setmangledname(const s : string);
       begin
       begin
         { This is not allowed anymore, the forward declaration
         { This is not allowed anymore, the forward declaration
@@ -3685,6 +3715,12 @@ implementation
         else
         else
           ImplementedInterfaces:=nil;
           ImplementedInterfaces:=nil;
         writing_class_record_dbginfo:=false;
         writing_class_record_dbginfo:=false;
+
+       { make NSObject immediately known in the same unit }
+       if (childof=nil) and
+           (objecttype=odt_objcclass) and
+           (objrealname^='NSObject') then
+          objcclass_nsobject:=self;
      end;
      end;
 
 
 
 
@@ -3761,6 +3797,10 @@ implementation
             (objecttype=odt_interfacecom) and
             (objecttype=odt_interfacecom) and
             (objname^='IUNKNOWN') then
             (objname^='IUNKNOWN') then
            interface_iunknown:=self;
            interface_iunknown:=self;
+         if (childof=nil) and
+            (objecttype=odt_objcclass) and
+            (objrealname^='NSObject') then
+           objcclass_nsobject:=self;
          writing_class_record_dbginfo:=false;
          writing_class_record_dbginfo:=false;
        end;
        end;
 
 
@@ -4031,7 +4071,7 @@ implementation
         { inherit options and status }
         { inherit options and status }
         objectoptions:=objectoptions+(c.objectoptions*inherited_objectoptions);
         objectoptions:=objectoptions+(c.objectoptions*inherited_objectoptions);
         { add the data of the anchestor class/object }
         { add the data of the anchestor class/object }
-        if (objecttype in [odt_class,odt_object]) then
+        if (objecttype in [odt_class,odt_object,odt_objcclass]) then
           begin
           begin
             tObjectSymtable(symtable).datasize:=tObjectSymtable(symtable).datasize+tObjectSymtable(c.symtable).datasize;
             tObjectSymtable(symtable).datasize:=tObjectSymtable(symtable).datasize+tObjectSymtable(c.symtable).datasize;
             { inherit recordalignment }
             { inherit recordalignment }
@@ -4053,7 +4093,7 @@ implementation
      var
      var
        vs: tfieldvarsym;
        vs: tfieldvarsym;
      begin
      begin
-        if objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
+        if objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface,odt_objcclass] then
           exit;
           exit;
         if (oo_has_vmt in objectoptions) then
         if (oo_has_vmt in objectoptions) then
           internalerror(12345)
           internalerror(12345)
@@ -4148,7 +4188,7 @@ implementation
 
 
     function tobjectdef.size : aint;
     function tobjectdef.size : aint;
       begin
       begin
-        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
+        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface,odt_objcclass] then
           result:=sizeof(pint)
           result:=sizeof(pint)
         else
         else
           result:=tObjectSymtable(symtable).datasize;
           result:=tObjectSymtable(symtable).datasize;
@@ -4157,7 +4197,7 @@ implementation
 
 
     function tobjectdef.alignment:shortint;
     function tobjectdef.alignment:shortint;
       begin
       begin
-        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
+        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface,odt_objcclass] then
           alignment:=sizeof(pint)
           alignment:=sizeof(pint)
         else
         else
           alignment:=tObjectSymtable(symtable).recordalignment;
           alignment:=tObjectSymtable(symtable).recordalignment;
@@ -4171,6 +4211,8 @@ implementation
         odt_class:
         odt_class:
           { the +2*sizeof(pint) is size and -size }
           { the +2*sizeof(pint) is size and -size }
           vmtmethodoffset:=(index+10)*sizeof(pint)+2*sizeof(pint);
           vmtmethodoffset:=(index+10)*sizeof(pint)+2*sizeof(pint);
+        odt_objcclass:
+          vmtmethodoffset:=0;
         odt_interfacecom,odt_interfacecorba:
         odt_interfacecom,odt_interfacecorba:
           vmtmethodoffset:=index*sizeof(pint);
           vmtmethodoffset:=index*sizeof(pint);
         else
         else
@@ -4203,7 +4245,8 @@ implementation
               needs_inittable:=is_related(interface_iunknown);
               needs_inittable:=is_related(interface_iunknown);
             odt_object:
             odt_object:
               needs_inittable:=tObjectSymtable(symtable).needs_init_final;
               needs_inittable:=tObjectSymtable(symtable).needs_init_final;
-            odt_cppclass:
+            odt_cppclass,
+            odt_objcclass:
               needs_inittable:=false;
               needs_inittable:=false;
             else
             else
               internalerror(200108267);
               internalerror(200108267);
@@ -4286,6 +4329,25 @@ implementation
           end;
           end;
       end;
       end;
 
 
+
+    procedure make_procdef_external(data: tobject; arg: pointer);
+      var
+        def: tdef absolute data;
+      begin
+        if (def.typ = procdef) then
+          begin
+            include(tprocdef(def).procoptions,po_external);
+            tprocdef(def).forwarddef:=false;
+          end;
+      end;
+
+
+    procedure tobjectdef.make_all_methods_external;
+      begin
+         self.symtable.deflist.foreachcall(@make_procdef_external,nil);
+      end;
+
+
 {****************************************************************************
 {****************************************************************************
                              TImplementedInterface
                              TImplementedInterface
 ****************************************************************************}
 ****************************************************************************}
@@ -4566,6 +4628,24 @@ implementation
       end;
       end;
 
 
 
 
+    function is_objcclass(def: tdef): boolean;
+      begin
+        is_objcclass:=
+          assigned(def) and
+          (def.typ=objectdef) and
+          (tobjectdef(def).objecttype=odt_objcclass);
+      end;
+
+
+    function is_objcclassref(def: tdef): boolean;
+      begin
+        is_objcclassref:=
+          assigned(def) and
+          (def.typ=classrefdef) and
+          is_objcclass(tclassrefdef(def).pointeddef);
+      end;
+
+
     function is_class_or_interface(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
       begin
       begin
         result:=
         result:=
@@ -4593,7 +4673,17 @@ implementation
       end;
       end;
 
 
 
 
+    procedure loadobjctypes;
+      begin
+        objc_metaclasstype:=tpointerdef(search_named_unit_globaltype('OBJC1','POBJC_CLASS').typedef);
+        objc_superclasstype:=tpointerdef(search_named_unit_globaltype('OBJC1','POBJC_SUPER').typedef);
+        objc_idtype:=tpointerdef(search_named_unit_globaltype('OBJC1','ID').typedef);
+        objc_seltype:=tpointerdef(search_named_unit_globaltype('OBJC1','SEL').typedef);
+      end;
+
+
 {$ifdef x86}
 {$ifdef x86}
+
     function use_sse(def : tdef) : boolean;
     function use_sse(def : tdef) : boolean;
       begin
       begin
         use_sse:=(is_single(def) and (current_settings.fputype in sse_singlescalar)) or
         use_sse:=(is_single(def) and (current_settings.fputype in sse_singlescalar)) or

+ 61 - 0
compiler/symtable.pas

@@ -196,10 +196,12 @@ interface
     function  searchsym(const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym(const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_type(const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_type(const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_module(pm:pointer;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_module(pm:pointer;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
+    function searchsym_in_named_module(const unitname, symname: TIDString; out srsym: tsym; out srsymtable: tsymtable): boolean;
     function  searchsym_in_class(classh,contextclassh:tobjectdef;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_class(classh,contextclassh:tobjectdef;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_class_by_msgint(classh:tobjectdef;msgid:longint;out srdef : tdef;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_class_by_msgint(classh:tobjectdef;msgid:longint;out srdef : tdef;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_class_by_msgstr(classh:tobjectdef;const s:string;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  searchsym_in_class_by_msgstr(classh:tobjectdef;const s:string;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function  search_system_type(const s: TIDString): ttypesym;
     function  search_system_type(const s: TIDString): ttypesym;
+    function  search_named_unit_globaltype(const unitname, typename: TIDString): ttypesym;
     function  search_class_member(pd : tobjectdef;const s : string):tsym;
     function  search_class_member(pd : tobjectdef;const s : string):tsym;
     function  search_assignment_operator(from_def,to_def:Tdef):Tprocdef;
     function  search_assignment_operator(from_def,to_def:Tdef):Tprocdef;
     {Looks for macro s (must be given in upper case) in the macrosymbolstack, }
     {Looks for macro s (must be given in upper case) in the macrosymbolstack, }
@@ -1761,6 +1763,43 @@ implementation
       end;
       end;
 
 
 
 
+    function searchsym_in_named_module(const unitname, symname: TIDString; out srsym: tsym; out srsymtable: tsymtable): boolean;
+      var
+        stackitem  : psymtablestackitem;
+      begin
+        result:=false;
+        stackitem:=symtablestack.stack;
+        while assigned(stackitem) do
+          begin
+            srsymtable:=stackitem^.symtable;
+            if (srsymtable.symtabletype=globalsymtable) and
+               (srsymtable.name^=unitname) then
+              begin
+                srsym:=tsym(srsymtable.find(symname));
+                if not assigned(srsym) then
+                  break;
+                result:=true;
+                exit;
+              end;
+            stackitem:=stackitem^.next;
+          end;
+
+        { If the module is the current unit we also need
+          to search the local symtable }
+        if (current_module.globalsymtable=srsymtable) and
+           assigned(current_module.localsymtable) then
+          begin
+            srsymtable:=current_module.localsymtable;
+            srsym:=tsym(srsymtable.find(symname));
+            if assigned(srsym) then
+              begin
+                result:=true;
+                exit;
+              end;
+          end;
+      end;
+
+
     function searchsym_in_class(classh,contextclassh:tobjectdef;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
     function searchsym_in_class(classh,contextclassh:tobjectdef;const s : TIDString;out srsym:tsym;out srsymtable:TSymtable):boolean;
       var
       var
         hashedid : THashedIDString;
         hashedid : THashedIDString;
@@ -1907,6 +1946,28 @@ implementation
       end;
       end;
 
 
 
 
+    function search_named_unit_globaltype(const unitname, typename: TIDString): ttypesym;
+      var
+        contextobjdef : tobjectdef;
+        stackitem  : psymtablestackitem;
+        srsymtable: tsymtable;
+        sym: tsym;
+      begin
+        if searchsym_in_named_module(unitname,typename,sym,srsymtable) and
+           (sym.typ=typesym) then
+          begin
+            result:=ttypesym(sym);
+            exit;
+          end
+        else
+          begin
+            cgmessage2(cg_f_unknown_type_in_unit,typename,unitname);
+            result:=nil;
+          end;
+      end;
+
+
+
     function search_class_member(pd : tobjectdef;const s : string):tsym;
     function search_class_member(pd : tobjectdef;const s : string):tsym;
     { searches n in symtable of pd and all anchestors }
     { searches n in symtable of pd and all anchestors }
       var
       var

+ 2 - 0
compiler/tokens.pas

@@ -221,6 +221,7 @@ type
     _INTERFACE,
     _INTERFACE,
     _INTERRUPT,
     _INTERRUPT,
     _NODEFAULT,
     _NODEFAULT,
+    _OBJCCLASS,
     _OTHERWISE,
     _OTHERWISE,
     _PROCEDURE,
     _PROCEDURE,
     _PROTECTED,
     _PROTECTED,
@@ -473,6 +474,7 @@ const
       (str:'INTERFACE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'INTERFACE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'INTERRUPT'     ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'INTERRUPT'     ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'NODEFAULT'     ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'NODEFAULT'     ;special:false;keyword:m_none;op:NOTOKEN),
+      (str:'OBJCCLASS'     ;special:false;keyword:m_objectivec1;op:NOTOKEN),
       (str:'OTHERWISE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'OTHERWISE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'PROCEDURE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'PROCEDURE'     ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'PROTECTED'     ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'PROTECTED'     ;special:false;keyword:m_none;op:NOTOKEN),

+ 74 - 59
rtl/darwin/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/02/28]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/03/15]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -295,178 +295,178 @@ ifndef USELIBGGI
 USELIBGGI=NO
 USELIBGGI=NO
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs $(CPU_UNITS) dos dl objects printer sockets sysutils typinfo fgl classes math varutils types charset ucomplex getopts heaptrc lineinfo lnfodwrf errors ipc terminfo termio video crt mouse keyboard console variants dateutils convutils stdconvs sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd fpintres fpextres clocale objc1 objcbase
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_IMPLICITUNITS+=exeinfo
 override TARGET_IMPLICITUNITS+=exeinfo
@@ -1383,6 +1383,7 @@ endif
 ifeq ($(OS_TARGET),go32v2)
 ifeq ($(OS_TARGET),go32v2)
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=dos
 SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),watcom)
 ifeq ($(OS_TARGET),watcom)
 STATICLIBPREFIX=
 STATICLIBPREFIX=
@@ -1390,6 +1391,7 @@ OEXT=.obj
 ASMEXT=.asm
 ASMEXT=.asm
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=wat
 SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 BATCHEXT=.sh
 BATCHEXT=.sh
@@ -1426,6 +1428,7 @@ STATICLIBPREFIX=
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=os2
 SHORTSUFFIX=os2
 ECHO=echo
 ECHO=echo
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),emx)
 ifeq ($(OS_TARGET),emx)
 BATCHEXT=.cmd
 BATCHEXT=.cmd
@@ -1434,6 +1437,7 @@ STATICLIBPREFIX=
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=emx
 SHORTSUFFIX=emx
 ECHO=echo
 ECHO=echo
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),amiga)
 ifeq ($(OS_TARGET),amiga)
 EXEEXT=
 EXEEXT=
@@ -1473,17 +1477,20 @@ ifeq ($(OS_TARGET),netware)
 EXEEXT=.nlm
 EXEEXT=.nlm
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=nw
 SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
 endif
 endif
 ifeq ($(OS_TARGET),netwlibc)
 ifeq ($(OS_TARGET),netwlibc)
 EXEEXT=.nlm
 EXEEXT=.nlm
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=nwl
 SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
 endif
 endif
 ifeq ($(OS_TARGET),macos)
 ifeq ($(OS_TARGET),macos)
 BATCHEXT=
 BATCHEXT=
 EXEEXT=
 EXEEXT=
 DEBUGSYMEXT=.xcoff
 DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
 endif
 endif
 ifeq ($(OS_TARGET),darwin)
 ifeq ($(OS_TARGET),darwin)
 BATCHEXT=.sh
 BATCHEXT=.sh
@@ -1510,14 +1517,17 @@ STATICLIBEXT=.a1
 SHAREDLIBEXT=.so1
 SHAREDLIBEXT=.so1
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=v1
 SHORTSUFFIX=v1
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),go32v2)
 ifeq ($(OS_TARGET),go32v2)
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=dos
 SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),watcom)
 ifeq ($(OS_TARGET),watcom)
 STATICLIBPREFIX=
 STATICLIBPREFIX=
 SHORTSUFFIX=wat
 SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 BATCHEXT=.sh
 BATCHEXT=.sh
@@ -1564,6 +1574,7 @@ STATICLIBEXT=.ao2
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=os2
 SHORTSUFFIX=os2
 ECHO=echo
 ECHO=echo
+IMPORTLIBPREFIX=
 endif
 endif
 ifeq ($(OS_TARGET),amiga)
 ifeq ($(OS_TARGET),amiga)
 EXEEXT=
 EXEEXT=
@@ -1624,6 +1635,7 @@ STATICLIBEXT=.a
 SHAREDLIBEXT=.nlm
 SHAREDLIBEXT=.nlm
 EXEEXT=.nlm
 EXEEXT=.nlm
 SHORTSUFFIX=nw
 SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
 endif
 endif
 ifeq ($(OS_TARGET),netwlibc)
 ifeq ($(OS_TARGET),netwlibc)
 STATICLIBPREFIX=
 STATICLIBPREFIX=
@@ -1635,6 +1647,7 @@ STATICLIBEXT=.a
 SHAREDLIBEXT=.nlm
 SHAREDLIBEXT=.nlm
 EXEEXT=.nlm
 EXEEXT=.nlm
 SHORTSUFFIX=nwl
 SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
 endif
 endif
 ifeq ($(OS_TARGET),macos)
 ifeq ($(OS_TARGET),macos)
 BATCHEXT=
 BATCHEXT=
@@ -1646,6 +1659,7 @@ STATICLIBEXT=.a
 EXEEXT=
 EXEEXT=
 DEBUGSYMEXT=.xcoff
 DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
 endif
 endif
 endif
 endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
@@ -2442,6 +2456,7 @@ strings$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
 		   $(SYSTEMUNIT)$(PPUEXT)
 objc1$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objc1.pp
 objc1$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objc1.pp
+objcbase$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objcbase.pp objc1$(PPUEXT)
 baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
 baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
   signal.inc $(UNIXINC)/bunxh.inc \
   signal.inc $(UNIXINC)/bunxh.inc \
   $(BSDINC)/bunxsysc.inc \
   $(BSDINC)/bunxsysc.inc \

+ 3 - 1
rtl/darwin/Makefile.fpc

@@ -16,7 +16,7 @@ units=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixut
       errors ipc terminfo termio video crt mouse keyboard console \
       errors ipc terminfo termio video crt mouse keyboard console \
       variants dateutils convutils stdconvs \
       variants dateutils convutils stdconvs \
       sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd \
       sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd \
-      fpintres fpextres clocale objc1
+      fpintres fpextres clocale objc1 objcbase
 implicitunits=exeinfo
 implicitunits=exeinfo
 
 
 rsts=math varutils typinfo classes variants dateutils sysconst rtlconsts
 rsts=math varutils typinfo classes variants dateutils sysconst rtlconsts
@@ -138,6 +138,8 @@ strings$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/strings.pp $(INC)/stringsi.inc\
 
 
 objc1$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objc1.pp
 objc1$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objc1.pp
 
 
+objcbase$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/objcbase.pp objc1$(PPUEXT)
+
 #
 #
 # System Dependent Units
 # System Dependent Units
 #
 #

+ 44 - 0
rtl/inc/objc1.pp

@@ -29,6 +29,50 @@ const
   {$error Add support for the current target to the objc1 unit }
   {$error Add support for the current target to the objc1 unit }
 {$endif}
 {$endif}
 
 
+type
+  { make all opaque types assignment-incompatible with other typed pointers by
+    declaring them as pointers to empty records
+
+    WARNING: do NOT change the names, types or field names/types of these
+      types, as many are used internally by the compiler.
+  }
+  tobjc_class = record
+  end;
+  pobjc_class = ^tobjc_class;
+
+  objc_object = record
+    _class: pobjc_class;
+  end;
+  id = ^objc_object;
+
+  _fpc_objc_sel_type = record
+  end;
+  SEL = ^_fpc_objc_sel_type;
+
+  IMP = function(target: id; msg: SEL): id; varargs; cdecl;
+
+  objc_super = record
+    receiver: id;
+    _class: pobjc_class;
+  end;
+  pobjc_super = ^objc_super;
+
+  _fpc_objc_protocol_type = record
+  end;
+  pobjc_protocal = ^_fpc_objc_protocol_type;
+
+{ sending messages }
+function  objc_msgSend(self: id; op: SEL): id; cdecl; varargs; external libname;
+function  objc_msgSendSuper(const super: pobjc_super; op: SEL): id; cdecl; varargs; external libname;
+procedure objc_msgSend_stret(stret: Pointer; self: id; op: SEL); cdecl; varargs; external libname;
+procedure objc_msgSendSuper_stret(stret: Pointer; const super: pobjc_super; op: SEL); cdecl; varargs; external libname;
+{$ifdef cpui386}
+function  objc_msgSend_fpret (self: id; op: SEL): double; cdecl; varargs; external libname;
+{$endif cpui386}
+
+function class_getSuperclass(cls: pobjc_class): pobjc_class; cdecl; external libname;
+
+
 implementation
 implementation
 
 
 end.
 end.

+ 0 - 33
rtl/inc/objc1h.inc

@@ -1,33 +0,0 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2009 by the Free Pascal development team
-
-    This unit contains Objective-C compatibility stuff.
-
-    Additionally this file defines the interface of TObject, providing
-    their basic implementation in the corresponding objpas.inc file.
-
-    WARNING: IF YOU CHANGE SOME OF THESE INTERNAL RECORDS, MAKE SURE
-    TO MODIFY THE COMPILER AND OBJPAS.INC ACCORDINGLY, OTHERWISE
-    THIS WILL LEAD TO CRASHES IN THE RESULTING COMPILER AND/OR RTL.
-
-    IN PARTICULAR, THE IMPLEMENTATION PART OF THIS INCLUDE FILE,
-    OBJPAS.INC, USES SOME HARDCODED RECORD MEMBER OFFSETS.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{*****************************************************************************
-                            Basic Types/constants
-*****************************************************************************}
-
-    type
-      { make sel assignment-incompatible with other typed pointers }
-      _fpc_objc_sel_type = record end;
-      SEL = ^_fpc_objc_sel_type;

+ 125 - 0
rtl/inc/objcbase.pp

@@ -0,0 +1,125 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2009 by the Free Pascal development team
+
+    This unit provides the definition of the NSObject root class
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+unit objcbase;
+
+{$ifdef FPC_HAS_FEATURE_OBJECTIVEC1}
+
+{$modeswitch objectivec1}
+
+interface
+
+uses
+  ctypes;
+
+type
+{
+  NSString = objcclass; external;
+  NSZone = objcclass; external;
+  NSInvocation = objcclass; external;
+  NSMethodSignature = objcclass; external;
+  NSCoder = objcclass; external;
+}
+
+  NSObject = objcclass
+   strict protected
+    isa: pobjc_class;
+   public
+    { NSObject protocol }
+    function isEqual_(obj: id): boolean; message 'isEqual:';
+    function hash: cuint; message 'hash';
+// implemented as class method instead?
+//     function superclass: pobjc_class;
+    { "self" is both a hidden parameter to each method, and a method of
+      NSObject and thereby of each subclass as well
+    }
+    function self: id;  message 'self';
+    function zone: id;  message 'zone';{ NSZone }
+
+    function performSelector_(aSelector: SEL): id; message 'performSelector:';
+    function performSelector_withObject_(aSelector: SEL; obj: id): id; message 'performSelector:withObject:';
+    function performSelector_withObject_withObject(aSelector: SEL; obj1, obj2: id): id; message 'performSelector:withObject:withObject:';
+
+    function isProxy: boolean; message 'isProxy';
+
+    function isKindOfClass_(aClass: pobjc_class): boolean; message 'isKindOfClass:';
+    function isMemberOfClass_(aClass: pobjc_class): boolean; message 'isMemberOfClass:';
+// implemented as class method instead?
+//     function conformsToProtocol(aProtocol: pobjc_protocal): boolean;
+
+    function respondsToSelector_(aSelector: SEL): boolean; message 'respondsToSelector:';
+
+    function retain: id; message 'retain';
+    procedure release;  message 'release'; { oneway }
+    function autorelease: id; message 'autorelease';
+    function retainCount: cint; message 'retainCount';
+
+// implemented as class method instead?
+//     function description: NSString;
+
+    { NSObject methods }
+
+    class procedure load; message 'load';
+
+    class procedure initialize; message 'initialize';
+    function init: id; message 'init';
+
+    class function new: id; message 'new';
+    class function allocWithZone_(_zone: id {NSZone}): id; message 'allocWithZone:';
+    class function alloc: id; message 'alloc';
+    procedure dealloc; message 'dealloc';
+    { if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+    procedure finalize; message 'finalize';
+    { endif }
+
+    function copy: id; message 'copy';
+    function mutableCopy: id; message 'mutableCopy';
+
+    class function copyWithZone_(_zone: id {NSZone}): id; message 'copyWithZone:';
+    class function mutableCopyWithZone_(_zone: id {NSZone}): id; message 'mutableCopyWithZone:';
+
+    class function superclass: pobjc_class; message 'superclass';
+    class function _class: pobjc_class; message 'class';
+    class procedure poseAsClass_(aClass: pobjc_class); message 'poseAsClass:';
+    class function instancesRespondToSelector_(aSelector: SEL): boolean; message 'instancesRespondToSelector:';
+    class function conformsToProtocol_(aProtocol: pobjc_protocal): boolean; message 'conformsToProtocol:';
+    function methodForSelector_(aSelector: SEL): IMP; message 'methodForSelector:';
+    class function instanceMethodForSelector_(aSelector: SEL): IMP; message 'instanceMethodForSelector:';
+    class function version: cint; message 'version';
+    class procedure setVersion_(aVersion: cint); message 'setVersion:';
+    procedure doesNotRecognizeSelector_(aSelector: SEL); message 'doesNotRecognizeSelector:';
+    procedure forwardInvocation_(anInvocation: id {NSInvocation}); message 'forwardInvocation:';
+    function methodSignatureForSelector_(aSelector: SEL): id {NSMethodSignature}; message 'methodSignatureForSelector:';
+
+    class function description: id {NSString}; message 'description';
+
+    function classForCoder: pobjc_class; message 'classForCoder';
+    function replacementObjectForCoder_(aCoder: id {NSCoder}): id; message 'replacementObjectForCoder:';
+    function awakeAfterUsingCoder_(aDecoder: id {NSCoder}): id; message 'awakeAfterUsingCoder:';
+  end; external;
+
+implementation
+
+{$else }
+
+interface
+
+implementation
+
+{$endif}
+
+end.
+
+

+ 0 - 9
rtl/inc/systemh.inc

@@ -1061,15 +1061,6 @@ const
 {$i objpash.inc}
 {$i objpash.inc}
 {$endif FPC_HAS_FEATURE_CLASSES}
 {$endif FPC_HAS_FEATURE_CLASSES}
 
 
-{*****************************************************************************
-                       Objective-C support
-*****************************************************************************}
-
-{$ifdef FPC_HAS_FEATURE_OBJECTIVEC1}
-{$i objc1h.inc}
-{$endif FPC_HAS_FEATURE_OBJECTIVEC1}
-
-
 {*****************************************************************************
 {*****************************************************************************
                            Variant support
                            Variant support
 *****************************************************************************}
 *****************************************************************************}

+ 24 - 0
tests/test/tobjc1.pp

@@ -0,0 +1,24 @@
+{$mode objfpc}
+{$modeswitch objectivec1}
+
+uses
+  ctypes;
+
+var
+  a: NSObject;
+begin
+  a:=NSObject(NSObject(NSObject.alloc).init);
+  if a.respondstoselector_(selector('isKindOfClass:')) then
+    writeln('ok string selector!')
+  else
+    halt(1);
+  if a.respondstoselector_(selector(NSObject.init)) then
+    writeln('ok method selector!')
+  else
+    halt(2);
+
+  if (a.self<>id(a)) then
+    halt(3);
+  if (a.superclass<>nil) then
+    halt(4);
+end.

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác