diff --git a/packages/fcl-web/src/jsonrpc/fpjsonrpc.pp b/packages/fcl-web/src/jsonrpc/fpjsonrpc.pp index c08db0e4d6..47d0ecf5e6 100644 --- a/packages/fcl-web/src/jsonrpc/fpjsonrpc.pp +++ b/packages/fcl-web/src/jsonrpc/fpjsonrpc.pp @@ -412,7 +412,9 @@ function CreateJSON2ErrorResponse(Const AMessage : String; Const ACode : Integer begin If (ID=Nil) then - ID:=TJSONNull.Create; + ID:=TJSONNull.Create + else + ID:=ID.Clone; Result:=TJSONErrorObject.Create(['jsonrpc','2.0','error',CreateJSONErrorObject(AMessage,ACode),idname,ID]); end; @@ -420,7 +422,9 @@ function CreateJSON2ErrorResponse(Const AFormat : String; Args : Array of const; begin If (ID=Nil) then - ID:=TJSONNull.Create; + ID:=TJSONNull.Create + else + ID:=ID.Clone; Result:=TJSONErrorObject.Create(['jsonrpc','2.0','error',CreateJSONErrorObject(Format(AFormat,Args),ACode),idname,ID]); end; @@ -812,7 +816,7 @@ begin begin // No response, and a response was expected. if (ID<>Nil) or not (jdoNotifications in Options) then - Result:=CreateJSON2Error(SErrNoResponse,[M],EJSONRPCInternalError,ID.Clone,transactionProperty); + Result:=CreateJSON2Error(SErrNoResponse,[M],EJSONRPCInternalError,ID,transactionProperty); end else begin @@ -832,7 +836,7 @@ begin If (Result<>Nil) then FreeAndNil(Result); If Assigned(ID) and not (ID is TJSONNull) then - Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,ID.Clone,transactionproperty) + Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,ID,transactionproperty) else Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,Nil,transactionproperty); end; @@ -973,7 +977,7 @@ begin O:=A.Objects[i]; J:=O.IndexOfName('id'); if (J<>-1) then - ID:=O.Items[J].Clone; + ID:=O.Items[J]; end; TJSONArray(Result).Add(CreateJSON2ErrorResponse(SErrJSON2NotAllowed,EJSONRPCInvalidRequest,ID,transactionproperty)); end; diff --git a/packages/fcl-web/src/jsonrpc/webjsonrpc.pp b/packages/fcl-web/src/jsonrpc/webjsonrpc.pp index fe58f04014..b9cb65cc9e 100644 --- a/packages/fcl-web/src/jsonrpc/webjsonrpc.pp +++ b/packages/fcl-web/src/jsonrpc/webjsonrpc.pp @@ -275,7 +275,8 @@ begin AResponse.FreeContentStream:=True; AResponse.ContentStream:=TMemoryStream.Create; R:=Res.AsJSON; - AResponse.ContentStream.WriteBuffer(R[1],Length(R)); + if Length(R)>0 then + AResponse.ContentStream.WriteBuffer(R[1],Length(R)); AResponse.ContentLength:=AResponse.ContentStream.Size; R:=''; // Free up mem AResponse.ContentType:=GetResponseContentType; diff --git a/packages/webidl/src/webidlparser.pp b/packages/webidl/src/webidlparser.pp index c38cd1e936..769e18bf28 100644 --- a/packages/webidl/src/webidlparser.pp +++ b/packages/webidl/src/webidlparser.pp @@ -29,6 +29,7 @@ Type TWebIDLContext = Class (TIDLBaseObject) private + FAliases: TStrings; FDefinitions: TIDLDefinitionList; FHash : TFPObjectHashTable; Protected @@ -50,6 +51,7 @@ Type Function Add(aClass : TIDLDefinitionClass; const AName : UTF8String) : TIDLDefinition; override; Function Add(aParent : TIDLBaseObject; aClass : TIDLDefinitionClass; const AName : UTF8String) : TIDLDefinition; virtual; Property Definitions : TIDLDefinitionList Read FDefinitions; + Property Aliases : TStrings Read FAliases Write FAliases; end; { TWebIDLParser } @@ -132,6 +134,7 @@ Resourcestring SErrTypeNotAllowed = 'Type "%s" not allowed in "%s" type.'; SErrDictionaryNotFound = 'Dictionary %s not found'; SErrInterfaceNotFound = 'Interface %s not found'; + SErrInterfaceNotFoundfor = 'Included Interface %s not found for %s'; { TWebIDLParser } @@ -1367,9 +1370,17 @@ begin Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFound,[ID.Name]); II:=FindInterface(ID.IncludedInterface); If (II=Nil) then - Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFound,[ID.Name]); - II.IsInclude:=True; - OI.Partials.Add(II); + begin + if Assigned(Aliases) and (Aliases.IndexOfName(ID.IncludedInterface)<>-1) then + OI.ParentName:=Aliases.Values[ID.IncludedInterface] + else + Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFoundFor,[ID.IncludedInterface,ID.Name]); + end + else + begin + II.IsInclude:=True; + OI.Partials.Add(II); + end end; // if there is a single include, no members and no parent, make it a descendent For D in FDefinitions do diff --git a/packages/webidl/src/webidltopas.pp b/packages/webidl/src/webidltopas.pp index 63f4b7a0f2..b3d4785b9a 100644 --- a/packages/webidl/src/webidltopas.pp +++ b/packages/webidl/src/webidltopas.pp @@ -1363,6 +1363,7 @@ procedure TWebIDLToPas.ProcessDefinitions; begin FContext.AppendPartials; FContext.AppendIncludes; + AllocatePasNames(FContext.Definitions); end; @@ -1371,6 +1372,7 @@ procedure TWebIDLToPas.Execute; begin FContext:=CreateContext; try + FContext.Aliases:=Self.TypeAliases; Parse; if Verbose then DoLog('Parsed %d definitions.',[Context.Definitions.Count]); diff --git a/utils/fpdoc/dw_html.pp b/utils/fpdoc/dw_html.pp index df51525847..40623f1dda 100644 --- a/utils/fpdoc/dw_html.pp +++ b/utils/fpdoc/dw_html.pp @@ -2657,17 +2657,22 @@ Procedure THTMLWriter.AddElementsFromList(L : TStrings; List : TFPList; UsePathN Var I : Integer; El : TPasElement; + N : TDocNode; begin For I:=0 to List.Count-1 do begin El:=TPasElement(List[I]); - if UsePathName then - L.AddObject(El.PathName,El) - else - L.AddObject(El.Name,El); - If el is TPasEnumType then - AddElementsFromList(L,TPasEnumType(el).Values); + N:=Engine.FindDocNode(El); + if (N=Nil) or (not N.IsSkipped) then + begin + if UsePathName then + L.AddObject(El.PathName,El) + else + L.AddObject(El.Name,El); + If el is TPasEnumType then + AddElementsFromList(L,TPasEnumType(el).Values); + end; end; end; diff --git a/utils/fpdoc/makeskel.pp b/utils/fpdoc/makeskel.pp index 5c71648235..23c3daf2d4 100644 --- a/utils/fpdoc/makeskel.pp +++ b/utils/fpdoc/makeskel.pp @@ -23,8 +23,7 @@ program MakeSkel; {$h+} uses - SysUtils, Classes, Gettext, - dGlobals, PasTree, PParser,PScanner; + SysUtils, Classes, Gettext, dGlobals, PasTree, PParser,PScanner; resourcestring STitle = 'MakeSkel - FPDoc skeleton XML description file generator'; @@ -235,7 +234,9 @@ Function TSkelEngine.WriteElement(Var F : Text;El : TPasElement; ADocNode : TDoc begin Result:=(APasElement.ClassType=TPasArgument) or (APasElement.ClassType=TPasResultElement) or - (APasElement.ClassType=TPasEnumValue); + (APasElement.ClassType=TPasEnumValue) or + (aPaselement.ClassType=TPasUsesUnit) or + ((APasElement.CLassType=TPasVariable) and (APasElement.Parent is TPasRecordType)); end; Function IsTypeVarConst(APasElement : TPasElement) : Boolean; @@ -398,7 +399,7 @@ begin FEmittedList:=TStringList.Create; FEmittedList.Sorted:=True; try - Module:=ParseSource (Self,AFileName,ATarget,ACPU,[poUseStreams,poSkipDefaultDefs]); + Module:=ParseSource (Self,AFileName+' -dFPC',ATarget,ACPU,[poUseStreams,poSkipDefaultDefs]); If UpdateMode then begin N:=FindDocNode(Module);