Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
FPC development / Re: Warning: Source OS Redefined!
« Last post by Laksen on Today at 10:41:10 am »
The warning is generated in set_source_info

set_source_info is called from systems/i*.pas to indicate what the cpu+os compiler was built FROM. It should only be called once
For example in i_linux.pas

Code: Pascal  [Select][+][-]
  1. {$ifdef CPUI386}
  2.   {$ifdef linux}
  3.     { some FreeBSD versions define linux as well }
  4.     {$ifndef FreeBSD}
  5.       set_source_info(system_i386_linux_info);
  6.     {$endif FreeBSD}
  7.   {$endif}
  8. {$endif CPUI386}
  9. ...
  10. {$ifdef CPUX86_64}
  11.   {$ifdef linux}
  12.     set_source_info(system_x86_64_linux_info);
  13.   {$endif linux}
  14. {$endif CPUX86_64}
  15. ...
  16.  

linux might be defined, but only one of CPUI386 and CPUX86_64 should be defined. Since you can't build a compiler that runs on both (well it can but it will be built for one ISA or the other)
2
FPC development / Re: Warning: Source OS Redefined!
« Last post by Key-Real on Today at 10:34:21 am »
can you provide more info? pls


I'm porting it to a new target
3
FPC development / Re: Warning: Source OS Redefined!
« Last post by Laksen on Today at 10:28:26 am »
It would indicate that you have a compiler bug, or some messed up compiler defines while rebuilding the compiler. How did you build the compiler?
4
General / Re: Text orientation in TMemo?
« Last post by wp on Today at 10:27:54 am »
you might also notice, that Label2 changes its caption when clicking/dragging on places which are too far from the axises.
Well, a reaction on such clicks is expected when you click on one of the grid lines associated with an axis. You can hide the axis grid, and the click will no longer be assigned to this axis. But I see that it is not always an option to turn off the axis grid, and therefore I just committed a change to the chart axis in which a new property EnabledHitTests (of type TChartHitTests = set of (ahtTitle, ahtLine, ahtLabels, ahtGrid, ahtAxisStart, ahtAxisCenter, ahtAxisEnd) ) is available. When you here remove an element, a click on the corresponding part of the axis will no longer be registered as an axis-click.

In your code:
Code: Pascal  [Select][+][-]
  1. // Note: TAChart from Laz/main 02d8ea0bde or newer required!)
  2.   Chart1.BottomAxis.EnabledHitTests := Chart1.BottomAxis.EnabledHitTests - [ahtGrid];
  3.   Chart1.LeftAxis.EnabledHitTests := Chart1.LeftAxis.EnabledHitTests - [ahtGrid];  
5
FPC development / Warning: Source OS Redefined!
« Last post by Key-Real on Today at 10:20:29 am »
what does this Warning means:

Warning: Source OS Redefined!
6
Third party / Re: InstallAware Using Lazarus IDE
« Last post by marcov on Today at 10:05:26 am »
Would anybody like to look into making Lazarus's cross-platform native code setups using InstallAware?

A single project would compile into Windows, Linux (aarch64 and AMD64), and macOS (Intel and Apple Silicon) targets.

Most installer work is OS specific, and, in the case of FPC/lazarus even the file lists to install are, since there are *nix and windows specific packages, and similarly due to Lazarus' widgetsets.

You can try, but I don't really expect that much from it, nor that it will match the current inno setups.
7
General / Re: Slow copying of small structures
« Last post by Nitorami on Today at 09:43:56 am »
Thank you, that all makes sense.
@Alpine: It is about all operations on small structures where the compiler inserts a REP MOVSL, as in an operator or function, or when copying. Thanks for the hint with the hard types to cheat the compiler, that could be useful. In the matter at hand it won't help because the := operator is still an operator with infix notation, and the compiler will insert its REP MOVSL no matter what (inlining it does not change this).

