* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: procedure variables with advanced records
« Last post by Bart on Today at 12:06:35 pm »
Maybe https://www.freepascal.org/docs-html/ref/refse17.html help?
See the "is nested" part.

Bart
2
General / Re: procedure variables with advanced records
« Last post by Pascal on Today at 11:28:26 am »
Could be a bug!

Quote
Got "<procedure variable type of procedure;Register>", expected "PROGRAMNAME.<procedure variable type of procedure;Register>"
Expected type has leading "PROGRAMNAME." which makes no sense. Except that the type is identical.
3
Thanks Dmitry ... I did not know that. [size=78%](for others; [/size][/size][size=78%]reference[/size][/size][size=78%])[/size]


I guess that will be a problem for later, since Apple says "Use an NSVisualEffectView with an appropriate material instead.".
I couldn't find an example on how to find the actual color based on that.


Would you happen to know how to use (docs):


Code: Pascal  [Select]
  1. NSDistributedNotificationCenter.addObserver_selector_name_object();


From examples (Swift etc) I have seen, the second parameter (aSelector:SEL) is used to point to a function.
The only thing I found was:


Code: Pascal  [Select]
  1.  _fpc_objc_sel_type = record
  2.   end;
  3.   SEL = ^_fpc_objc_sel_type;

4
General / procedure variables with advanced records
« Last post by creaothceann on Today at 11:01:15 am »
This doesn't work:

Code: Pascal  [Select]
  1. program ProgramName;  {$MODESWITCH AdvancedRecords}
  2.  
  3.  
  4. type
  5.         T_ProcVar = procedure;
  6.  
  7.  
  8.         T = record
  9.                 private
  10.                 procedure _Proc0;
  11.                 procedure _Proc1;
  12.                 procedure _Test(const p : T_ProcVar);
  13.                 public
  14.                 procedure Run;
  15.                 end;
  16.  
  17.  
  18. var
  19.         tmp : T;
  20.  
  21.  
  22. procedure T._Proc0;  begin  end;
  23. procedure T._Proc1;  begin  end;
  24.  
  25.  
  26. procedure T._Test(const p : T_ProcVar);
  27. begin
  28. p;
  29. end;
  30.  
  31.  
  32. procedure T.Run;
  33. begin
  34. _Test(@_Proc0);        // ← error
  35. end;
  36.  
  37.  
  38. begin
  39. tmp.Run;
  40. end.

Quote
Compile Project, Target: AdvRec.exe: Exit code 1, Errors: 1, Hints: 1
AdvRec.lpr(34,14) Error: Incompatible type for arg no. 1: Got "<procedure variable type of procedure;Register>", expected "PROGRAMNAME.<procedure variable type of procedure;Register>"
AdvRec.lpr(26,13) Hint: Found declaration: _Test(const T_ProcVar);

Is this just a matter of syntax?

Changing "procedure;" to "procedure of object;" results in this message:

Quote
AdvRec.lpr(34,14) Error: Incompatible type for arg no. 1: Got "<procedure variable type of procedure;Register>", expected "<procedure variable type of procedure of object;Register>"
5
General / Re: is there a special requirement to use boolean8 ?
« Last post by creaothceann on Today at 10:56:45 am »
For some reason you can't put a ByteBool into a bitpacked record though ("internal error 200706094").
6
General / Re: UTF8 question
« Last post by k1attila1 on Today at 10:53:16 am »
Thank you again
7
General / Re: UTF8 question
« Last post by JuhaManninen on Today at 10:50:19 am »
But how can i change 1 character in an UTF8 string ?
old : s[2]:='A';
First, be careful with the term "character". It can mean many things in Unicode. One meaning is still the "codeunit" which here is Pascal "Char" type.
One meaning is a "user perceived character" which is different from a "codepoint".

Anyway, "characters" or codepoints must be treated as strings when replacing them because their lengths may differ.
StringReplace works because it supports different lengths for its input strings.
Unit LazUTF8 also has UTF8StringReplace which takes care of upper-/lowercase rules of Unicode.
Otherwise you must do some Copy() calls to construct a new string from the start, middle and end parts.
These examples may give you ideas:
 http://wiki.freepascal.org/UTF8_strings_and_characters
Remember, you can also do encoding agnostic code with unit LazUnicode.
8
General / Thread safe classes
« Last post by apeoperaio on Today at 10:46:26 am »
Dear all,

I am working on a multithreaded application.
We had some issues since we used TStringList in our threads and then we got that TStringList is not thread safe.
My questions are:
1. is TStringList not thread safe because of the use of randomized quicksort? (we had issues with TStringList only when we used sorted TStringList)
2. since TFPObjectList does not use randomized quicksort is it thread safe?

And finally, there is a list of thread safe classes and/or functions and procedures?

Andrea
9
General / Re: double type significant digits
« Last post by apeoperaio on Today at 10:40:00 am »
I will have a look, thanks!
10
General / Re: double type significant digits
« Last post by Gammatester on Today at 10:35:19 am »
How can I get those values using the debugger?
I guess it is difficult to get the numbers in the debugger (may be one can write some extensions, I do not know).

You can reproduce the numbers with a multiprecision calculator, that is able to represent IEEE floating point numbers. I use my open source MPArith (http://www.wolfgang-ehrhardt.de/misc_en.html#mparith) calculator t_rcalc (http://www.wolfgang-ehrhardt.de/mp_intro.html#t_rcalc)

Here the mapping double -> mp_float is done with the asd function, which computes the nearest double to the argument.

This is the logging of the calculation for your numbers
Code: [Select]
D:\Math\xx>t_rcalc.exe
Test of MPArith V1.38.10 (31/32 bit) [mp_rcalc]   (c) W.Ehrhardt 2008-2018
Karatsuba  cutoffs: mul/sqr = 16/32
Toom-3, BZ cutoffs: mul/sqr = 32/64,  div = 32
Type "?<enter>" to get some info about commands, "\q" or "quit" to end.
Current bit precision = 240 (max:120000),  decimal precision = 72.2

[D]:=> x = asd(25.144927032417758)
X = 25.144927032417758283600051072426140308380126953125
[D]:=> y = asd(25.144927032417762)
Y = 25.14492703241776183631372987292706966400146484375
[D]:=> z = asd(10.99988788760643)
Z = 10.999887887606430325604378595016896724700927734375
[D]:=> x + z +x
Result = 61.289741952441946892804480739869177341461181640625
[D]:=> y + z +y
Result = 61.289741952441953998231838340871036052703857421875
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus