diff --git a/DMsgPackHelper.pas b/dmsgpackhelper.pas similarity index 99% rename from DMsgPackHelper.pas rename to dmsgpackhelper.pas index 3f918d4..2782397 100644 --- a/DMsgPackHelper.pas +++ b/dmsgpackhelper.pas @@ -1,5 +1,8 @@ unit DMsgPackHelper; - +{$IFDEF FPC} + {$MODE Delphi} + {$I fpc.inc} +{$ENDIF} interface uses diff --git a/fpc.inc b/fpc.inc new file mode 100644 index 0000000..ddc8ce5 --- /dev/null +++ b/fpc.inc @@ -0,0 +1,3 @@ +{$MACRO ON} +{$define RTLVersion := 25} +{$define CompilerVersion := 18} diff --git a/qdac_msgpackviewTools.7z b/qdac_msgpackviewTools.7z deleted file mode 100644 index b245b74..0000000 Binary files a/qdac_msgpackviewTools.7z and /dev/null differ diff --git a/SimpleMsgPack.pas b/simplemsgpack.pas similarity index 98% rename from SimpleMsgPack.pas rename to simplemsgpack.pas index 90dfa89..ba63613 100644 --- a/SimpleMsgPack.pas +++ b/simplemsgpack.pas @@ -77,8 +77,16 @@ *) +{ + * add free pascal support by cpicanco + 2017-08-29 13:34:00 +} unit SimpleMsgPack; +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + interface uses @@ -87,6 +95,12 @@ interface {$IFDEF MSWINDOWS}, Windows{$ENDIF} ,Variants; +{$IFDEF FPC} + {$I fpc.inc} +type + PBOOLEAN = ^ByteBool; +{$ENDIF} + type {$IF RTLVersion<25} IntPtr=Integer; @@ -330,7 +344,8 @@ TSimpleMsgPack = class(TObject) property AsVariant: Variant read GetAsVariant write SetAsVariant; property AsBytes: TBytes read GetAsBytes write SetAsBytes; - + property Key : string read FName; // for Items only + property Value : string read getAsString; // alias for AsString property O[pvPath: String]: TSimpleMsgPack read GetO write SetO; property S[pvPath: String]: string read GetS write SetS; property I[pvPath: String]: Int64 read GetI write SetI; @@ -2097,6 +2112,20 @@ procedure TSimpleMsgPack.SetAsSingle(const Value: Single); PSingle(FValue)^ := Value; end; +{$IFDEF FPC} +procedure TSimpleMsgPack.setAsString(pvValue: string); +var l : SizeInt; +begin + FDataType := mptString; + if SizeOf(Char) = 2 then + l := Length(pvValue) shl 1 + else + l := Length(pvValue); + SetLength(FValue, l); + if l > 0 then + Move(PChar(pvValue)^, FValue[0], l); +end; +{$ELSE} procedure TSimpleMsgPack.setAsString(pvValue: string); begin FDataType := mptString; @@ -2110,6 +2139,7 @@ procedure TSimpleMsgPack.setAsString(pvValue: string); Move(PChar(pvValue)^, FValue[0], Length(FValue)); end; end; +{$ENDIF} /// /// copy from qdac3