فهرست منبع

* reverted r12690 and r12691
* but extended ptconst so that a com interface maybe assigned to a TGuid const

git-svn-id: trunk@12692 -

ivost 16 سال پیش
والد
کامیت
0f519439b5
4فایلهای تغییر یافته به همراه24 افزوده شده و 6 حذف شده
  1. 1 1
      compiler/defcmp.pas
  2. 20 2
      compiler/ptconst.pas
  3. 2 2
      rtl/inc/objpas.inc
  4. 1 1
      rtl/inc/objpash.inc

+ 1 - 1
compiler/defcmp.pas

@@ -500,7 +500,7 @@ implementation
                  objectdef :
                    begin
                      { corba interface -> id string }
-                     if is_interfacecorba(def_from) or is_interfacecom(def_from) then
+                     if is_interfacecorba(def_from) then
                       begin
                         doconv:=tc_intf_2_string;
                         eq:=te_convert_l1;

+ 20 - 2
compiler/ptconst.pas

@@ -996,8 +996,26 @@ implementation
           is_packed: boolean;
         begin
           { GUID }
-          if (def=rec_tguid) and
-             ((token=_CSTRING) or (token=_CCHAR) or (token=_ID)) then
+          if (def=rec_tguid) and (token=_ID) then
+            begin
+              n:=comp_expr(true);
+              inserttypeconv(n,rec_tguid);
+              if n.nodetype=guidconstn then
+                begin
+                  tmpguid:=tguidconstnode(n).value;
+                  list.concat(Tai_const.Create_32bit(longint(tmpguid.D1)));
+                  list.concat(Tai_const.Create_16bit(tmpguid.D2));
+                  list.concat(Tai_const.Create_16bit(tmpguid.D3));
+                  for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
+                    list.concat(Tai_const.Create_8bit(tmpguid.D4[i]));
+                end
+              else
+                Message(parser_e_illegal_expression);
+              n.free;
+              exit;
+            end;
+          if (def=rec_tguid) and { maybe keep token=_ID here to assign corba interfaces to TGuid }
+             ((token=_CSTRING) or (token=_CCHAR) {or (token=_ID)}) then
             begin
               n:=comp_expr(true);
               inserttypeconv(n,cshortstringtype);

+ 2 - 2
rtl/inc/objpas.inc

@@ -676,10 +676,10 @@
           Result := getcorbainterfacebyentry(self, getinterfaceentrybystr(iidstr), obj);
         end;
 
-      {function TObject.getinterface(const iidstr : string;out obj) : boolean;
+      function TObject.getinterface(const iidstr : string;out obj) : boolean;
         begin
           Result := getinterfacebystr(iidstr,obj);
-        end;}
+        end;
 
       class function TObject.getinterfaceentry(const iid : tguid) : pinterfaceentry;
         var

+ 1 - 1
rtl/inc/objpash.inc

@@ -209,7 +209,7 @@
 
           { interface functions }
           function GetInterface(const iid : tguid; out obj) : boolean;
-          //function GetInterface(const iidstr : string;out obj) : boolean;
+          function GetInterface(const iidstr : string;out obj) : boolean;
           function GetInterfaceByStr(const iidstr : string; out obj) : boolean;
           class function GetInterfaceEntry(const iid : tguid) : pinterfaceentry;
           class function GetInterfaceEntryByStr(const iidstr : string) : pinterfaceentry;