Browse Source

* Remove conditional code for compiling googleapiconv with v2.6.4 on i386

(restbase.pp)
  - Remove {$ifdef ver2_6} directives and associated code
  - Remove {$ifndef ver2_6} directives (but keep code)

(googleapiconv.pp)
  - Remove {$ifdef ver2_6} directives and associated code
  - Remove synapse defines and associated code line

(googlediscoverytopas.pp)
  - Remove {$ifdef ver2_6} directives and associated code
wsherman 2 years ago
parent
commit
b56ebfa93d

+ 0 - 21
packages/fcl-web/src/base/restbase.pp

@@ -64,13 +64,6 @@ Type
     procedure SetObjectOptions(AValue: TObjectOptions);
     procedure SetObjectOptions(AValue: TObjectOptions);
     Function GetAdditionalProperties : TJSONObject;
     Function GetAdditionalProperties : TJSONObject;
   protected
   protected
-{$ifdef ver2_6}
-    // Version 2.6.4 has a bug for i386 where the array cannot be set through RTTI.
-    // This is a helper method that sets the length of the array to the desired length,
-    // After which the new array pointer is read again.
-    // AName is guaranteed to be lowercase
-    Procedure SetArrayLength(const AName : String; ALength : Longint); virtual;
-{$endif}
     Procedure MarkPropertyChanged(AIndex : Integer);
     Procedure MarkPropertyChanged(AIndex : Integer);
     Function IsDateTimeProp(Info : PTypeInfo) : Boolean;
     Function IsDateTimeProp(Info : PTypeInfo) : Boolean;
     Function DateTimePropType(Info : PTypeInfo) : TDateTimeType;
     Function DateTimePropType(Info : PTypeInfo) : TDateTimeType;
@@ -79,9 +72,7 @@ Type
     Procedure SetBooleanProperty(P: PPropInfo; AValue: Boolean); virtual;
     Procedure SetBooleanProperty(P: PPropInfo; AValue: Boolean); virtual;
     Procedure SetFloatProperty(P: PPropInfo; AValue: Extended); virtual;
     Procedure SetFloatProperty(P: PPropInfo; AValue: Extended); virtual;
     Procedure SetInt64Property(P: PPropInfo; AValue: Int64); virtual;
     Procedure SetInt64Property(P: PPropInfo; AValue: Int64); virtual;
-    {$ifndef ver2_6}
     Procedure SetQWordProperty(P: PPropInfo; AValue: QWord); virtual;
     Procedure SetQWordProperty(P: PPropInfo; AValue: QWord); virtual;
-    {$endif}
     Procedure SetIntegerProperty(P: PPropInfo; AValue: Integer); virtual;
     Procedure SetIntegerProperty(P: PPropInfo; AValue: Integer); virtual;
     Procedure SetStringProperty(P: PPropInfo; AValue: String); virtual;
     Procedure SetStringProperty(P: PPropInfo; AValue: String); virtual;
     Procedure SetArrayProperty(P: PPropInfo; AValue : TJSONArray); virtual;
     Procedure SetArrayProperty(P: PPropInfo; AValue : TJSONArray); virtual;
@@ -658,13 +649,11 @@ begin
   SetInt64Prop(Self,P,AValue);
   SetInt64Prop(Self,P,AValue);
 end;
 end;
 
 
-{$ifndef ver2_6}
 procedure TBaseObject.SetQWordProperty(P: PPropInfo; AValue: QWord);
 procedure TBaseObject.SetQWordProperty(P: PPropInfo; AValue: QWord);
 
 
 begin
 begin
   SetInt64Prop(Self,P,Int64(AValue));
   SetInt64Prop(Self,P,Int64(AValue));
 end;
 end;
-{$endif}
 
 
 procedure TBaseObject.SetStringProperty(P: PPropInfo; AValue: String);
 procedure TBaseObject.SetStringProperty(P: PPropInfo; AValue: String);
 Var
 Var
@@ -1216,13 +1205,6 @@ begin
   Result:=fAdditionalProperties
   Result:=fAdditionalProperties
 end;
 end;
 
 
