From 467d62d6d7f76e241a3e98f578abb7c3c2d5dfb9 Mon Sep 17 00:00:00 2001 From: inoussa Date: Mon, 29 Oct 2012 19:31:17 +0000 Subject: [PATCH] "HAS_EXP_TREE" define to handle fcl-passrc expressions git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2586 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tests/test_suite/test_generators.pas | 44 +++++++++++++++++++ wst/trunk/type_lib_edtr/ufpropedit.lfm | 6 +-- wst/trunk/type_lib_edtr/ufpropedit.lrs | 6 +-- wst/trunk/type_lib_edtr/uinterfaceedit.lfm | 4 +- wst/trunk/type_lib_edtr/uinterfaceedit.lrs | 6 ++- wst/trunk/type_lib_edtr/uinterfaceedit.pas | 11 +++-- wst/trunk/ws_helper/generator.pas | 4 ++ wst/trunk/ws_helper/ws_parser_imp.pas | 4 ++ wst/trunk/ws_helper/wsdl_parser.pas | 12 ++++- 9 files changed, 83 insertions(+), 14 deletions(-) diff --git a/wst/trunk/tests/test_suite/test_generators.pas b/wst/trunk/tests/test_suite/test_generators.pas index 2148469e0..a8daf393a 100644 --- a/wst/trunk/tests/test_suite/test_generators.pas +++ b/wst/trunk/tests/test_suite/test_generators.pas @@ -100,7 +100,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -166,7 +170,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -235,7 +243,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -305,7 +317,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -378,7 +394,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -441,7 +461,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -503,7 +527,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -1013,7 +1041,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -1074,7 +1106,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -1135,7 +1171,11 @@ var p.VarType := tr.FindElement(ATypeName) as TPasType; Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName])); p.VarType.AddRef(); +{$IFDEF HAS_EXP_TREE} + p.DefaultExpr := TPrimitiveExpr.Create(p,pekString,ADefault); +{$ELSE HAS_EXP_TREE} p.DefaultValue := ADefault; +{$ENDIF HAS_EXP_TREE} p.Visibility := visPublished; p.StoredAccessorName := 'True'; if ( AKind = ptAttribute ) then @@ -1236,7 +1276,11 @@ begin mdl.InterfaceSection := TInterfaceSection(tr.CreateElement(TInterfaceSection,'',mdl,visDefault,'',0)); cltyp := TPasClassType(tr.CreateElement(TPasClassType,'IEchoService',mdl.InterfaceSection,visDefault,'',0)); cltyp.ObjKind := okInterface; +{$IFDEF HAS_EXP_TREE} + cltyp.GUIDExpr := TPrimitiveExpr.Create(cltyp,pekString,'{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}'); +{$ELSE HAS_EXP_TREE} cltyp.InterfaceGUID := '{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}'; +{$ENDIF HAS_EXP_TREE} mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); tr.AddBinding('IEchoServiceBinding',cltyp); diff --git a/wst/trunk/type_lib_edtr/ufpropedit.lfm b/wst/trunk/type_lib_edtr/ufpropedit.lfm index 6d3e37389..c3e3a8e2a 100644 --- a/wst/trunk/type_lib_edtr/ufpropedit.lfm +++ b/wst/trunk/type_lib_edtr/ufpropedit.lfm @@ -1,7 +1,7 @@ object fPropEdit: TfPropEdit - Left = 979 + Left = 486 Height = 326 - Top = 146 + Top = 236 Width = 324 HorzScrollBar.Page = 323 VertScrollBar.Page = 325 @@ -11,7 +11,7 @@ object fPropEdit: TfPropEdit ClientHeight = 326 ClientWidth = 324 Position = poDesktopCenter - LCLVersion = '0.9.29' + LCLVersion = '0.9.31' object Panel1: TPanel Left = 0 Height = 50 diff --git a/wst/trunk/type_lib_edtr/ufpropedit.lrs b/wst/trunk/type_lib_edtr/ufpropedit.lrs index 1f6fa7e6f..114aa0d2b 100644 --- a/wst/trunk/type_lib_edtr/ufpropedit.lrs +++ b/wst/trunk/type_lib_edtr/ufpropedit.lrs @@ -1,11 +1,11 @@ { This is an automatically generated lazarus resource file } LazarusResources.Add('TfPropEdit','FORMDATA',[ - 'TPF0'#10'TfPropEdit'#9'fPropEdit'#4'Left'#3#211#3#6'Height'#3'F'#1#3'Top'#3 - +#146#0#5'Width'#3'D'#1#18'HorzScrollBar.Page'#3'C'#1#18'VertScrollBar.Page'#3 + 'TPF0'#10'TfPropEdit'#9'fPropEdit'#4'Left'#3#230#1#6'Height'#3'F'#1#3'Top'#3 + +#236#0#5'Width'#3'D'#1#18'HorzScrollBar.Page'#3'C'#1#18'VertScrollBar.Page'#3 +'E'#1#11'BorderIcons'#11#12'biSystemMenu'#0#11'BorderStyle'#7#8'bsDialog'#7 +'Caption'#6#9'fPropEdit'#12'ClientHeight'#3'F'#1#11'ClientWidth'#3'D'#1#8'Po' - +'sition'#7#15'poDesktopCenter'#10'LCLVersion'#6#6'0.9.29'#0#6'TPanel'#6'Pane' + +'sition'#7#15'poDesktopCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TPanel'#6'Pane' +'l1'#4'Left'#2#0#6'Height'#2'2'#3'Top'#3#20#1#5'Width'#3'D'#1#5'Align'#7#8'a' +'lBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3'D'#1#8'TabOrder'#2#0#0#7'T' +'Button'#7'Button1'#4'Left'#3#236#0#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K' diff --git a/wst/trunk/type_lib_edtr/uinterfaceedit.lfm b/wst/trunk/type_lib_edtr/uinterfaceedit.lfm index 83b18137a..0dde3724c 100644 --- a/wst/trunk/type_lib_edtr/uinterfaceedit.lfm +++ b/wst/trunk/type_lib_edtr/uinterfaceedit.lfm @@ -12,7 +12,7 @@ object fInterfaceEdit: TfInterfaceEdit ClientWidth = 531 OnCreate = FormCreate Position = poDesktopCenter - LCLVersion = '0.9.29' + LCLVersion = '1.0.1.4' object Panel1: TPanel Left = 0 Height = 50 @@ -91,7 +91,7 @@ object fInterfaceEdit: TfInterfaceEdit Top = 0 Width = 480 Align = alClient - DefaultItemHeight = 15 + DefaultItemHeight = 16 PopupMenu = PopupMenu1 TabOrder = 0 end diff --git a/wst/trunk/type_lib_edtr/uinterfaceedit.lrs b/wst/trunk/type_lib_edtr/uinterfaceedit.lrs index 192cfdcb8..31d689753 100644 --- a/wst/trunk/type_lib_edtr/uinterfaceedit.lrs +++ b/wst/trunk/type_lib_edtr/uinterfaceedit.lrs @@ -1,10 +1,12 @@ +{ This is an automatically generated lazarus resource file } + LazarusResources.Add('TfInterfaceEdit','FORMDATA',[ 'TPF0'#15'TfInterfaceEdit'#14'fInterfaceEdit'#4'Left'#3'i'#1#6'Height'#3'4'#2 +#3'Top'#3'%'#1#5'Width'#3#19#2#18'HorzScrollBar.Page'#3#18#2#18'VertScrollBa' +'r.Page'#3'3'#2#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeTo' +'olWin'#7'Caption'#6#14'fInterfaceEdit'#12'ClientHeight'#3'4'#2#11'ClientWid' +'th'#3#19#2#8'OnCreate'#7#10'FormCreate'#8'Position'#7#15'poDesktopCenter'#10 - +'LCLVersion'#6#6'0.9.29'#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2'2'#3 + +'LCLVersion'#6#7'1.0.1.4'#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2'2'#3 +'Top'#3#2#2#5'Width'#3#19#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'2'#11 +'ClientWidth'#3#19#2#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#180#1 +#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0 @@ -24,7 +26,7 @@ LazarusResources.Add('TfInterfaceEdit','FORMDATA',[ +'Bottom'#0#7'Caption'#6#11' Methods '#12'ClientHeight'#3'^'#1#11'ClientWid' +'th'#3#224#1#8'TabOrder'#2#1#0#9'TTreeView'#10'trvMethods'#4'Left'#2#0#6'Hei' +'ght'#3'^'#1#3'Top'#2#0#5'Width'#3#224#1#5'Align'#7#8'alClient'#17'DefaultIt' - +'emHeight'#2#15#9'PopupMenu'#7#10'PopupMenu1'#8'TabOrder'#2#0#0#0#0#7'TButto' + +'emHeight'#2#16#9'PopupMenu'#7#10'PopupMenu1'#8'TabOrder'#2#0#0#0#0#7'TButto' +'n'#7'Button3'#4'Left'#2#20#6'Height'#2#25#3'Top'#3#194#1#5'Width'#2'c'#6'Ac' +'tion'#7#12'actNewMethod'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#2#0 +#0#7'TButton'#7'Button4'#4'Left'#3#132#0#6'Height'#2#25#3'Top'#3#194#1#5'Wid' diff --git a/wst/trunk/type_lib_edtr/uinterfaceedit.pas b/wst/trunk/type_lib_edtr/uinterfaceedit.pas index e20a33257..ef3f628a3 100644 --- a/wst/trunk/type_lib_edtr/uinterfaceedit.pas +++ b/wst/trunk/type_lib_edtr/uinterfaceedit.pas @@ -10,10 +10,9 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } +{$INCLUDE wst_global.inc} unit uinterfaceedit; -{$mode objfpc}{$H+} - interface uses @@ -273,8 +272,14 @@ begin end; FObject := TPasClassType(FSymbolTable.CreateElement(TPasClassType,intName,FSymbolTable.CurrentModule.InterfaceSection,visDefault,'',0)); FObject.ObjKind := okInterface; - if ( CreateGUID(g) = 0 ) then + if ( CreateGUID(g) = 0 ) then begin +{$IFDEF HAS_EXP_TREE} + FreeAndNil(FObject.GUIDExpr); + FObject.GUIDExpr:=TPrimitiveExpr.Create(FObject,pekString,GUIDToString(g)); +{$ELSE HAS_EXP_TREE} FObject.InterfaceGUID := GUIDToString(g); +{$ENDIF HAS_EXP_TREE} + end; FSymbolTable.CurrentModule.InterfaceSection.Declarations.Add(FObject); FSymbolTable.CurrentModule.InterfaceSection.Types.Add(FObject); FSymbolTable.AddBinding(Format('%sBinding',[FObject.Name]),FObject).BindingStyle := bsRPC; diff --git a/wst/trunk/ws_helper/generator.pas b/wst/trunk/ws_helper/generator.pas index 20a92ea11..59dda5a03 100644 --- a/wst/trunk/ws_helper/generator.pas +++ b/wst/trunk/ws_helper/generator.pas @@ -336,7 +336,11 @@ begin try locRes.ObjKind := okInterface; if ( CreateGUID(g) = 0 ) then +{$IFDEF HAS_EXP_TREE} + locRes.GUIDExpr:=TPrimitiveExpr.Create(locRes,pekString,GUIDToString(g)); +{$ELSE HAS_EXP_TREE} locRes.InterfaceGUID := GUIDToString(g); +{$ENDIF HAS_EXP_TREE} c := ARawInt.Members.Count; if ( c > 0 ) then begin for i := 0 to ( c - 1 ) do begin diff --git a/wst/trunk/ws_helper/ws_parser_imp.pas b/wst/trunk/ws_helper/ws_parser_imp.pas index 43bb6d4d8..bc6c93688 100644 --- a/wst/trunk/ws_helper/ws_parser_imp.pas +++ b/wst/trunk/ws_helper/ws_parser_imp.pas @@ -1074,7 +1074,11 @@ var locPartCursor := CreateCursorOn(locAttCursor.Clone() as IObjectCursor,ParseFilter(Format('%s = %s',[s_NODE_NAME,QuotedStr(s_default)]),TDOMNodeRttiExposer)); locPartCursor.Reset(); if locPartCursor.MoveNext() then + {$IFDEF HAS_EXP_TREE} + locProp.DefaultExpr:=TPrimitiveExpr.Create(locProp,pekString,(locPartCursor.GetCurrent() as TDOMNodeRttiExposer).NodeValue); + {$ELSE HAS_EXP_TREE} locProp.DefaultValue := (locPartCursor.GetCurrent() as TDOMNodeRttiExposer).NodeValue; + {$ENDIF HAS_EXP_TREE} ExtractExtendedMetadata(locProp,AElement); end; diff --git a/wst/trunk/ws_helper/wsdl_parser.pas b/wst/trunk/ws_helper/wsdl_parser.pas index e072b39f7..f0c49e38d 100644 --- a/wst/trunk/ws_helper/wsdl_parser.pas +++ b/wst/trunk/ws_helper/wsdl_parser.pas @@ -1225,9 +1225,19 @@ begin FModule.InterfaceSection.Classes.Add(locIntf); locIntf.ObjKind := okInterface; Result := locIntf; +{$IFDEF HAS_EXP_TREE} + locIntf.GUIDExpr:=TPrimitiveExpr.Create(locIntf,pekString,ParseIntfGuid()); +{$ELSE HAS_EXP_TREE} locIntf.InterfaceGUID := ParseIntfGuid(); - if IsStrEmpty(locIntf.InterfaceGUID) and ( CreateGUID(inft_guid) = 0 ) then +{$ENDIF HAS_EXP_TREE} + if IsStrEmpty(locIntf.InterfaceGUID) and ( CreateGUID(inft_guid) = 0 ) then begin +{$IFDEF HAS_EXP_TREE} + FreeAndNil(locIntf.GUIDExpr); + locIntf.GUIDExpr:=TPrimitiveExpr.Create(locIntf,pekString,GUIDToString(inft_guid) ); +{$ELSE HAS_EXP_TREE} locIntf.InterfaceGUID := GUIDToString(inft_guid); +{$ENDIF HAS_EXP_TREE} + end; locCursor := CreateChildrenCursor(ANode,cetRttiNode); if Assigned(locCursor) then begin locOpCursor := CreateCursorOn(locCursor,ParseFilter(CreateQualifiedNameFilterStr(s_operation,FWsdlShortNames),TDOMNodeRttiExposer));