From e4e3f34376b1156da1bf34c3cd585744ba2218a6 Mon Sep 17 00:00:00 2001 From: inoussa Date: Tue, 15 Nov 2011 19:11:17 +0000 Subject: [PATCH] "CaseSensitive" fixes. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2144 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/tests/test_suite/test_generators.pas | 16 ++++++++-------- wst/trunk/tests/test_suite/test_parsers.pas | 3 ++- wst/trunk/ws_helper/generator.pas | 8 ++++++++ wst/trunk/ws_helper/pascal_parser_intf.pas | 5 ++++- wst/trunk/ws_helper/wsdl_parser.pas | 4 ++-- wst/trunk/ws_helper/xsd_parser.pas | 4 ++-- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/wst/trunk/tests/test_suite/test_generators.pas b/wst/trunk/tests/test_suite/test_generators.pas index 2d071a880..2148469e0 100644 --- a/wst/trunk/tests/test_suite/test_generators.pas +++ b/wst/trunk/tests/test_suite/test_generators.pas @@ -123,11 +123,11 @@ begin cltyp.ObjKind := okClass; mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); - AddProperty('intField','integer','1210',ptField); + AddProperty('intField','int','1210',ptField); AddProperty('strField','string','azerty',ptField); AddProperty('floatField','float','1234',ptField); AddProperty('strAtt','string','attribute azerty',ptAttribute); - AddProperty('intAtt','integer','789',ptAttribute); + AddProperty('intAtt','int','789',ptAttribute); locDoc := CreateDoc(); g := CreateGenerator(locDoc); @@ -193,12 +193,12 @@ begin cltyp.ObjKind := okClass; mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); - p := AddProperty('intField','integer','',ptField,'uri-4#a','1210'); + p := AddProperty('intField','int','',ptField,'uri-4#a','1210'); tr.Properties.SetValue(p,'uri-4#b','uri-5#xx'); AddProperty('strField','string','azerty',ptField,'uri-4#a','http://www.w3.org/2001/XMLSchema#int'); AddProperty('floatField','float','',ptField,'',''); AddProperty('strAtt','string','attribute azerty',ptAttribute,'uri-4#a','optional'); - AddProperty('intAtt','integer','',ptAttribute,'',''); + AddProperty('intAtt','int','',ptAttribute,'',''); locDoc := CreateDoc(); g := CreateGenerator(locDoc); @@ -260,7 +260,7 @@ begin cltyp.AncestorType.AddRef(); mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); - AddProperty('intAtt','integer','',ptAttribute); + AddProperty('intAtt','int','',ptAttribute); cltyp := TPasClassType(tr.CreateElement(TPasClassType,'TExtendBase64String',mdl.InterfaceSection,visDefault,'',0)); cltyp.ObjKind := okClass; @@ -337,11 +337,11 @@ begin cltyp.AncestorType.AddRef(); mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); - AddProperty('intField','integer','',ptField); + AddProperty('intField','int','',ptField); AddProperty('strField','string','',ptField); AddProperty('floatField','float','',ptField); AddProperty('strAtt','string','',ptAttribute); - AddProperty('intAtt','integer','',ptAttribute); + AddProperty('intAtt','int','',ptAttribute); locDoc := CreateDoc(); g := CreateGenerator(locDoc); @@ -404,7 +404,7 @@ begin mdl.InterfaceSection.Declarations.Add(cltyp); mdl.InterfaceSection.Types.Add(cltyp); AddProperty('strAtt','string','',ptAttribute); - AddProperty('intAtt','integer','',ptAttribute); + AddProperty('intAtt','int','',ptAttribute); locDoc := CreateDoc(); g := CreateGenerator(locDoc); diff --git a/wst/trunk/tests/test_suite/test_parsers.pas b/wst/trunk/tests/test_suite/test_parsers.pas index 8307930ff..4e4f26012 100644 --- a/wst/trunk/tests/test_suite/test_parsers.pas +++ b/wst/trunk/tests/test_suite/test_parsers.pas @@ -337,6 +337,7 @@ end; function TTest_CustomXsdParser.ParseDoc(const ADoc: string): TwstPasTreeContainer; begin Result := ParseDoc(ADoc,False); + Result.DefaultSearchNameKinds := NAME_KINDS_DEFAULT; end; procedure TTest_CustomXsdParser.EmptySchema(); @@ -779,7 +780,7 @@ begin CheckIs(elt,TPasClassType); clsType := elt as TPasClassType; CheckNotNull(clsType.AncestorType,'AncestorType is null'); - CheckSame(tr.FindElementNS('TComplexStringContentRemotable',sXSD_NS),clsType.AncestorType); + CheckSame(tr.FindElementNS('TComplexStringContentRemotable',sXSD_NS),clsType.AncestorType,clsType.AncestorType.Name); prpLs.Clear(); for i := 0 to Pred(clsType.Members.Count) do begin diff --git a/wst/trunk/ws_helper/generator.pas b/wst/trunk/ws_helper/generator.pas index 49cbb2e4d..ffb747c8a 100644 --- a/wst/trunk/ws_helper/generator.pas +++ b/wst/trunk/ws_helper/generator.pas @@ -3261,9 +3261,15 @@ var oldCurrent, mdl : TPasModule; i : PtrInt; mdlList : TList; + oldCS : Boolean; + oldNamesKinds : TElementNameKinds; begin + oldCS := SymbolTable.CaseSensitive; + oldNamesKinds := SymbolTable.DefaultSearchNameKinds; oldCurrent := SymbolTable.CurrentModule; try + SymbolTable.CaseSensitive := False; + SymbolTable.DefaultSearchNameKinds := [elkName]; mdlList := SymbolTable.Package.Modules; for i := 0 to Pred(mdlList.Count) do begin mdl := TPasModule(mdlList[i]); @@ -3275,6 +3281,8 @@ begin end; finally SymbolTable.SetCurrentModule(oldCurrent); + SymbolTable.CaseSensitive := oldCS; + SymbolTable.DefaultSearchNameKinds := oldNamesKinds; end; end; diff --git a/wst/trunk/ws_helper/pascal_parser_intf.pas b/wst/trunk/ws_helper/pascal_parser_intf.pas index 8fac32fb5..5f1dc1724 100644 --- a/wst/trunk/ws_helper/pascal_parser_intf.pas +++ b/wst/trunk/ws_helper/pascal_parser_intf.pas @@ -326,6 +326,8 @@ procedure AddSystemSymbol( ADest.InterfaceSection.Declarations.Add(splTyp); ADest.InterfaceSection.Types.Add(splTyp); typlst[i] := splTyp; + end; + for i := Low(SIMPLE_TYPES) to High(SIMPLE_TYPES) do begin s := SIMPLE_TYPES[i][1]; if not IsStrEmpty(s) then begin syb := AContainer.FindElementInModule(SIMPLE_TYPES[i][1],ADest) as TPasNativeSimpleContentClassType; @@ -334,7 +336,7 @@ procedure AddSystemSymbol( ADest.InterfaceSection.Declarations.Add(syb); ADest.InterfaceSection.Types.Add(syb); end; - splTyp.SetExtendableType(syb); + typlst[i].SetExtendableType(syb); end; end; for i := Low(SIMPLE_TYPES) to High(SIMPLE_TYPES) do begin @@ -483,6 +485,7 @@ begin AddAlias('anyURI','string',Result); AddAlias('ID','string',Result); //AddAlias('float','Single',Result); + AddAlias('integer','int',Result); AddAlias('nonNegativeInteger','LongWord',Result); AddAlias('positiveInteger','nonNegativeInteger',Result); {$IFNDEF WST_HAS_TDURATIONREMOTABLE} diff --git a/wst/trunk/ws_helper/wsdl_parser.pas b/wst/trunk/ws_helper/wsdl_parser.pas index 82fe4533e..9e7c92816 100644 --- a/wst/trunk/ws_helper/wsdl_parser.pas +++ b/wst/trunk/ws_helper/wsdl_parser.pas @@ -196,8 +196,8 @@ destructor TWsdlParser.Destroy(); var j : PtrInt; begin - if Assigned(AList) then begin - for j := 0 to Pred(AList.Count) do begin + if Assigned(AList) and (AList.Count > 0) then begin + for j := Pred(AList.Count) downto 0 do begin AList.Objects[j].Free(); AList.Objects[j] := nil; end; diff --git a/wst/trunk/ws_helper/xsd_parser.pas b/wst/trunk/ws_helper/xsd_parser.pas index cc0558034..de2fd7ea8 100644 --- a/wst/trunk/ws_helper/xsd_parser.pas +++ b/wst/trunk/ws_helper/xsd_parser.pas @@ -236,8 +236,8 @@ destructor TCustomXsdSchemaParser.Destroy(); var j : PtrInt; begin - if Assigned(AList) then begin - for j := 0 to Pred(AList.Count) do begin + if Assigned(AList) and (AList.Count > 0) then begin + for j := Pred(AList.Count) downto 0 do begin AList.Objects[j].Free(); AList.Objects[j] := nil; end;