diff --git a/wst/trunk/base_binary_formatter.pas b/wst/trunk/base_binary_formatter.pas index 25d4d7c4d..9fa35174a 100644 --- a/wst/trunk/base_binary_formatter.pas +++ b/wst/trunk/base_binary_formatter.pas @@ -477,7 +477,7 @@ type implementation uses - imp_utils; + imp_utils, wst_consts; {$INCLUDE wst_rtl_imp.inc} @@ -578,9 +578,9 @@ Begin If ( AIndex >= 0 ) And ( AIndex < AOwner^.ArrayData^.Count ) Then AOwner^.ArrayData^.Items^[AIndex] := AChildData Else - Raise EBinaryFormatterException.CreateFmt('Invalid array acces : %d',[AIndex]) + Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex]) End Else Begin - Raise EBinaryFormatterException.CreateFmt('Invalid data type in this context : %d',[Ord(AOwner^.DataType)]) + Raise EBinaryFormatterException.CreateFmt(SERR_InvalidDataTypeInContext,[GetEnumName(TypeInfo(TDataType), Ord(AOwner^.DataType))]) End; End; @@ -912,7 +912,7 @@ begin p := p^.Next; Result := p^.Data; End Else - Raise EBinaryFormatterException.CreateFmt('Invalid index access : %d',[AIndex]); + Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex]); end; function TObjectStackItem.CreateBuffer( @@ -1038,7 +1038,7 @@ end; procedure TBaseBinaryFormatter.CheckScope(); begin If Not HasScope() Then - Error('There is no scope.'); + Error(SERR_NoScope); end; function TBaseBinaryFormatter.GetCurrentScope: String; @@ -1381,12 +1381,12 @@ var i, j, k : Integer; begin If ( Length(ABounds) < 2 ) Then - Raise EBinaryFormatterException.Create('Invalid array bounds.'); + Raise EBinaryFormatterException.Create(SERR_InvalidArrayBounds); i := ABounds[0]; j := ABounds[1]; k := ( j - i + 1 ); If ( k < 0 ) Then - Raise EBinaryFormatterException.Create('Invalid array bounds.'); + Raise EBinaryFormatterException.Create(SERR_InvalidArrayBounds); PushStack(CreateArrayBuffer(k,AName,StackTop().ScopeObject),stArray); end; @@ -1429,7 +1429,7 @@ begin stk := StackTop(); locNode := stk.Find(AScopeName); if not Assigned(locNode) then begin - Error('Scope not found : "%s"',[AScopeName]); + Error(SERR_ScopeNotFound,[AScopeName]); end; PushStack(locNode,stObject); Result := StackTop().GetItemCount(); @@ -1675,7 +1675,7 @@ begin {$ENDIF HAS_QWORD} tkClass, tkRecord : begin - raise EBinaryFormatterException.Create('Inner Scope value must be a "simple type" value.'); + raise EBinaryFormatterException.Create(SERR_InnerScopeMustBeSimpleType); end; {$IFDEF FPC} tkBool : @@ -1966,7 +1966,7 @@ begin tkUString : UnicodeString(AData) := dataBuffer^.UnicodeStrData^.Data; {$ENDIF WST_UNICODESTRING} - tkClass, tkRecord : raise EBinaryFormatterException.Create('Inner Scope value must be a "simple type" value.'); + tkClass, tkRecord : raise EBinaryFormatterException.Create(SERR_InnerScopeMustBeSimpleType); {$IFDEF FPC} tkBool : Boolean(AData) := dataBuffer^.BoolData; {$ENDIF} @@ -2136,7 +2136,7 @@ begin If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then Result := ScopeObject^.ArrayData^.Items^[FIndex] Else - Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[FIndex]); + Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[FIndex]); Inc(FIndex); end; @@ -2145,7 +2145,7 @@ begin If ( AIndex >= 0 ) And ( AIndex < ScopeObject^.ArrayData^.Count ) Then Result := ScopeObject^.ArrayData^.Items^[AIndex] Else - Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[AIndex]); + Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex]); end; function TArrayStackItem.CreateBuffer( @@ -2156,7 +2156,7 @@ begin If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then Result := CreateObjBuffer(ADataType,AName,Nil) Else - Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[FIndex]); + Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[FIndex]); ScopeObject^.ArrayData^.Items^[FIndex] := Result; Inc(FIndex); end; @@ -2164,12 +2164,12 @@ end; {$WARNINGS OFF} function TArrayStackItem.CreateInnerBuffer(const ADataType: TDataType): PDataBuffer; begin - raise EBinaryFormatterException.Create('Array do not support "inner value" feature.'); + raise EBinaryFormatterException.CreateFmt(SERR_InsupportedOperation,['TArrayStackItem.CreateInnerBuffer']); end; function TArrayStackItem.GetInnerBuffer(): PDataBuffer; begin - raise EBinaryFormatterException.Create('Array do not support "inner value" feature.'); + raise EBinaryFormatterException.CreateFmt(SERR_InsupportedOperation,['TArrayStackItem.GetInnerBuffer']); end; {$WARNINGS ON} diff --git a/wst/trunk/base_json_formatter.pas b/wst/trunk/base_json_formatter.pas index 4738f590b..5b373a78f 100644 --- a/wst/trunk/base_json_formatter.pas +++ b/wst/trunk/base_json_formatter.pas @@ -429,7 +429,8 @@ type implementation -uses jsonparser, imp_utils; +uses + jsonparser, imp_utils, wst_consts; { TJsonRpcBaseFormatter } @@ -442,7 +443,7 @@ end; procedure TJsonRpcBaseFormatter.CheckScope(); begin if not HasScope() then - Error('There is no scope.'); + Error(SERR_NoScope); end; procedure TJsonRpcBaseFormatter.ClearStack(); @@ -865,12 +866,12 @@ var locObj : TJSONData; begin if ( Length(ABounds) < 2 ) then - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); i := ABounds[0]; j := ABounds[1]; k := ( j - i + 1 ); if ( k < 0 ) then - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); if HasScope() then locObj := StackTop().CreateArrayBuffer(AName) else @@ -883,7 +884,7 @@ var stkItem : TStackItem; begin if not FStack.AtLeast(2) then - Error('The root object cannot be NIL.'); + Error(SERR_RootObjectCannotBeNIL); stkItem := PopStack(); try PushStack(StackTop().NilItem(stkItem.ScopeObject),stNilScope); @@ -918,7 +919,7 @@ begin stk := StackTop(); locNode := stk.FindNode(AScopeName); if not Assigned(locNode) then begin - Error('Scope not found : "%s"',[AScopeName]); + Error(SERR_ScopeNotFound,[AScopeName]); end; case locNode.JSONType() of jtObject : PushStack(locNode,stObject); diff --git a/wst/trunk/base_service_intf.pas b/wst/trunk/base_service_intf.pas index 0ccc0bfc2..5f98cd55e 100644 --- a/wst/trunk/base_service_intf.pas +++ b/wst/trunk/base_service_intf.pas @@ -1853,10 +1853,10 @@ begin if Assigned(recordData) then begin recordData.GetField(AField)^.Visible := AVisibility; end else begin - raise EServiceConfigException.CreateFmt('Record extended RTTI informations not found in type registry : "%s".',[ATypeInfo^.Name]); + raise EServiceConfigException.CreateFmt(SERR_RecordExtendedRttiNotFound,[ATypeInfo^.Name]); end; end else begin - raise EServiceConfigException.Create('Invalid parameters.'); + raise EServiceConfigException.Create(SERR_InvalidParameters); end; end; @@ -1891,7 +1891,7 @@ begin end; end; if not ok then - raise EServiceConfigException.Create('Invalid parameters.'); + raise EServiceConfigException.Create(SERR_InvalidParameters); end; {$IFDEF FPC} @@ -2786,7 +2786,7 @@ end; constructor TSimpleItemFactory.Create(AItemClass: TSimpleFactoryItemClass); begin if not Assigned(AItemClass) then - raise EServiceConfigException.CreateFmt('Invalid parameter : %s; Procedure = %s',['AItemClass','TSimpleItemFactory.Create()']); + raise EServiceConfigException.CreateFmt(SERR_InvalidParameterProc,['AItemClass','TSimpleItemFactory.Create()']); FItemClass := AItemClass; end; @@ -2806,7 +2806,7 @@ begin FreeAndNil(FPool); if AValue then begin if ( PoolMin < 0 ) or ( PoolMin > PoolMax ) or ( PoolMax < 1 ) then - raise EServiceException.Create('Invalid pool parametters.'); + raise EServiceException.CreateFmt(SERR_InvalidPoolParametersArgs,[PoolMin,PoolMax]); PreparePool(); end; FPooled := AValue; @@ -2817,7 +2817,7 @@ begin if ( FPoolMax = AValue ) then Exit; if Pooled then - raise EServiceException.Create('Operation not allowed on an active pool.'); + raise EServiceException.Create(SERR_OperationNotAllowedOnActivePool); FPoolMax := AValue; end; @@ -2826,7 +2826,7 @@ begin if ( FPoolMin = AValue ) then Exit; if Pooled then - raise EServiceException.Create('Operation not allowed on an active pool.'); + raise EServiceException.Create(SERR_OperationNotAllowedOnActivePool); FPoolMin := AValue; end; @@ -3241,7 +3241,7 @@ begin If ( i > -1 ) Then Result := FList[i] as TTypeRegistryItem Else - Raise ETypeRegistryException.CreateFmt('Type not registered : %s',[Index^.Name]) + Raise ETypeRegistryException.CreateFmt(SERR_TypeNotRegistered,[Index^.Name]) end; constructor TTypeRegistry.Create(); @@ -3281,7 +3281,7 @@ begin If ( Result = -1 ) Then Result := FList.Add(AItem) Else - Raise ETypeRegistryException.CreateFmt('Type already registered : "%s"',[AItem.DataType^.Name]); + Raise ETypeRegistryException.CreateFmt(SERR_TypeNotRegistered,[AItem.DataType^.Name]); end; function TTypeRegistry.Register( @@ -3506,7 +3506,7 @@ end; procedure TArrayOfStringRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -3840,7 +3840,7 @@ end; procedure TBaseArrayRemotable.CheckIndex(const AIndex : Integer); begin if ( AIndex < 0 ) or ( AIndex >= Length ) then - raise EServiceException.CreateFmt('Index out of bound : %d',[AIndex]); + raise EServiceException.CreateFmt(SERR_IndexOutOfBound,[AIndex]); end; destructor TBaseArrayRemotable.Destroy(); @@ -3890,7 +3890,7 @@ end; procedure TArrayOfBooleanRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -3954,7 +3954,7 @@ end; procedure TArrayOfInt8URemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4018,7 +4018,7 @@ end; procedure TArrayOfInt8SRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4082,7 +4082,7 @@ end; procedure TArrayOfInt16SRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4146,7 +4146,7 @@ end; procedure TArrayOfInt16URemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4210,7 +4210,7 @@ end; procedure TArrayOfInt32URemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4274,7 +4274,7 @@ end; procedure TArrayOfInt32SRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4338,7 +4338,7 @@ end; procedure TArrayOfInt64SRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4402,7 +4402,7 @@ end; procedure TArrayOfInt64URemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4466,7 +4466,7 @@ end; procedure TArrayOfFloatSingleRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4530,7 +4530,7 @@ end; procedure TArrayOfFloatDoubleRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4594,7 +4594,7 @@ end; procedure TArrayOfFloatExtendedRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -4658,7 +4658,7 @@ end; procedure TArrayOfFloatCurrencyRemotable.SetLength(const ANewSize: Integer); begin if ( ANewSize < 0 ) then - raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); + raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]); System.SetLength(FData,ANewSize); end; @@ -5991,7 +5991,7 @@ var i : PtrInt; begin if not ( ( AMin >= 0 ) and ( AMax >= AMin ) and ( AFactory <> nil ) ) then - raise Exception.CreateFmt('Invalid pool arguments Min = %d; Max = %d .',[AMin,AMax]); + raise Exception.CreateFmt(SERR_InvalidPoolParametersArgs,[AMin,AMax]); FMax := AMax; FMin := AMin; FFactory := AFactory; @@ -6028,7 +6028,7 @@ begin Result := CreateNew(True).Intf; end; end else begin - raise EServiceException.Create('Unable to create the object : Timeout expired.'); + raise EServiceException.Create(SERRE_ObjectCreationTimeOut); end; end; @@ -6159,7 +6159,7 @@ begin end; typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo]; typDataObj := typRegItem.GetObject(FIELDS_STRING); - Assert(Assigned(typDataObj),Format('Incomplete type registration for the type of this parameter : %s',[AName])); + Assert(Assigned(typDataObj),Format(SERR_IncompleteParamTypeRegistration,[AName])); typData := PRecordTypeData((typDataObj as TDataObject).Data); Assert(Assigned(typData)); if ( typData^.FieldCount > 0 ) then begin @@ -6261,7 +6261,7 @@ begin Exit; typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo]; typDataObj := typRegItem.GetObject(FIELDS_STRING); - Assert(Assigned(typDataObj),Format('Incomplete type registration for the type of this parameter : %s',[AName])); + Assert(Assigned(typDataObj),Format(SERR_IncompleteParamTypeRegistration,[AName])); typData := PRecordTypeData((typDataObj as TDataObject).Data); Assert(Assigned(typData)); if ( not Assigned(ARecord) ) then begin diff --git a/wst/trunk/base_soap_formatter.pas b/wst/trunk/base_soap_formatter.pas index 739128951..58117a271 100644 --- a/wst/trunk/base_soap_formatter.pas +++ b/wst/trunk/base_soap_formatter.pas @@ -459,13 +459,16 @@ type function BoolToSoapBool(const AValue : Boolean) : string;{$IFDEF USE_INLINE}inline;{$ENDIF} -resourcestring - SERR_NodeNotFoundByID = 'Node not found with this ID in the document : %s.'; - SERR_ExpectingRemotableObjectClass = 'Expecting remotable object class but found %s.'; - + implementation -Uses {$IFDEF WST_DELPHI}XMLDoc,XMLIntf,{$ELSE}XMLWrite, XMLRead,wst_fpc_xml,{$ENDIF} - StrUtils, imp_utils; +uses +{$IFDEF WST_DELPHI} + XMLDoc,XMLIntf, +{$ENDIF WST_DELPHI} +{$IFDEF FPC} + XMLWrite, XMLRead,wst_fpc_xml, +{$ENDIF FPC} + StrUtils, imp_utils, wst_consts; function BoolToSoapBool(const AValue : Boolean) : string; @@ -538,7 +541,7 @@ end; function TStackItem.EndEmbeddedScope(): Integer; begin if ( FEmbeddedScopeCount < 1 ) then begin - raise Exception.Create('Invalid opération on scope, their are no embedded scope.'); + raise Exception.Create(SERR_InvalidEmbeddedScopeOperation); end; Dec(FEmbeddedScopeCount); Result := FEmbeddedScopeCount; @@ -811,7 +814,7 @@ end; procedure TSOAPBaseFormatter.CheckScope(); begin If Not HasScope() Then - Error('There is no scope.'); + Error(SERR_NoScope); end; function ExtractNameSpaceShortName(const ANameSpaceDeclaration : string):string; @@ -1316,7 +1319,7 @@ Var begin typData := GetTypeRegistry().Find(ATypeInfo,False); If Not Assigned(typData) Then - Error('Object type not registered : %s',[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); + Error(SERR_TypeNotRegistered,[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); mustAddAtt := False; if ( ATypeInfo^.Kind = tkClass ) and GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and @@ -1374,17 +1377,17 @@ Var xsiNmspcSH : string; begin if ( Length(ABounds) < 2 ) then begin - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); end; i := ABounds[0]; j := ABounds[1]; k := j - i + 1; if ( k < 0 ) then begin - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); end; typData := GetTypeRegistry().Find(ATypeInfo,False); if not Assigned(typData) then begin - Error('Array type not registered.'); + Error(SERR_TypeNotRegistered,[ATypeInfo^.Name]); end; nmspc := typData.NameSpace; if IsStrEmpty(nmspc) then begin @@ -1526,7 +1529,7 @@ begin if ( Style = Document ) then begin typData := GetTypeRegistry().Find(ATypeInfo,False); if not Assigned(typData) then begin - Error('Object type not registered : %s',[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); + Error(SERR_TypeNotRegistered,[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); end; if ( ATypeInfo^.Kind = tkClass ) and GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and @@ -1948,7 +1951,7 @@ begin {$ENDIF WST_UNICODESTRING} tkClass : begin - raise ESOAPException.Create('Inner Scope value must be a "simple type" value.'); + raise ESOAPException.Create(SERR_InnerScopeMustBeSimpleType); end; {$IFDEF FPC} tkBool : @@ -2209,7 +2212,7 @@ begin {$ENDIF WST_UNICODESTRING} tkClass : begin - raise ESOAPException.Create('Inner Scope value must be a "simple type" value.'); + raise ESOAPException.Create(SERR_InnerScopeMustBeSimpleType); end; {$IFDEF FPC} tkBool : diff --git a/wst/trunk/base_xmlrpc_formatter.pas b/wst/trunk/base_xmlrpc_formatter.pas index 560629726..714bea501 100644 --- a/wst/trunk/base_xmlrpc_formatter.pas +++ b/wst/trunk/base_xmlrpc_formatter.pas @@ -839,7 +839,7 @@ end; procedure TXmlRpcBaseFormatter.CheckScope(); begin If Not HasScope() Then - Error('There is no scope.'); + Error(SERR_NoScope); end; function TXmlRpcBaseFormatter.InternalPutData( @@ -1286,13 +1286,13 @@ var i,j, k : Integer; begin if ( Length(ABounds) < 2 ) then begin - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); end; i := ABounds[0]; j := ABounds[1]; k := j - i + 1; if ( k < 0 ) then begin - Error('Invalid array bounds.'); + Error(SERR_InvalidArrayBounds); end; BeginScope(AName,'','',stArray,AStyle); @@ -1579,7 +1579,7 @@ begin {$ENDIF WST_UNICODESTRING} tkClass : begin - raise EXmlRpcException.Create('Inner Scope value must be a "simple type" value.'); + raise EXmlRpcException.Create(SERR_InnerScopeMustBeSimpleType); end; {$IFDEF FPC} tkBool : @@ -1847,7 +1847,7 @@ begin {$ENDIF WST_UNICODESTRING} tkClass : begin - raise EXmlRpcException.Create('Inner Scope value must be a "simple type" value.'); + raise EXmlRpcException.Create(SERR_InnerScopeMustBeSimpleType); end; {$IFDEF FPC} tkBool : diff --git a/wst/trunk/basex_encode.pas b/wst/trunk/basex_encode.pas index 69eab9e8d..708ed4145 100644 --- a/wst/trunk/basex_encode.pas +++ b/wst/trunk/basex_encode.pas @@ -41,12 +41,10 @@ type ) : Integer;overload; function Base16Decode(const AInBuffer : string; const AOptions : TBaseXOptions) : TByteDynArray;overload; -resourcestring - s_InvalidEncodedData = 'Invalid encoded data.'; - s_IllegalChar = 'Illegal character for that encoding : %s.'; - s_UnexpectedEndOfData = 'Unexpected end of data.'; implementation +uses + wst_consts; const Base64_CHAR_TABLE : array[0..63] of char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; @@ -177,11 +175,11 @@ begin Break; end else begin if locFailOnIllegalChar then - raise EBase64Exception.Create(s_InvalidEncodedData); + raise EBase64Exception.Create(SERR_InvalidEncodedData); end; end; if ( not ok ) and locFailOnIllegalChar then - raise EBase64Exception.CreateFmt(s_IllegalChar,[Char(locBuffer^)]); + raise EBase64Exception.CreateFmt(SERR_IllegalChar,[Char(locBuffer^)]); end; if ( locReadedValidChars > 0 ) then begin locOutQuantom[0] := ( locInQuantom[0] shl 2 ) or ( locInQuantom[1] shr 4 ); @@ -287,13 +285,13 @@ begin else begin if locFailOnIllegalChar then - raise EBase16Exception.Create(s_IllegalChar); + raise EBase16Exception.Create(SERR_UnexpectedEndOfData); end; end; Inc(hp); end; if ( hp^ = #0 ) then - raise EBase16Exception.Create(s_UnexpectedEndOfData); + raise EBase16Exception.Create(SERR_UnexpectedEndOfData); Inc(hp); while ( hp^ <> #0 ) do begin case hp^ of @@ -315,13 +313,13 @@ begin else begin if locFailOnIllegalChar then - raise EBase16Exception.Create(s_IllegalChar); + raise EBase16Exception.CreateFmt(SERR_IllegalChar,[hp^]); end; end; Inc(hp); end; if ( hp^ = #0 ) then - raise EBase16Exception.Create(s_UnexpectedEndOfData); + raise EBase16Exception.Create(SERR_UnexpectedEndOfData); Inc(hp); Inc(bp); end; diff --git a/wst/trunk/record_rtti.pas b/wst/trunk/record_rtti.pas index f5f2ebbfd..ab08c0c17 100644 --- a/wst/trunk/record_rtti.pas +++ b/wst/trunk/record_rtti.pas @@ -66,7 +66,8 @@ type procedure finalize_record_rtti(); implementation -uses Classes, imp_utils; +uses + Classes, imp_utils, wst_consts; {$IFDEF WST_RECORD_RTTI} @@ -336,7 +337,7 @@ function TRecordRttiDataObject.GetField(const AFieldName : shortstring) : PRecor begin Result := FindField(AFieldName); if ( Result = nil ) then - raise Exception.CreateFmt('"%s" is not a field of "%s".',[AFieldName,GetRecordTypeData()^.Name]); + raise Exception.CreateFmt(SERR_IsNotAFieldOf,[AFieldName,GetRecordTypeData()^.Name]); end; procedure initialize_record_rtti(); diff --git a/wst/trunk/server_service_intf.pas b/wst/trunk/server_service_intf.pas index b53181f81..ea2678a4f 100644 --- a/wst/trunk/server_service_intf.pas +++ b/wst/trunk/server_service_intf.pas @@ -216,6 +216,9 @@ type procedure finalize_server_services_intf(); implementation +uses + wst_consts; + Var FormatterRegistryInst : IFormatterRegistry = Nil; ServerServiceRegistryInst : IServerServiceRegistry = Nil; @@ -240,7 +243,7 @@ Begin svcName := ARequestBuffer.GetTargetService(); s := sr.Find(svcName); If Not Assigned(s) Then - Raise EServiceException.CreateFmt('Service not found : "%s"',[svcName]); + Raise EServiceException.CreateFmt(SERR_ServiceNotFound,[svcName]); s.HandleRequest(ARequestBuffer); End; @@ -479,7 +482,7 @@ begin msgFormat := Copy(s,1,j); f := GetFormatterRegistry().Find(msgFormat) as IFormatterResponse; if not Assigned(f) then - Error('No formatter for that content type : "%s"',[s]); + Error(SERR_NoSerializerFoThisType,[s]); try cllCtx := CreateCallContext(); cllCtx.GetPropertyManager().Copy(ARequestBuffer.GetPropertyManager(),False); @@ -491,7 +494,7 @@ begin s := f.GetCallProcedureName(); m := FindVerbHandler(s); if not Assigned(m) then - Error('No handler for that verb : "%s"',[s]); + Error(SERR_NoHandlerForThatVerb,[s]); m(f,cllCtx); for i := 0 to Pred(cllCtx.GetHeaderCount(AllHeaderDirection)) do begin hdr := cllCtx.GetHeader(i); @@ -501,7 +504,7 @@ begin s := typRegItm.DeclaredName else s := hdr.ClassName; - Error('Header "%s" not Understood.',[s]); + Error(SERR_HeaderNotUnderstood,[s]); end; end; except diff --git a/wst/trunk/ws_helper/pascal_parser_intf.pas b/wst/trunk/ws_helper/pascal_parser_intf.pas index 39c842abd..1a790fd52 100644 --- a/wst/trunk/ws_helper/pascal_parser_intf.pas +++ b/wst/trunk/ws_helper/pascal_parser_intf.pas @@ -208,7 +208,8 @@ type function CreateWstInterfaceSymbolTable(AContainer : TwstPasTreeContainer) : TPasModule; implementation -uses parserutils, wst_types; +uses + parserutils, wst_types, wst_consts; const SIMPLE_TYPES_COUNT = 14; @@ -559,7 +560,7 @@ function MakeInternalSymbolNameFrom(const AName : string) : string ; begin Result := ExtractIdentifier(AName); if IsStrEmpty(AName) then begin - raise ESymbolException.CreateFmt('Unable to make an internal symbol Name from "%s".',[AName]); + raise ESymbolException.CreateFmt(SERR_CannotMakeInternalSymbolName,[AName]); end; if IsReservedKeyWord(Result) then begin Result := '_' + Result; @@ -830,7 +831,7 @@ function TwstPasTreeContainer.AddBinding(const AName : string; AIntf : TPasClass begin Result := FindBinding(AName); if Assigned(Result) then begin - raise Exception.CreateFmt('Duplicated binding : "%s"',[AName]); + raise Exception.CreateFmt(SERR_DuplicateBindingName,[AName]); end; Result := TwstBinding.Create(AName, AIntf, AIntf.Parent); FBindingList.Add(Result); diff --git a/wst/trunk/ws_helper/ws_parser_imp.pas b/wst/trunk/ws_helper/ws_parser_imp.pas index 331033507..fe46ed631 100644 --- a/wst/trunk/ws_helper/ws_parser_imp.pas +++ b/wst/trunk/ws_helper/ws_parser_imp.pas @@ -170,11 +170,10 @@ type function Parse():TPasType;override; end; -resourcestring - SResolveError = 'Unable to resolve this namespace : "%s".'; implementation -uses dom_cursors, parserutils, StrUtils, xsd_consts; +uses + dom_cursors, parserutils, StrUtils, xsd_consts, wst_consts; { TAbstractTypeParser } @@ -310,7 +309,7 @@ begin locNS := ANameSpace end else begin if not FContext.FindNameSpace(ANameSpace,locNS) then - raise EXsdParserAssertException.CreateFmt(SResolveError,[ANameSpace]); + raise EXsdParserAssertException.CreateFmt(SERR_CannotResolveNamespace,[ANameSpace]); end; Result := FSymbols.FindElementNS(ALocalName,locNS); end; @@ -1454,7 +1453,7 @@ begin if Assigned(tmpNode) then begin ExplodeQName(tmpNode.NodeValue,FBaseName,spaceShort); if not FContext.FindNameSpace(spaceShort,FBaseNameSpace) then - raise EXsdParserAssertException.CreateFmt(SResolveError,[spaceShort]); + raise EXsdParserAssertException.CreateFmt(SERR_CannotResolveNamespace,[spaceShort]); end; locCrs := CreateChildrenCursor(FRestrictionNode,cetRttiNode) as IObjectCursor; if Assigned(locCrs) then begin diff --git a/wst/trunk/wst_consts.pas b/wst/trunk/wst_consts.pas index 16d99498f..b2b790f44 100644 --- a/wst/trunk/wst_consts.pas +++ b/wst/trunk/wst_consts.pas @@ -16,18 +16,46 @@ unit wst_consts; interface -resourcestring +resourcestring + SERR_CannotMakeInternalSymbolName ='Unable to make an internal symbol Name from "%s".'; + SERR_CannotResolveNamespace = 'Unable to resolve this namespace : "%s".'; + SERR_DuplicateBindingName = 'Duplicated binding : "%s".'; + SERR_ExpectingRemotableObjectClass = 'Expecting remotable object class but found "%s".'; + SERR_HeaderNotUnderstood = 'Header "%s" not Understood.'; + SERR_IllegalChar = 'Illegal character for that encoding : "%s".'; + SERR_IndexOutOfBound = 'Index out of bound : %d.'; + SERR_IncompleteParamTypeRegistration = 'Incomplete type registration for the type of this parameter : "%s".'; + SERR_InnerScopeMustBeSimpleType = 'Inner Scope value must be a "simple type" value.'; SERR_InsupportedOperation = 'Insupported operation : "%s".'; + SERR_InvalidArrayBounds = 'Invalid array bounds.'; SERR_InvalidArrayLength = 'Invalid array length : %d.'; SERR_InvalidCollectionLength = 'Invalid collection length : %d.'; + SERR_InvalidDataTypeInContext = 'Invalid data type in this context : "%s".'; + SERR_InvalidEncodedData = 'Invalid encoded data.'; SERR_InvalidHourOffetValue = '"%d" is not a valid hour offset value.'; SERR_InvalidMinuteOffetValue = '"%d" is not a valid minute offset value.'; + SERR_InvalidEmbeddedScopeOperation = 'Invalid opĂ©ration on scope, their are no embedded scope.'; SERR_InvalidParameter = 'Invalid parameter : "%s".'; + SERR_InvalidParameterProc = 'Invalid parameter : "%s"; Procedure = "%s".'; + SERR_InvalidParameters = 'Invalid parameters.'; + SERR_InvalidPoolParametersArgs = 'Invalid pool arguments Min = %d; Max = %d .'; + SERR_IsNotAFieldOf = '"%s" is not a field of "%s".'; + SERR_NodeNotFoundByID = 'Node not found with this ID in the document : "%s".'; + SERR_NoHandlerForThatVerb = 'No handler for that verb : "%s".'; SERR_NoReaderProc = 'No reader proc for that type, Prop : "(%s : %s)".'; + SERR_NoScope = 'There is no scope.'; SERR_NoSerializerFoThisType = 'No serializer for this type : "%s".'; + SERRE_ObjectCreationTimeOut = 'Unable to create the object : Timeout expired.'; + SERR_OperationNotAllowedOnActivePool = 'Operation not allowed on an active pool.'; SERR_ParamaterNotFound = 'Parameter non found : "%s".'; + SERR_RecordExtendedRttiNotFound = 'Record extended RTTI informations not found in type registry : "%s".'; + SERR_RootObjectCannotBeNIL = 'The root object cannot be NIL.'; SERR_SerializerInitializationException = 'Unable to initialize the serializer of that type : "%s".'; - + SERR_ServiceNotFound = 'Service not found : "%s".'; + SERR_ScopeNotFound = 'Scope not found : "%s".'; + SERR_TypeNotRegistered = 'Type not registered : "%s".'; + SERR_UnexpectedEndOfData = 'Unexpected end of data.'; + implementation end.