@marcov: I repeated the test on my ageing budget PC, an AMD A4-5300 APU with Radeon HD Graphics. Here is the result.
The difference between REP MOVSL and VMOVSD is not as grim as on the Intel, but still factor 10. On the old AMD, the REP MOVSL with small chunk sizes is even faster than on my fairly new Intel notebook.
Apart from that, the issues are similar, up to chunk sizes of at least 128 bytes, REP MOVSL is the slowest way to copy structures, and the compiler should avoid it.
8
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on Today at 09:27:34 am »
Hello  ;D

I did a 1:1 copy of @KodeZwerg's test case.
Under Microsoft Windows 11 64-Bit Professional, I get a crash, after the MessageBox at Line:
https://github.com/paule32/Qt_FPC/blob/main/src/tests/fpc_rtl.pas#L70

is reached.
So, something happends - but what ?
9
General / Re: Assign (textfile) not compiling - sometimes.
« Last post by dsiders on Today at 08:51:13 am »
Or use AssignFile and CloseFile procedures from the SysUtils.

Curiously, I don't see those indexed in the RTL documentation.

MarkMLl

None of the procedure or functions in objpas.pp are indexed or generated in the documentation. Probably because they're wrapped with $ifdefs that weren't defined when the docs were built. My guess.

[Edit]
And I just checked... they are present in the FPDoc xml file.
10
General / Re: Text orientation in TMemo?
« Last post by CM630 on Today at 08:41:53 am »
I reproduced it and found a solution that solves the dragging issue, it does not seem to affect the AxisClick behaviour.
A sample code is attached, with the same code, as shown below.
It is as you proposed. If ctMainAxisClick.Toolset:=ctMain; is before ctMainDataPointDrag.Toolset:=ctMain; I cannot drag,
but when I reversed the order of these two lines, I can drag.
But if you run the app, you might also notice, that Label2 changes its caption when clicking/dragging on places which are too far from the axises. Maybe this behaviour is not okay?

Code: Pascal  [Select][+][-]
  1.  
  2.   Chart1.Toolset := ctMain;
  3.   ctMainAxisClick.Toolset:=ctMain;
  4.   ctMainDataPointDrag.Toolset:=ctMain;  
  5.  