-{$IFDEF VER2_6}
-procedure TBaseObject.SetArrayLength(Const AName: String; ALength: Longint);
-begin
-  Raise ERestAPI.CreateFmt('Unknown Array %s',[AName]);
-end;
-{$ENDIF}
-
 class function TBaseObject.AllowAdditionalProperties: Boolean;
 class function TBaseObject.AllowAdditionalProperties: Boolean;
 begin
 begin
   Result:=False;
   Result:=False;
@@ -1331,9 +1313,7 @@ begin
           ntFloat   : SetFloatProperty(P,JSON.asFloat);
           ntFloat   : SetFloatProperty(P,JSON.asFloat);
           ntInteger : SetIntegerProperty(P,JSON.asInteger);
           ntInteger : SetIntegerProperty(P,JSON.asInteger);
           ntInt64   : SetInt64Property(P,JSON.asInt64);
           ntInt64   : SetInt64Property(P,JSON.asInt64);
-{$ifndef ver2_6}
           ntqword   : SetQWordProperty(P,JSON.asQWord);
           ntqword   : SetQWordProperty(P,JSON.asQWord);
-{$endif}
         end;
         end;
       jtNull    : ClearProperty(P);
       jtNull    : ClearProperty(P);
       jtBoolean : SetBooleanProperty(P,json.AsBoolean);
       jtBoolean : SetBooleanProperty(P,json.AsBoolean);
@@ -1428,4 +1408,3 @@ finalization
 {$ENDIF}
 {$ENDIF}
   FreeAndNil(Fact);
   FreeAndNil(Fact);
 end.
 end.
-

+ 0 - 14
packages/googleapi/generator/googleapiconv.pp

@@ -3,20 +3,11 @@
 
 
 { $DEFINE USESYNAPSE}
 { $DEFINE USESYNAPSE}
 
 
-{$IFDEF VER2_6}
-{$DEFINE USESYNAPSE}
-{$ENDIF}
-
 program googleapiconv;
 program googleapiconv;
 
 
 uses
 uses
   custapp, classes, sysutils, fpjson, jsonparser, fpwebclient,
   custapp, classes, sysutils, fpjson, jsonparser, fpwebclient,
-{$IFDEF USESYNAPSE}
-  ssl_openssl,
-  synapsewebclient,
-{$ELSE}
   fphttpwebclient, opensslsockets,
   fphttpwebclient, opensslsockets,
-{$ENDIF}
   googlediscoverytopas, googleservice, restbase, pascodegen, restcodegen;
   googlediscoverytopas, googleservice, restbase, pascodegen, restcodegen;
 
 
 Const
 Const
@@ -116,11 +107,7 @@ begin
   Result:=True;
   Result:=True;
   Req:=Nil;
   Req:=Nil;
   Resp:=Nil;
   Resp:=Nil;
-{$IFDEF USESYNAPSE}
-  WebClient:=TSynapseWebClient.Create(Self);
-{$ELSE}
   WebClient:=TFPHTTPWebClient.Create(Self);
   WebClient:=TFPHTTPWebClient.Create(Self);
-{$ENDIF}
   try
   try
     Req:=WebClient.CreateRequest;
     Req:=WebClient.CreateRequest;
     Req.ResponseContent:=Response;
     Req.ResponseContent:=Response;
@@ -608,4 +595,3 @@ begin
   Application.Run;
   Application.Run;
   FreeAndNil(Application);  //gets rid of memory leak and makes Heaptrc happy
   FreeAndNil(Application);  //gets rid of memory leak and makes Heaptrc happy
 end.
 end.
-

+ 1 - 133
packages/googleapi/generator/googlediscoverytopas.pp

@@ -63,10 +63,6 @@ Type
   TGoogleAuth2 = Class(TGoogleBaseObject)
   TGoogleAuth2 = Class(TGoogleBaseObject)
   private
   private
     FScopes: TSchemas;
     FScopes: TSchemas;
-  Protected
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
   Published
   Published
     Property Scopes : TSchemas Read Fscopes Write Fscopes;
     Property Scopes : TSchemas Read Fscopes Write Fscopes;
   end;
   end;
@@ -91,10 +87,6 @@ Type
   TAnnotations = Class(TGoogleBaseObject)
   TAnnotations = Class(TGoogleBaseObject)
   private
   private
     FRequired: TStringArray;
     FRequired: TStringArray;
-  Protected
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
   Published
   Published
     Property required : TStringArray Read FRequired Write Frequired;
     Property required : TStringArray Read FRequired Write Frequired;
   end;
   end;
@@ -144,9 +136,6 @@ Type
   Public
   Public
     Class function BaseType(ATypeName: String): Boolean;
     Class function BaseType(ATypeName: String): Boolean;
     Class function GetBaseTypeName(AType,AFormat : String) : string;
     Class function GetBaseTypeName(AType,AFormat : String) : string;
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
     Function DebugName : String;
     Function DebugName : String;
     function GetBaseTypeName : string;
     function GetBaseTypeName : string;
     Function BaseType : Boolean;
     Function BaseType : Boolean;
@@ -228,10 +217,6 @@ Type
     FAccept: TStringArray;
     FAccept: TStringArray;
     FMaxSize: String;
     FMaxSize: String;
     Fprotocols: TMediaUploadProtocols;
     Fprotocols: TMediaUploadProtocols;
-  protected
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
   Published
   Published
     Property Accept : TStringArray Read FAccept Write FAccept;
     Property Accept : TStringArray Read FAccept Write FAccept;
     property MaxSize : String Read FMaxSize Write FMaxSize;
     property MaxSize : String Read FMaxSize Write FMaxSize;
@@ -294,10 +279,6 @@ Type
     FsupportsMediaDownload: Boolean;
     FsupportsMediaDownload: Boolean;
     FsupportsMediaUpload: Boolean;
     FsupportsMediaUpload: Boolean;
     FsupportsSubscription: Boolean;
     FsupportsSubscription: Boolean;
-  protected
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
   Published
   Published
     Property name : string read fname Write fname;
     Property name : string read fname Write fname;
     Property description : String Read FDescription Write FDescription;
     Property description : String Read FDescription Write FDescription;
@@ -349,11 +330,6 @@ Type
     fservicePath: string;
     fservicePath: string;
     FTitle: string;
     FTitle: string;
     Fversion: String;
     Fversion: String;
-  Protected
-{$ifdef ver2_6}
-    Procedure SetArrayLength(const AName : String; ALength : Longint); override;
-{$endif}
-  Public
   Published
   Published
     property Auth : TGoogleAuth Read Fauth Write Fauth;
     property Auth : TGoogleAuth Read Fauth Write Fauth;
     property basePath : string read fbasePath write FbasePath;
     property basePath : string read fbasePath write FbasePath;
@@ -510,71 +486,6 @@ Type
 
 
 implementation
 implementation
 
 
-{ TGoogleRestDescription }
-
-{$IFDEF VER_2_6}
-Procedure TGoogleRestDescription.SetArrayLength(const AName: String;
-  ALength: Longint);
-begin
-  case aname of
-    'schemas' : setlength(FSchemas,ALength);
-    'features' : setlength(FFeatures,ALength);
-    'labels' : setlength(FLabels,ALength);
-    'methods' : setlength(Fmethods,ALength);
-    'resources' : setlength(FResources,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-{$ENDIF}
-
-{ TRestMethod }
-{$ifdef ver2_6}
-Procedure TRestMethod.SetArrayLength(const AName: String; ALength: Longint);
-begin
-  case AName of
-   'parameterorder' : SetLength(FParameterOrder,ALength);
-   'parameters' : SetLength(FParameters,ALength);
-   'scopes' : SetLength(FScopes,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-
-{ TMediaUpload }
-
-Procedure TMediaUpload.SetArrayLength(const AName: String; ALength: Longint);
-begin
-  Case AName of
-    'accept' : SetLength(FAccept,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-
-{ TGoogleAuth2 }
-
-Procedure TGoogleAuth2.SetArrayLength(const AName: String; ALength: Longint);
-begin
-  Case AName of
-    'scopes' : SetLength(FScopes,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-
-{ TAnnotations }
-
-Procedure TAnnotations.SetArrayLength(const AName: String; ALength: Longint);
-begin
-  Case AName of
-    'required' :SetLength(FRequired,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-{$endif}
-
 { TTypeDefEnumerator }
 { TTypeDefEnumerator }
 
 
 function TTypeDefEnumerator.GetCurrent: TTypeDef;
 function TTypeDefEnumerator.GetCurrent: TTypeDef;
@@ -938,20 +849,6 @@ begin
       Result:='String';
       Result:='String';
 end;
 end;
 
 
-{$IFDEF VER2_6}
-Procedure TSchema.SetArrayLength(const AName: String; ALength: Longint);
-begin
-  Case AName of
-   'enumdescriptions' : SetLength(FenumDescriptions,ALength);
-   'properties' : SetLength(FProperties,ALength);
-   'methods' : SetLength(FMethods,ALength);
-   'resources' : SetLength(FResources,ALength);
-  else
-    inherited SetArrayLength(AName, ALength);
-  end;
-end;
-{$ENDIF}
-
 Function TSchema.DebugName: String;
 Function TSchema.DebugName: String;
 begin
 begin
   Result:=sysutils.Format('(Name: %s, Pascal Type : %s, type : %s, Ref: %s)',[Name,TypeName,_type,Ref]);
   Result:=sysutils.Format('(Name: %s, Pascal Type : %s, type : %s, Ref: %s)',[Name,TypeName,_type,Ref]);
@@ -1067,13 +964,6 @@ begin
     tn:=GetPropertyType(AClassName,S);
     tn:=GetPropertyType(AClassName,S);
     AddLn('Procedure Set%s(AIndex : Integer; const AValue : %s); virtual;',[N,tn]);
     AddLn('Procedure Set%s(AIndex : Integer; const AValue : %s); virtual;',[N,tn]);
     end;
     end;
-  if NeedSetArrayLength and not UseListForArray then
-    begin
-    Comment('2.6.4. bug workaround');
-    Addln('{$IFDEF VER2_6}');
-    Addln('Procedure SetArrayLength(Const AName : String; ALength : Longint); override;');
-    Addln('{$ENDIF VER2_6}');
-    end;
   DecIndent;
   DecIndent;
   AddLn('Public');
   AddLn('Public');
   IncIndent;
   IncIndent;
@@ -1145,28 +1035,7 @@ Var
   N : String;
   N : String;
 
 
 begin
 begin
-  Comment('2.6.4. bug workaround');
-  Addln('{$IFDEF VER2_6}');
-  Addln('Procedure %s.SetArrayLength(Const AName : String; ALength : Longint); ',[AClassName]);
-  Addln('');
-  AddLn('begin');
-  IncIndent;
-  AddLn('Case AName of');
-  For S in ASchema.ClassProperties do
-    if (S._type='array') then
-      begin
-      N:=S.PropertyName;
-      AddLn('''%s'' : SetLength(F%s,ALength);',[Lowercase(N),N]);
-      end;
-  AddLn('else');
-  IncIndent;
-  AddLn('Inherited SetArrayLength(AName,ALength);');
-  DecIndent;
-  AddLn('end;');
-  DecIndent;
-  AddLn('end;');
-  Addln('{$ENDIF VER2_6}');
-  Addln('');
+  //not used
 end;
 end;
 
 
 procedure TDiscoveryJSONToPas.CreateExportPropertyName(AClassName: String; ASchema, AItemSchema: TSchema);
 procedure TDiscoveryJSONToPas.CreateExportPropertyName(AClassName: String; ASchema, AItemSchema: TSchema);
@@ -2097,4 +1966,3 @@ end;
 
 
 
 
 end.
 end.
-