The full code of the snippet:
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3.  
  4. {$mode objfpc}{$H+}
  5.  
  6.  
  7. interface
  8.  
  9.  
  10. uses
  11.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, TAGraph,
  12.   TATools, TASeries, TADrawUtils, TACustomSeries, Types, TAChartAxis, TASources, TACustomSource,TAChartUtils;
  13.  
  14.  
  15. type
  16.  
  17.  
  18.   TFloatPoint = Record
  19.     X: Double;
  20.     Y: Double;
  21.   end;
  22.  
  23.  
  24.   TFloatPointArray = array of TFloatPoint;
  25.   { TForm1 }
  26.  
  27.  
  28.   TForm1 = class(TForm)
  29.     Chart1: TChart;
  30.     Chart1LineSeries1: TLineSeries;
  31.     Label1: TLabel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.  
  35.  
  36.     ctMain: TChartToolset;
  37.     ctMainDataPointDrag: TDataPointDragTool;
  38.     ctMainAxisClick: TAxisClickTool;
  39.     procedure ctMainAxisClickToolOnClick(ASender: TChartTool; Axis: TChartAxis; AHitInfo: TChartAxisHitTests);
  40.     procedure ctMainDataPointDragAfterMouseMove(ATool: TChartTool; APoint: TPoint);
  41.     procedure ctMainDataPointDragTool1DragStart(ASender: TDataPointDragTool; var AGraphPoint: TDoublePoint);
  42.     procedure FormCreate(Sender: TObject);
  43.   private
  44.  
  45.  
  46.   public
  47.  
  48.  
  49.   end;
  50.  
  51.  
  52. var
  53.   Form1: TForm1;
  54.  
  55.  
  56. implementation
  57.  
  58.  
  59. {$R *.lfm}
  60.  
  61.  
  62. { TForm1 }
  63.  
  64.  
  65. function GenSin (Frequency: Extended; Amplitude: Extended; SamPerSec:single; Offset: Extended=0; Duration: integer= 1000;PhaseShift:single=0): TFloatPointArray;
  66. var
  67.   i: integer;
  68.   SampleCount: integer;
  69.   dt: double;
  70.   debY: double;
  71. begin
  72.   SampleCount:=trunc(SamPerSec*Duration/1000)+1;
  73.   SetLength(Result,SampleCount);
  74.   dt:=1/SamPerSec;
  75.   for i:= 0 to SampleCount-1 do
  76.   begin
  77.     Result[i].X:=i/SamPerSec ;
  78.     debY:=sin(i*2*pi*Frequency/SamPerSec+(PhaseShift*2*pi/360))*Amplitude+Offset;
  79.     Result[i].Y:=sin(i*2*pi*Frequency/SamPerSec+(PhaseShift*2*pi/360))*Amplitude+Offset;
  80.   end;
  81. end;
  82.  
  83.  
  84. procedure TForm1.FormCreate(Sender: TObject);
  85. var
  86.   LSeriesArray: array of TLineSeries;
  87.   i: integer;
  88.   sin1: TFloatPointArray;
  89. begin
  90.   ctMain:=TChartToolset.Create (Chart1);
  91.  
  92.  
  93.   ctMainAxisClick := TAxisClickTool.Create(ctMain);
  94.   ctMainAxisClick.Shift := [ssLeft];
  95.   ctMainAxisClick.Enabled := True;
  96.   ctMainAxisClick.OnClick := @ctMainAxisClickToolOnCLick;
  97.  
  98.  
  99.   ctMainDataPointDrag:=TDataPointDragTool.Create(ctMain);
  100.   ctMainDataPointDrag.Shift:=[ssLeft];
  101.   ctMainDataPointDrag.Enabled:=True;
  102.   ctMainDataPointDrag.OnDragStart := @ctMainDataPointDragTool1DragStart;
  103.   ctMainDataPointDrag.OnAfterMouseMove:=@ctMainDataPointDragAfterMouseMove;
  104.  
  105.  
  106.   Chart1.Toolset := ctMain;
  107.   ctMainAxisClick.Toolset:=ctMain;
  108.   ctMainDataPointDrag.Toolset:=ctMain;
  109.  
  110.  
  111.   sin1 := GenSin(50,5,1000,0,1000);
  112.   for i:=0 to Length(sin1) do
  113.     Chart1LineSeries1.AddXY(sin1[i].x,sin1[i].y);
  114.  
  115.  
  116.   SetLength (LSeriesArray ,10);
  117.   for i:=0 to 9 do
  118.   begin
  119.     LSeriesArray[i] := TLineSeries.Create(self);
  120.     Chart1.AddSeries(LSeriesArray[i]);
  121.     LSeriesArray[i].Pointer.Visible := true;
  122.     LSeriesArray[i].AddXY(i/10,i);
  123.   end;
  124. end;
  125.  
  126.  
  127. procedure TForm1.ctMainDataPointDragAfterMouseMove(ATool: TChartTool; APoint: TPoint);
  128. begin
  129.   if ctMainDataPointDrag.Series = nil then Label3.Caption := 'nil' else Label3.Caption := IntToStr( ctMainDataPointDrag.Series.Index);
  130.   Label1.Caption := {ChartToolset1DataPointDragTool1.Series.Name + '; ' +}  IntToStr(APoint.X) + '; ' + IntToStr(APoint.y)  ;
  131. end;
  132.  
  133.  
  134. procedure TForm1.ctMainAxisClickToolOnCLick(ASender: TChartTool; Axis: TChartAxis; AHitInfo: TChartAxisHitTests);
  135. begin
  136.   Label2.Caption := Axis.DisplayName;
  137. end;
  138.  
  139.  
  140. procedure TForm1.ctMainDataPointDragTool1DragStart(ASender: TDataPointDragTool; var AGraphPoint: TDoublePoint);
  141. begin
  142.   if ctMainDataPointDrag.Series = nil then exit; //Checks if a dot is dragger, to prevent crashing
  143.   if ctMainDataPointDrag.Series = Chart1LineSeries1 then       ASender.Handled;; //Prevent dragging the main curve
  144. end;
  145.  
  146.  
  147. end.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018